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

Branching function gets called when time limit hit during LP construction #199

Closed
dchetelat opened this issue Jun 18, 2021 · 0 comments · Fixed by #206
Closed

Branching function gets called when time limit hit during LP construction #199

dchetelat opened this issue Jun 18, 2021 · 0 comments · Fixed by #206
Labels
type/bug 🐛 Something isn't working

Comments

@dchetelat
Copy link
Contributor

dchetelat commented Jun 18, 2021

When a time limit is set in Ecole using the scip parameter limits/time, and occurs while the LP is being constructed at a node, the LP construction is aborted, but for some reason the brancher still gets called. This results in weird states where there is no LP, and SCIPgetNLPCols returns 0, yet some variables might have nonzero LP column indices, etc. Quite dangerous.

In particular, this led to a segfault here at line 76 of

/* Store strong branching scores in tensor */
auto const num_lp_columns = static_cast<std::size_t>(SCIPgetNLPCols(scip));
auto strong_branching_scores = xt::xtensor<double, 1>({num_lp_columns}, std::nan(""));
for (auto const [var, score] : views::zip(cands, cands_scores)) {
auto const lp_index = static_cast<std::size_t>(SCIPcolGetLPPos(SCIPvarGetCol(var)));
strong_branching_scores[lp_index] = static_cast<double>(score);
}

because lp_index was nonzero but strong_branching_scores was a xtensor of length nb_cols=0.

This is symptomatic of more general issues: what should happen if an observation extraction function gets called after SCIP is in a stopped state? (SCIPisStopped() returns True.) My suggestion would be to add a check, in the code common to all observation functions for all environments, that avoids calling the extraction function if SCIPisStopped()==True. In that case the observation function would return {}/None.

@dchetelat dchetelat added the type/bug 🐛 Something isn't working label Jun 18, 2021
@dchetelat dchetelat changed the title Branching function gets called when timit limit hit during LP construction Branching function gets called when time limit hit during LP construction Jun 18, 2021
@dchetelat dchetelat linked a pull request Jun 25, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant