<div dir="ltr">Thanks Stefan,<div><br></div><div>I tested the error proposed in the ticket and since I could reproduce it, I applied the patch. Now it's gone.</div><div>Despite this, I still see the deviation in answers to the problem I have.</div>
<div>To clear the way this error is produced, I solve three very similar optimization problems in succession (say t=0, t=1 and t=2 problems). I run this two times, and for each run, I provide Ipopt with the exact answer for t=0. Since problems at t=1 and 2 are similar, it is expected that answers are the same, but I see that at t=1 there is a deviation on the order of 1e-4 across the 2 runs and at t=2 it's on the order of 1e-3 (and this error can propagate larger if i continue this)</div>
<div>As stated, despite this, Ipopt is giving me answers both of which respect all (non-linear) constraints of the problem, so they are all correct answers in this sense, although I expect ipopt to follow a determinism path and arrive at the same correct answer from the same initial point every time.</div>
<div><br></div><div>I will try to find the differences in the ipopt report of problems and post them here if I could figure out the reason.<br></div><div><br></div><div>Alireza</div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Mon, Dec 17, 2012 at 2:14 PM, Stefan Vigerske <span dir="ltr"><<a href="mailto:stefan@math.hu-berlin.de" target="_blank">stefan@math.hu-berlin.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
you could also try setting the ipopt.print_level to a high value (like 12) and see where two runs that should have the same result start to have different behavior.<br>
<br>
Also have a look at this issue: <a href="https://projects.coin-or.org/Ipopt/ticket/187" target="_blank">https://projects.coin-or.org/<u></u>Ipopt/ticket/187</a><br>
This has been fixed with Ipopt 3.10.3, but if you use an older library, then you may want to check that your functions that return gradients do not report sparse vectors.<br>
<br>
Stefan<div><div class="h5"><br>
<br>
On 12/17/2012 06:46 PM, AliReza Khoshgoftar Monfared wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi,<br>
I tried export OMP_NUM_THREADS1=1 and runnig matlab using the<br>
"-singleCompThread" option.<br>
It still seems like that I have distinct answers for the same problem with<br>
the same initial point:(. But monitoring "top", I can see that sometimes I<br>
have one MATLAB process that is always there and another that comes and<br>
goes, I'll look into this again to make sure if its still using<br>
multi-threading or not.<br>
I'm trying to see if there is any MPI settings when building Ipopt or its<br>
matlab interface.<br>
There is also an mpisettings() function in matlab, but I don't see an<br>
option for it to change matlab behavior, it only has a "deadlock detection<br>
mode".<br>
<br>
Alireza<br>
<br>
<br>
On Mon, Dec 17, 2012 at 12:31 PM, Vivek Periaraj<br>
<<a href="mailto:vivek.periaraj@gmail.com" target="_blank">vivek.periaraj@gmail.com</a>><u></u>wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In CPLEX multi-threading environment, there are two modes - deterministic<br>
and opportunistic. In the deterministic mode, the algorithm would follow<br>
the same path between each identical runs, hence the solution vector would<br>
remain the same. In the other mode, this is not guaranteed. If you use MPI<br>
for this, then I guess you could manually enforce such similar<br>
deterministic behavior.<br>
<br>
<br>
Regards,<br>
Vivek.<br>
<br>
----- Original Message -----<br>
<br>
From: "AliReza Khoshgoftar Monfared" <<a href="mailto:khoshgoftar@gmail.com" target="_blank">khoshgoftar@gmail.com</a>><br>
To: <a href="mailto:ipopt@list.coin-or.org" target="_blank">ipopt@list.coin-or.org</a>, "jonathan hogg" <<a href="mailto:jonathan.hogg@stfc.ac.uk" target="_blank">jonathan.hogg@stfc.ac.uk</a>>,<br>
"vivek periaraj" <<a href="mailto:vivek.periaraj@gmail.com" target="_blank">vivek.periaraj@gmail.com</a>><br>
Sent: Monday, December 17, 2012 10:32:34 PM<br>
Subject: Re: IpOpt code: Detereministic or Random across various runs?<br>
<br>
<br>
<br>
<br>
Thanks Vivek and Jonathan,<br>
<br>
<br>
I also suspect that this issue has something to do with MATLAB (or<br>
settings of BLAS and LAPACK).<br>
<br>
My original MATLAB code should be single-threaded, but I am suspicious<br>
that when I call Ipopt(), which uses the corresponding mex file, there<br>
might be multiple threads involved.<br>
Is there a way to force a single thread in MATLAB though?<br>
<br>
<br>
Alireza<br>
<br>
<br>
<br>
<br>
<br>
Might also be worth seeing if you can force everything to run<br>
single-threaded and seeing if that has any effect. Some parallel<br>
algorithms will produce different results on different runs, and even<br>
small changes in the descend direction can produce different results as<br>
you describe.<br>
Jonathan.<br>
<br>
On 15/12/12 11:52, Vivek Periaraj wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Maybe the data structures interfaced from MATLAB to IPOPT are in<br>
</blockquote>
different orders in each run? Sometimes the order in which the variables<br>
are created affect the solution the algorithm converges to in the end.<br>
Especially true when multiple optimal solutions exists.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Regards,<br>
Vivek<br>
<br>
<br>
Hi,<br>
<br>
I have been trying to solve an optimization with Ipopt.<br>
<br>
I'm using the MATLAB interface of Ipopt, and my optimization problem is a<br>
not so complicated quadratic problem satisfying a number of distance<br>
inequalities for some points.<br>
<br>
I have noticed that in different cases of my problem, whether it is<br>
</blockquote>
solved<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
(status 0), detected infeasible (status 2) or exceeded maximum iterations<br>
(status -2), even if I run the code with the exact same initial point and<br>
exact same options, I get results that are different.<br>
Now, I know that my problem does not have a unique solution, e.g. in case<br>
of instances that are solved completely I get different results while all<br>
satisfy the constraints. But still, I expect ipopt to give<br>
me similar results when I run it with similar conditions.<br>
<br>
Is there any option in Ipopt that accounts to randomness. Or is it a<br>
behavior of MATLAB?<br>
<br>
I have noticed that building Ipopt with various versions of BLAS and<br>
</blockquote>
LAPACK<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
does not affect this in my case (I tried third party versions provided,<br>
</blockquote>
and<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
also ATLAS implementations of libraries in Liunx), but forcing MALTAB to<br>
use different BLAS and LAPACK versions (through environment variables<br>
BLAS_VERSION and LAPACK_VERSION) has an effect (although in no case, I<br>
</blockquote>
get<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
exactly similar results) .<br>
<br>
Has anybody else had such an experience with IpOpt? Should I change a<br>
setting in Ipopt ot MATLAB?<br>
<br>
Thanks<br>
ALireza<br>
<br>
<br>
PS: If it helps, here is a summary of Ipopt options I have changed:<br>
<br>
ipopt.hessian_approximation = 'limited-memory';<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
ipopt.mu_strategy = 'adaptive'; > tols = [1e-6; Options.MaxR;<br>
</blockquote></blockquote>
Options.MaxR]; > ipopt.tol = sum(tols); > ipopt.constr_viol_tol = tols(1);<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
ipopt.compl_inf_tol = tols(2); > ipopt.dual_inf_tol = tols(3); ><br>
</blockquote>
hessian_constant = 'yes'; > ipopt.warm_start_init_point = 'yes';<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
______________________________<u></u>_________________<br>
Ipopt mailing list<br>
Ipopt at <a href="http://list.coin-or.org" target="_blank">list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/ipopt" target="_blank">http://list.coin-or.org/<u></u>mailman/listinfo/ipopt</a><br>
</blockquote>
--<br>
Scanned by iCritical.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Fri, Dec 14, 2012 at 7:11 PM, AliReza Khoshgoftar Monfared <<br>
<a href="mailto:khoshgoftar@gmail.com" target="_blank">khoshgoftar@gmail.com</a> > wrote:<br>
<br>
<blockquote><br>
<br>
Hi,<br>
<br>
<br>
I have been trying to solve an optimization with Ipopt.<br>
<br>
<br>
I'm using the MATLAB interface of Ipopt, and my optimization problem is a<br>
not so complicated quadratic problem satisfying a number of distance<br>
inequalities for some points.<br>
<br>
<br>
I have noticed that in different cases of my problem, whether it is solved<br>
(status 0), detected infeasible (status 2) or exceeded maximum iterations<br>
(status -2), even if I run the code with the exact same initial point and<br>
exact same options, I get results that are different.<br>
Now, I know that my problem does not have a unique solution, e.g. in case<br>
of instances that are solved completely I get different results while all<br>
satisfy the constraints. But still, I expect ipopt to give me similar<br>
results when I run it with similar conditions.<br>
<br>
<br>
Is there any option in Ipopt that accounts to randomness. Or is it a<br>
behavior of MATLAB?<br>
<br>
<br>
I have noticed that building Ipopt with various versions of BLAS and<br>
LAPACK does not affect this in my case (I tried third party versions<br>
provided, and also ATLAS implementations of libraries in Liunx), but<br>
forcing MALTAB to use different BLAS and LAPACK versions (through<br>
environment variables BLAS_VERSION and LAPACK_VERSION) has an effect<br>
(although in no case, I get exactly similar results) .<br>
<br>
<br>
Has anybody else had such an experience with IpOpt? Should I change a<br>
setting in Ipopt ot MATLAB?<br>
<br>
<br>
Thanks<br>
ALireza<br>
<br>
<br>
<br>
<br>
PS: If it helps, here is a summary of Ipopt options I have changed:<br>
<br>
<br>
<br>
<blockquote><br>
ipopt.hessian_approximation = 'limited-memory';<br>
ipopt.mu_strategy = 'adaptive';<br>
tols = [1e-6; Options.MaxR; Options.MaxR];<br>
ipopt.tol = sum(tols);<br>
ipopt.constr_viol_tol = tols(1);<br>
ipopt.compl_inf_tol = tols(2);<br>
ipopt.dual_inf_tol = tols(3);<br>
hessian_constant = 'yes';<br>
ipopt.warm_start_init_point = 'yes';<br>
</blockquote><br>
<br>
</blockquote><br>
<br>
</blockquote>
<br>
<br>
<br></div></div>
______________________________<u></u>_________________<br>
Ipopt mailing list<br>
<a href="mailto:Ipopt@list.coin-or.org" target="_blank">Ipopt@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/ipopt" target="_blank">http://list.coin-or.org/<u></u>mailman/listinfo/ipopt</a><br>
<br>
</blockquote>
<br>
</blockquote></div><br></div>