-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: fix whitespace in README * docs: fix whitespace in CONTRIBUTING.md * chore: add dev container definition * docs: document dev containers for contributors * chore: enable autocomplete in dev container * chore: remove useless WORKDIR from dev container Dockerfile * chore: add missing cmake,clang to devcontainer * chore: add system setup script * chore: use system setup script in dev container * chore: use system setup script in CI * docs: rework contribution guide about dev containers * docs: fix title case in contribution guide * chore: use bundled SCIP in CI * chore: drop conda setup from CI * build: respect new scip_bundled feature everywhere * build: require `scip` for `scip_bundled` * docs: update scip usage docs * chore: fix typo in Cargo.toml * chore: fix scip feature usage in CI * chore: no need to sudo in Dockerfile * chore: do not run `cargo install` as root * docs: be more specific about the dev container setup command
- Loading branch information
1 parent
a64ab42
commit 5bd41e9
Showing
9 changed files
with
89 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm | ||
|
||
RUN apt-get update && apt-get install -y vim curl | ||
|
||
COPY ./build/ ./build/ | ||
RUN ./build/setup.sh && rm -r ./build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "Existing Dockerfile", | ||
"build": { | ||
"context": "..", | ||
"dockerfile": "./Dockerfile" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker", | ||
"ms-vscode-remote.remote-containers", | ||
"rust-lang.rust-analyzer" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "./build/postsetup.sh && P=~/.local/share/bash-completion/completions && mkdir -p $P && rustup completions bash > $P/rustup && rustup completions bash cargo > $P/cargo" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
# General guidelines | ||
# General Guidelines | ||
|
||
Contribution happens through github. | ||
Contribution happens through GitHub. | ||
|
||
Please format your code with `cargo fmt`, and if you add a new feature, update the README, the doc comments, and the doc tests accordingly. | ||
|
||
# Adding a new solver | ||
## Adding a New Solver | ||
|
||
Adding a new solver should not take more than a few hundred lines of code, tests included. | ||
|
||
- add the solver as an optional dependency in `Cargo.toml` | ||
- add a file named after your solver in the [solvers](./src/solvers) folder | ||
- you can copy microlp, our smallest solver interface, as a starting point. | ||
- create a struct to store linear problems in a way that will make it cheap to dynamically add new constraints to the problem, | ||
and easy to pass the problem to the solver once it has been fully constructed. | ||
This generally means constructing vectors to which you can push values for each new constraint. | ||
You can generally reuse data structures provided by the library for which you are creating a wrapper. | ||
- implement a function named after your solver that takes an [`UnsolvedProblem`](https://docs.rs/good_lp/latest/good_lp/variable/struct.UnsolvedProblem.html) and returns the struct you defined above. | ||
- implement the [`SolverModel`](https://docs.rs/good_lp/latest/good_lp/index.html#reexport.SolverModel) trait for your new problem type. | ||
- add your solver to `lib.rs` and to the `all_default_solvers` feature in Cargo.toml. | ||
- open a [pull request](https://github.com/rust-or/good_lp/pulls) | ||
- add the solver as an optional dependency in `Cargo.toml` | ||
- add a file named after your solver in the [solvers](./src/solvers) folder | ||
- you can copy microlp, our smallest solver interface, as a starting point. | ||
- create a struct to store linear problems in a way that will make it cheap to dynamically add new constraints to the problem, | ||
and easy to pass the problem to the solver once it has been fully constructed. | ||
This generally means constructing vectors to which you can push values for each new constraint. | ||
You can generally reuse data structures provided by the library for which you are creating a wrapper. | ||
- implement a function named after your solver that takes an [`UnsolvedProblem`](https://docs.rs/good_lp/latest/good_lp/variable/struct.UnsolvedProblem.html) and returns the struct you defined above. | ||
- implement the [`SolverModel`](https://docs.rs/good_lp/latest/good_lp/index.html#reexport.SolverModel) trait for your new problem type. | ||
- add your solver to `lib.rs` and to the `all_default_solvers` feature in Cargo.toml. | ||
- open a [pull request](https://github.com/rust-or/good_lp/pulls) | ||
|
||
## Dev Container Setup | ||
|
||
This repository contains a dev container definition. | ||
This gives you a working system setup with all solvers installed with a single command. | ||
It will also give you the entire Rust toolchain as well as all necessary VS Code extensions. | ||
|
||
1. Make sure you have [Docker](https://docs.docker.com/engine/install/) installed on your system | ||
2. Make sure you have the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed in VS Code | ||
3. Run the command `Dev Containers: Reopen in Container` in VS Code | ||
|
||
Done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Print commands, exit upon error | ||
set -ex | ||
|
||
# Install wasm-pack | ||
cargo install wasm-pack |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Print commands, exit upon error | ||
set -ex | ||
|
||
# Change CWD to script location | ||
cd "${0%/*}" | ||
|
||
# Install CBC, HiGHS, lp_solve | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y coinor-cbc coinor-libcbc-dev libgsl-dev build-essential cmake clang | ||
|
||
# Install CPLEX | ||
curl -LO https://github.com/rust-or/good_lp/releases/download/cplex/cplex.bin | ||
chmod u+x cplex.bin | ||
./cplex.bin -f ./response.properties |