node limit with integer solution

54 views
Skip to first unread message

Fabian Wilschewski

unread,
Jun 27, 2016, 1:34:25 PM6/27/16
to AMPL Modeling Language
Hello,

i want to solve a MIP problem within a node limit to use the (so far) best found solution.
With
option cplex_options 'nodes 10';
solve;
i've almost reached what i wanted in the first step:

CPLEX 12.6.1.0: nodes 10
CPLEX 12.6.1.0: node limit with integer solution; objective 21174
4706 MIP simplex iterations
12 branch-and-bound nodes
absmipgap = 141.729, relmipgap = 0.00669353

First question is, why doesn't ampl stop exactly at 10 nodes?

Second issue is, i want to go on like this with nodes 20, 30, 40,...
Is there a way to do that, without starting at the beginning of the branch&bound algorithm every time?
I need the objective and all variables values of the solutions.

Many thanks in advance.

Fabian

Robert Fourer

unread,
Jun 27, 2016, 7:31:41 PM6/27/16
to am...@googlegroups.com
After CPLEX for AMPL has been stopped by a node limit, it can't be restarted except at the beginning. You can specify

option cplex_options 'mipdisplay=2 mipinterval=10';

and then CPLEX will display the objective value and other useful information at every 10th node. But if you want to see all of the solutions that CPLEX found, you should turn on the solution pool option by setting for example

option cplex_options 'poolstub=mymod';

and then CPLEX will write a separate solution file each time a new integer-feasible solution is found. After CPLEX finishes, you can access the solutions with a loop like this:

for {i in 1 .. Current.npool}
{
solution ("mymod" & i & ".sol");
display _varname, _var;
}

Of course you can use a different filename stub than mymod and you can process the solution with other commands than "display _varname, _var;".

(If you set option cplex_options 'mipdisplay=2 mipinterval=1 nodes=10' then you will see that CPLEX really does stop after the node numbered 10, but at that point it may consider that has processed more than 10 nodes, for example due to work at node 0.)

Bob Fourer
am...@googlegroups.com

=======
Reply all
Reply to author
Forward
0 new messages