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

add with_all function to model #80

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AlpMimaroglu
Copy link

Adds the with_all function to the model. It is a convenience function for code organization in the case where people organize their code to have functions that return a list of constraints so that they can be added to the model in the regular builder function style instead of having to add them via

for constaint in constraints {
    model = model.with(constraint)
}

which breaks the builder pattern flow.
Did not know where to put a unit test for the function or even if one is necessary. As long as add_constraint() works it should work as well but if a correct place for one is suggested I don't mind adding one.

src/solvers/mod.rs Outdated Show resolved Hide resolved
src/solvers/mod.rs Show resolved Hide resolved
@AlpMimaroglu
Copy link
Author

AlpMimaroglu commented Jan 8, 2025

changed the floating point comparison to not check strict equality because clarabel was failing

@AlpMimaroglu
Copy link
Author

Rust f64::EPSILON value was still too small for the difference clarabel causes so added a 1e-10 epsilon value to check floating point difference. This value should be big enough to not cause any flaky tests or issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: adding multiple constraints with .with_all()
2 participants