[Ipopt] Same input, different output if executed in a loop (c++)

Patrick Kugler patrick.kugler at informatik.uni-erlangen.de
Tue Jan 7 09:00:17 EST 2014


Hi Roberto,

does your algorithm (or the solver) rely on a random number generator?
If so, please check if you provide it with the same seed before each run. 

If you use rand() simply call srand(1) before each execution.
See http://www.cplusplus.com/reference/cstdlib/srand/

Regards,
Patrick

On 07 Jan 2014, at 12:30, Roberto Verdelli <roberto.verdelli at techedgegroup.com> wrote:

> Scenario: c++ code.
> Whenever I run my optimization problem with the same inputs, by double clicking the executable twice or more, I get the exact same output every time. That's logical because the algorithm is deterministic.
> 
> The weird thing is that if I wrap my code in a loop that solves twice the same exact problem I get two different results. (in terms of number of iterations and value of the figure of merit)
> I checked and there's no persistent variable that could hold some result of the previous iteration.
> 
> I guess the problem is related to the primal/dual infeasibility problem because, checking the verbose output, I see the divergence of the two solutions start as soon as the P/D infeasibility problem is solved for the first time (first iteration).
> 
> Should this happen or should I double check for some persistent data that is shared between iterations? (I'm pretty sure there's no such data)
> 
> Does IpOpt keep in memory something of the previous run? Is there a way to clear this data?
> 
> Thanks for your help.
> Roberto.
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt




More information about the Ipopt mailing list