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

PrimalSearch environment #183

Merged
merged 17 commits into from
Jun 18, 2021
Merged

PrimalSearch environment #183

merged 17 commits into from
Jun 18, 2021

Conversation

gasse
Copy link
Member

@gasse gasse commented May 8, 2021

Pull request checklist

  • I have open an issue to discuss the proposed changes. See New environment: PrimalSearch #182
  • I have modified/added tests to cover the new changes/features.
  • I have modified/added the documentation to cover the new changes/features.
  • I have ran the tests, checks, and code formatters.

Proposed implementation

The environment is implemented though a primal heuristic plugin. The environment deviates little from the behavior of a primal heuristic, except that it offers an option for the primal search to be called several times (users can be allowed several trials, i.e., several actions, at each node). Also, users have the option to provide only a partial solution, which SCIP will try to complete if possible by fixing the variables in the partial solution and then solving an LP.

@gasse gasse requested a review from AntoinePrv May 8, 2021 08:00
@gasse gasse self-assigned this May 8, 2021
@gasse gasse added the type/enhancement 🚀 New feature or request label May 8, 2021
@gasse gasse linked an issue May 8, 2021 that may be closed by this pull request
libecole/src/scip/scimpl.cpp Outdated Show resolved Hide resolved
Comment on lines 165 to 163
// if action is empty, do nothing
if (varvals.empty()) {
*result = SCIP_DIDNOTFIND;
return SCIP_OKAY;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will SCIP run the other (default) scip::ObjHeur callbacks, and is this what we want?
Just asking, I'm not sure what the desired behavior is here.
Perhaps change the comment do nothing to what will happen globally.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those lines were simply about removing some computational overhead in the specific case where the action is {}, by simply doing nothing. The environment should behave in the same way if we remove those lines. If no variable fixings are provided, it will simply re-solve the node's LP. If the LP solution was integer-feasible, then it should already have been found by SCIP when it solved the LP in the first place.

Note: I actually ran some tests with and without those lines, and it appears this is not true. While adding those lines indeed reduces (slightly) the number of LP iterations, it also increase the number of nodes...

Solving 10 instances, with 500 empty actions at each node, without those lines:
nnodes 219
lpiters 3553
time 16.094735185

Same instances, same seed, with those lines:
nnodes 223
lpiters 3466
time 13.932313034

Users providing an empty action should be a rare situation I believe, especially 500 times in a row for each node. Also it seems SCIP handles nicely the re-solving of the same LP several times in a row. Should I remove those lines then, to have the code simpler and the environment's behavior more consistent (always solving the LP) ?

libecole/src/scip/scimpl.cpp Outdated Show resolved Hide resolved
libecole/src/scip/scimpl.cpp Outdated Show resolved Hide resolved
libecole/src/scip/scimpl.cpp Outdated Show resolved Hide resolved
libecole/src/dynamics/primalsearch.cpp Outdated Show resolved Hide resolved
libecole/src/dynamics/primalsearch.cpp Outdated Show resolved Hide resolved
libecole/src/dynamics/primalsearch.cpp Outdated Show resolved Hide resolved
libecole/include/ecole/dynamics/primalsearch.hpp Outdated Show resolved Hide resolved
@AntoinePrv
Copy link
Member

A very general, low priority, comment (but Branching is doing the same) is that Model is growing in size, with code that is related to the the environments (due to the reverse callbacks).

A better split would be that Model::solve_iter_branch... take as parameter only the SCIP_RESULT and manage only start/pause/errors, while the logic of the environment would be kept in the dynamics.

@AntoinePrv AntoinePrv mentioned this pull request May 10, 2021
5 tasks
@AntoinePrv AntoinePrv added new/dynamics ⚙️ Ecole dynamics (for environments) and removed type/enhancement 🚀 New feature or request labels Jun 12, 2021
@AntoinePrv AntoinePrv changed the base branch from master to dev June 15, 2021 16:06
libecole/include/ecole/dynamics/primalsearch.hpp Outdated Show resolved Hide resolved
libecole/include/ecole/scip/model.hpp Outdated Show resolved Hide resolved
libecole/src/dynamics/primalsearch.cpp Outdated Show resolved Hide resolved
libecole/src/dynamics/primalsearch.cpp Outdated Show resolved Hide resolved
libecole/include/ecole/dynamics/primalsearch.hpp Outdated Show resolved Hide resolved
libecole/src/scip/scimpl.cpp Outdated Show resolved Hide resolved
libecole/src/scip/scimpl.cpp Show resolved Hide resolved
libecole/src/scip/scimpl.cpp Outdated Show resolved Hide resolved
python/src/ecole/core/dynamics.cpp Outdated Show resolved Hide resolved
@gasse gasse requested a review from AntoinePrv June 18, 2021 04:51
Copy link
Member

@AntoinePrv AntoinePrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for passing over the other docstrings!

@AntoinePrv
Copy link
Member

Documentation tests are failing because https://www.scipopt.org/ is down (hence making broken link) but I think we can merge.

@AntoinePrv AntoinePrv merged commit fa5dbd3 into dev Jun 18, 2021
@AntoinePrv AntoinePrv deleted the primal-env branch June 18, 2021 14:42
@gasse
Copy link
Member Author

gasse commented Jun 29, 2021

Closes #182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new/dynamics ⚙️ Ecole dynamics (for environments)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New environment: PrimalSearch
2 participants