Question: For loop with globalsolve terminates after timelimit is reached

In order to optimize a large number of datasets I integrated the GlobalSolve command from the OptimizationToolbox
in a for loop. The code (in short form) looks like this:

for i from  1 to 100 do
data(i):= "read data from external file":
Z:= "function to optimize based on data(i)":
with(GlobalOptimization):
infolevel(GlobalOptimization):=4
B:=GlobalSolve(Z, a=0..2, b=0..2, c=0..2, timelimit=6000):
->Solution of optimization is exported to external file
end do:

Unfortnuately the optimization procedure does not always retrun a solution within the given timelimit. Whenever this
happens, the for loop is exited and the calculation is stopped (although i has not reached 100). I tried to add the GetLastSolution()-Command to avoid the error and added

GetLastSolution()

after "B:=GlobalSolve(Z, a=0..2, b=0..2, c=0..2, timelimit=6000)" but this does not solve the problem, because the code
is halted before GetLastSolution is executed. Does anybody know how I can use the GetLastSolution-Command (or something
else) so that the loop is not stopped?

 

Please Wait...