<div dir="ltr">Hi,<div>I tried export OMP_NUM_THREADS1=1 and runnig matlab using the &quot;-singleCompThread&quot; option. </div><div>It still seems like that I have distinct answers for the same problem with the same initial point:(.  But monitoring &quot;top&quot;, I can see that sometimes I have one MATLAB process that is always there and another that comes and goes, I&#39;ll look into this again to make sure if its still using multi-threading or not.</div>

<div>I&#39;m trying to see if there is any MPI settings when building Ipopt or its matlab interface.</div><div>There is also an mpisettings() function in matlab, but I don&#39;t see an option for it to change matlab behavior, it only has a &quot;deadlock detection mode&quot;.</div>

<div><br></div><div>Alireza</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 17, 2012 at 12:31 PM, Vivek Periaraj <span dir="ltr">&lt;<a href="mailto:vivek.periaraj@gmail.com" target="_blank">vivek.periaraj@gmail.com</a>&gt;</span> wrote:<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 and opportunistic. In the deterministic mode, the algorithm would follow the same path between each identical runs, hence the solution vector would remain the same. In the other mode, this is not guaranteed. If you use MPI for this, then I guess you could manually enforce such similar deterministic behavior.<br>


<br>
<br>
Regards,<br>
Vivek.<br>
<br>
----- Original Message -----<br>
<br>
From: &quot;AliReza Khoshgoftar Monfared&quot; &lt;<a href="mailto:khoshgoftar@gmail.com">khoshgoftar@gmail.com</a>&gt;<br>
To: <a href="mailto:ipopt@list.coin-or.org">ipopt@list.coin-or.org</a>, &quot;jonathan hogg&quot; &lt;<a href="mailto:jonathan.hogg@stfc.ac.uk">jonathan.hogg@stfc.ac.uk</a>&gt;, &quot;vivek periaraj&quot; &lt;<a href="mailto:vivek.periaraj@gmail.com">vivek.periaraj@gmail.com</a>&gt;<br>


Sent: Monday, December 17, 2012 10:32:34 PM<br>
Subject: Re: IpOpt code: Detereministic or Random across various runs?<br>
<div><div class="h5"><br>
<br>
<br>
<br>
Thanks Vivek and Jonathan,<br>
<br>
<br>
I also suspect that this issue has something to do with MATLAB (or settings of BLAS and LAPACK).<br>
<br>
My original MATLAB code should be single-threaded, but I am suspicious that when I call Ipopt(), which uses the corresponding mex file, there 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>
&gt; Maybe the data structures interfaced from MATLAB to IPOPT are in different orders in each run? Sometimes the order in which the variables are created affect the solution the algorithm converges to in the end. Especially true when multiple optimal solutions exists.<br>


&gt;<br>
&gt; Regards,<br>
&gt; Vivek<br>
&gt;<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I have been trying to solve an optimization with Ipopt.<br>
&gt;<br>
&gt; I&#39;m using the MATLAB interface of Ipopt, and my optimization problem is a<br>
&gt; not so complicated quadratic problem satisfying a number of distance<br>
&gt; inequalities for some points.<br>
&gt;<br>
&gt; I have noticed that in different cases of my problem, whether it is solved<br>
&gt; (status 0), detected infeasible (status 2) or exceeded maximum iterations<br>
&gt; (status -2), even if I run the code with the exact same initial point and<br>
&gt; exact same options, I get results that are different.<br>
&gt; Now, I know that my problem does not have a unique solution, e.g. in case<br>
&gt; of instances that are solved completely I get different results while all<br>
&gt; satisfy the constraints. But still, I expect ipopt to give<br>
&gt; me similar results when I run it with similar conditions.<br>
&gt;<br>
&gt; Is there any option in Ipopt that accounts to randomness. Or is it a<br>
&gt; behavior of MATLAB?<br>
&gt;<br>
&gt; I have noticed that building Ipopt with various versions of BLAS and LAPACK<br>
&gt; does not affect this in my case (I tried third party versions provided, and<br>
&gt; also ATLAS implementations of libraries in Liunx), but forcing MALTAB to<br>
&gt; use different BLAS and LAPACK versions (through environment variables<br>
&gt; BLAS_VERSION and LAPACK_VERSION) has an effect (although in no case, I get<br>
&gt; exactly similar results) .<br>
&gt;<br>
&gt; Has anybody else had such an experience with IpOpt? Should I change a<br>
&gt; setting in Ipopt ot MATLAB?<br>
&gt;<br>
&gt; Thanks<br>
&gt; ALireza<br>
&gt;<br>
&gt;<br>
&gt; PS: If it helps, here is a summary of Ipopt options I have changed:<br>
&gt;<br>
&gt; ipopt.hessian_approximation = &#39;limited-memory&#39;;<br>
&gt;&gt; ipopt.mu_strategy = &#39;adaptive&#39;; &gt; tols = [1e-6; Options.MaxR; Options.MaxR]; &gt; ipopt.tol = sum(tols); &gt; ipopt.constr_viol_tol = tols(1); &gt; ipopt.compl_inf_tol = tols(2); &gt; ipopt.dual_inf_tol = tols(3); &gt; hessian_constant = &#39;yes&#39;; &gt; ipopt.warm_start_init_point = &#39;yes&#39;;<br>


&gt; _______________________________________________<br>
&gt; Ipopt mailing list<br>
&gt; Ipopt at <a href="http://list.coin-or.org" target="_blank">list.coin-or.org</a><br>
&gt; <a href="http://list.coin-or.org/mailman/listinfo/ipopt" target="_blank">http://list.coin-or.org/mailman/listinfo/ipopt</a><br>
--<br>
Scanned by iCritical.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Fri, Dec 14, 2012 at 7:11 PM, AliReza Khoshgoftar Monfared &lt; <a href="mailto:khoshgoftar@gmail.com">khoshgoftar@gmail.com</a> &gt; wrote:<br>
<br>
</div></div>&lt;blockquote&gt;<br>
<div class="im"><br>
Hi,<br>
<br>
<br>
I have been trying to solve an optimization with Ipopt.<br>
<br>
<br>
I&#39;m using the MATLAB interface of Ipopt, and my optimization problem is a not so complicated quadratic problem satisfying a number of distance inequalities for some points.<br>
<br>
<br>
I have noticed that in different cases of my problem, whether it is solved (status 0), detected infeasible (status 2) or exceeded maximum iterations (status -2), even if I run the code with the exact same initial point and 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 of instances that are solved completely I get different results while all satisfy the constraints. But still, I expect ipopt to give me similar 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 behavior of MATLAB?<br>
<br>
<br>
I have noticed that building Ipopt with various versions of BLAS and LAPACK does not affect this in my case (I tried third party versions provided, and also ATLAS implementations of libraries in Liunx), but forcing MALTAB to use different BLAS and LAPACK versions (through environment variables BLAS_VERSION and LAPACK_VERSION) has an effect (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 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>
</div>&lt;blockquote&gt;<br>
<div class="im">ipopt.hessian_approximation = &#39;limited-memory&#39;;<br>
ipopt.mu_strategy = &#39;adaptive&#39;;<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 = &#39;yes&#39;;<br>
ipopt.warm_start_init_point = &#39;yes&#39;;<br>
</div>&lt;/blockquote&gt;<br>
<br>
&lt;/blockquote&gt;<br>
</blockquote></div><br></div>