Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: support setting initial values for individual variables #75

Merged
merged 32 commits into from
Feb 18, 2025

Conversation

KnorpelSenf
Copy link
Contributor

As discussed in #55 (comment) and below

Previously, when building up an initial solution from the problem
variables would cause repeated reallocation. We support partial initial
solutions so we may have 0-n values in the initial solution (with n
being the number of total variables). We do not want to allocate memory
for all variables because there might be 0 initial values, and we also
do not want to do allocate 0 memory because then we have to repeatedly
reallocate memory as the initial solution grows.

These changes introduce a counter that is incrememted whenever a
variable with an initial value is added to the problem. That way, we can
allocate the perfect number of bytes upfront in all cases.
@KnorpelSenf
Copy link
Contributor Author

Please see KnorpelSenf#1 before merging

@KnorpelSenf
Copy link
Contributor Author

Do you know why the assertion fails?

@KnorpelSenf
Copy link
Contributor Author

I will continue this after #83 has landed. That way, we can directly support initial values for individual variables for all supported solvers.

@KnorpelSenf KnorpelSenf marked this pull request as draft January 21, 2025 14:59
lovasoa and others added 10 commits January 22, 2025 08:49
…values (rust-or#78)

* More details in README:
- add more detail on constraining variables to integer solutions
- show the `(integer)` qualifier syntax inside the `variables!` macro
- update documentation links to use `latest`

Add test in `variables.rs` showing `(integer)` qualifier

* - conditional config for test - integer variables not suppored by "clarabel" solver

---------

Co-authored-by: Niklas Smedemark-Margulies <niklas.smedemark-margulies@analog.com>
* chore: do not bundle scip on docs.rs

* docs: add comment on docs.rs features
@KnorpelSenf KnorpelSenf marked this pull request as ready for review January 22, 2025 09:28
@KnorpelSenf KnorpelSenf requested a review from lovasoa January 22, 2025 09:28
@KnorpelSenf
Copy link
Contributor Author

@lovasoa please let me know if you don't want to review this based on the diff, I can clean up the commit history a bit and force-push the branch

@KnorpelSenf
Copy link
Contributor Author

Ready

@KnorpelSenf
Copy link
Contributor Author

Anything else I should change?

@lovasoa lovasoa merged commit 347fd91 into rust-or:main Feb 18, 2025
1 check passed
@KnorpelSenf KnorpelSenf deleted the initial-variable-values branch February 18, 2025 17:36
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants