Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve API ergonomics #82

Merged
merged 12 commits into from
Apr 15, 2024
Merged

Improve API ergonomics #82

merged 12 commits into from
Apr 15, 2024

Commits on Apr 12, 2024

  1. chore: clippy

    chrjabs committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    c8bb79e View commit details
    Browse the repository at this point in the history
  2. feat: instance ergonomics for member variables

    Introduces:
    - `SatInstance::var_manager_ref()`
    - `SatInstance::var_manager_mut()`
    - `SatInstance::n_vars()`
    - `OptInstance::constraints_ref()`
    - `OptInstance::constraints_mut()`
    - `OptInstance::objective_ref()`
    - `OptInstance::objective_mut()`
    - `MultiOptInstance::constraints_ref()`
    - `MultiOptInstance::constraints_mut()`
    - `MultiOptInstance::objective_ref()`
    - `MultiOptInstance::objective_mut()`
    
    Deprecates:
    - `SatInstance::var_manager()`
    - `OptInstance::get_constraints()`
    - `OptInstance::get_objective()`
    - `MultiOptInstance::get_constraints()`
    - `MultiOptInstance::get_objective()`
    chrjabs committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    8d5a2ab View commit details
    Browse the repository at this point in the history
  3. feat: ergonomics for opb writing

    Make `to_opb` and similar opb writing functions take by reference
    instead of by value. Some still need to take mutable references, provide
    workarounds in documentation if additional guarantees are known.
    chrjabs committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    8caeaf5 View commit details
    Browse the repository at this point in the history
  4. feat: ergonomics for dimacs writing

    Make `to_dimacs` and similar dimacs writing functions take by reference
    instead of by value. For the high-level instance types mutable
    references are still needed; provide `Cnf::to_dimacs` and workarounds in
    documentation if additional guarantees are known.
    chrjabs committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    871e79c View commit details
    Browse the repository at this point in the history
  5. feat: add add_clause_ref method to Solve trait

    Since external libraries cannot easily take ownership anyway, for most
    solvers this is more reasonable.
    Add a default implementation for `add_clause` that can be overwritten
    for solvers that can truly take ownership.
    chrjabs committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    bd499ec View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2024

  1. Configuration menu
    Copy the full SHA
    36d2fcf View commit details
    Browse the repository at this point in the history
  2. feat: add add_nary function

    chrjabs committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    f84765e View commit details
    Browse the repository at this point in the history
  3. refactor: mixed cleanup tasks

    - rename file writing methods `write_` rather than `to_`
    - make all file writing methods take references and return errors if not
      in right format
    - rename all heavy converters `into_`
    - rename all inplace converters `convert_to_`
    chrjabs committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    4086bac View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f7ba7a9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9c605cb View commit details
    Browse the repository at this point in the history
  6. perf: avoid unnecessary cloning

    in tests and two methods of `Objective` type
    chrjabs committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    3220ea1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    af9d3fc View commit details
    Browse the repository at this point in the history