Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.99 KB

CONTRIBUTING.md

File metadata and controls

33 lines (24 loc) · 1.99 KB

General Guidelines

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 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 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 and returns the struct you defined above.
    • implement the 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

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 installed on your system
  2. Make sure you have the Dev Containers extension installed in VS Code
  3. Run the command Dev Containers: Reopen in Container in VS Code

Done.