Dynamic stopping criteria Intlinprog

5 views (last 30 days)
robbert
robbert on 19 Feb 2015
Commented: robbert on 20 Feb 2015
Dear all,
I am using the intlinprog solver in a for loop running the optimisation for ~80 times. Would it be possible to use a stopping criteria such as if a feasable solution has been found with a relative gap below 0.05 stop after 15.000 nodes, if not continue to find one for 150.000 nodes? Now I am using both the tolgaprel and maxnodes stopping criteria, TolGapRel is set to 0.02 and MaxNodes to 50.000, since often the solution is near enough to 0.02 and I don't want it to keep finding for better solutions for ages until TolGapRel is <0.02. However sometimes it cannot find a solution in 50k nodes.

Answers (1)

Alan Weiss
Alan Weiss on 19 Feb 2015
You can write an output function to stop intlinprog according to any criterion you like. You have to be able to define the stopping criterion unambiguously, which might be difficult.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
robbert
robbert on 20 Feb 2015
Thanks Alan,
Made it work to my liking using the following code:
%
function stop = stopFcn(x,optimValues, state)
stop = false;
if optimValues.numfeaspoints >= 1
if optimValues.relativegap < 5 && optimValues.numnodes > 5000
stop = true;
elseif optimValues.relativegap < 1
stop = true;
elseif optimValues.numnodes > 20000
stop = true;
else
stop = false;
end
elseif optimValues.numnodes > 1e6
stop = true;
else
stop = false;
end

Sign in to comment.

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!