[Ipopt] dynamic_cast<OrigIpoptNLP*>(GetRawPtr(ip_cq->GetIpoptNLP())) returns NULL-Pointer during restoration phase
Andreas Waechter
andreasw at watson.ibm.com
Tue Jun 23 11:02:54 EDT 2009
Hallo Holger,
The "feasibility restoration phase" in Ipopt is called when Ipopt thinks
it is stuck (in some sense), and then Ipopt calls itself recursively,
solving a related optimization problem that aims at minimizing the
constraint violation of the original problem.
This means, that in the restoration phase the IpoptNLP that is returned
from ip_cq->GetIpoptNLP() is not an OrigIpoptNLP, but rather an
RestoIpoptNLP. But from that one you can the the original OrigIpoptNLP
with the RestoIpoptNLP::OrigIpNLP() method.
So, you can simply check if
const OrigIpoptNLP* orignlp =
dynamic_cast<OrigIpoptNLP*>(GetRawPtr(ip_cq->GetIpoptNLP()))
is NULL. If it is, try
RestoIpoptNLP* restonlp =
dynamic_cast<RestoIpoptNLP*>(GetRawPtr(ip_cq->GetIpoptNLP()))
and get
orignlp = &restonlp->OrigIpNLP();
(Or something like that, I might have made a mistake there, but this is
the relationship between the classes.)
I hope this helps,
Andreas
On Wed, 17 Jun 2009, holger ackermann wrote:
> Hello to the list,
>
> this is my first post, so I'll write a few words about my "project". I'm
> currently writing my master thesis in structural engineering about a new
> algorithm to solve nonlinear constraint conditions in a spatial
> framework analysis software. I already included Ipopt in this software
> and my work is almost done except for this strange thing.
>
> I need to evaluate the intermediate solution of the untransformed
> problem in TNLP::intermediate_callback. I found this post
> (http://list.coin-or.org/pipermail/ipopt/2008-November/001375.html) and
> the proposed solution works fine except when I have problems that enter
> the restoration phase. Say, when
> SolverReturn resto_status = resto_alg_->Optimize(true);
> is called instead of
> status = p2alg->Optimize();
>
> I'm using the C++ interface to Ipopt 3.6.1 and this is the code for
> MY_NLP::intermediate_callback so far:
> -->
> OrigIpoptNLP* orignlp =
> dynamic_cast<OrigIpoptNLP*>(GetRawPtr(ip_cq->GetIpoptNLP()));
> assert(orignlp);
> TNLPAdapter* tnlp_adapter =
> dynamic_cast<TNLPAdapter*>(GetRawPtr(orignlp->nlp()));
> assert(tnlp_adapter);
>
> Number* my_x = new Number[size_x];
> tnlp_adapter->ResortX(*(Vector*)(GetRawPtr(ip_data->curr()->x())), my_x);
>
> return check(my_x);
> <--
>
> During restoration phase
> dynamic_cast<OrigIpoptNLP*>(GetRawPtr(ip_cq->GetIpoptNLP())) returns a
> NULL-Pointer with which I cannot proceed as intended.
>
> I'm not quite sure what "restoration phase" means as I'm not very
> familiar with the theory of Ipopt, but maybe someone can give me a
> hint if it's possible to get the intermediate solution during
> restoration phase and (if yes) how to obtain it.
>
>
> Any help is greatly appreciated, thanks in advance.
>
> Holger
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>
>
More information about the Ipopt
mailing list