[Bonmin] Unconstrained MINLP

Pierre Bonami pierre.bonami at gmail.com
Wed Nov 5 13:38:57 EST 2014


Hi,
At least one thing even if you don't have constraints the Hessian is not
empty. You still have to give second derivatives for your objective
function.
Then are you sure you are also giving correctly the gradient of the
objective?
Good luck,
Pierre
On Nov 5, 2014 6:14 PM, "Ramesh, Ujwal (rameshul)" <rameshul at mail.uc.edu>
wrote:

>
>
>  Hi All,
>
>
>  Sorry for the delayed response. I was trying to debug using valgrind.
> Also apologize for the log detailed mail.
>
>
>  Let me first a give a little background.
>
>
>  I was originally using wnnlp (Will Naylor Non linear solver) to solve my
> non linear problem. As I wanted to include Mixed integer variables, I am
> migrating my problem to Bonmin.
>
>
>  To start with I am not including my mixed integer variables and setting
> up Bonmin to run the nonlinear part like in wnnlp.  (I have reused
> functions from my wnnlp and hence I know that there are no errors in
> calculating objective and gradients).
>
>
>  Also, I am first trying to solve an unconstrained optimization problem
> and eventually include constraints.
>
>
>  I am looking at  ~/Bonmin-1.7/Bonmin/examples/CppExample to build my
> application.
>
>
>  Likewise, The below are the snippets of my code for an unconstrained NLP
> minimization.
>
>
>  The belew describes the hierarchy I have used to interface the solver:
>
>
>  using namespace Ipopt;
> using namespace Bonmin;
> class Design : public TMINLP {
>  private:
>
> ...
>
> ..
>
>
>  The below is the get_nlp_info subroutine for my unconstrained problem
>
>
>  bool Design::get_nlp_info(Index& n, Index&m, Index& nnz_jac_g,Index&
> nnz_h_lag, TNLP::IndexStyleEnum& index_style){
> std::vector<Cell *> cellsToSolve;
> getNLPCellsToSolveNew ((*this),cellsToSolve);
> int size = 2*(cellsToSolve.size());
> n = size;
> m=0;
> nnz_jac_g = 0;
> nnz_h_lag = 0;
> index_style = TNLP::FORTRAN_STYLE;
> return true;
> }
>
>  The below are the functions for constraints. As I am trying the
> unconstrained optimization first, i am not initializing anything: ( *I
> need more insight here as to whether this could be the cause of my memory
> leak*)
>
>
>  bool Design::eval_g(Index n, const Number* x, bool new_x, Index m,
> Number* g){return true;}
>
> bool Design::eval_jac_g(Index n, const Number* x, bool new_x,
>                         Index m, Index nele_jac, Index* iRow, Index *jCol,
>                         Number* values){return true;}
>
> bool Design::eval_h(Index n, const Number* x, bool new_x,
>                         Number obj_factor, Index m, const Number* lambda,
>                         bool new_lambda, Index nele_hess, Index* iRow,
>                         Index* jCol, Number* values){return true;}
>
>  The below snippet is of the error and valgrind report:
>
>
>  Cbc3007W No integer variables - nothing to do
>
>
> ******************************************************************************
> This program contains Ipopt, a library for large-scale nonlinear
> optimization.
>  Ipopt is released as open source code under the Eclipse Public License
> (EPL).
>          For more information visit http://projects.coin-or.org/Ipopt
>
> ******************************************************************************
>
> NLP0014I             3      FAILED 1.2952534e+08     3000 291.55422
> Problem status: 5
> Objective value: 1.79769e+308
> *** glibc detected *** ./../../code/the_exec-g: double free or corruption
> (out): 0x00007fff63b1f3d0 ***
>
>
>
>  and the valgrind report has the kind of errors like below:
>
>
>  ==26498== Conditional jump or move depends on uninitialised value(s)
> ==26498==    at 0x5F2E414:
> Ipopt::OptimalityErrorConvergenceCheck::CurrentIsAcceptable() (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5ED04E1:
> Ipopt::BacktrackingLineSearch::FindAcceptableTrialPoint() (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5EEC8C0: Ipopt::IpoptAlgorithm::Optimize(bool) (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E7A1F3: Ipopt::IpoptApplication::call_optimize() (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E7DF6C:
> Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr<Ipopt::NLP> const&,
> Ipopt::SmartPtr<Ipopt::AlgorithmBuilder>&) (in /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E7EF17:
> Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr<Ipopt::NLP> const&)
> (in /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E79D59:
> Ipopt::IpoptApplication::OptimizeTNLP(Ipopt::SmartPtr<Ipopt::TNLP> const&)
> (in /usr/lib/libipopt.so.0)
> ==26498==    by 0x4EF5E84:
> Bonmin::IpoptSolver::OptimizeTNLP(Ipopt::SmartPtr<Ipopt::TNLP> const&) (in
> /usr/lib/libbonmin.so.0)
> ==26498==    by 0x4EDA733:
> Bonmin::OsiTMINLPInterface::solveAndCheckErrors(bool, bool, char const*)
> (in /usr/lib/libbonmin.so.0)
> ==26498==    by 0x4EDC126: Bonmin::OsiTMINLPInterface::initialSolve(char
> const*) (in /usr/lib/libbonmin.so.0)
> ==26498==    by 0x51E82D6: CbcModel::initialSolve() (in
> /usr/lib/libCbc.so.0)
> ==26498==    by 0x4E6FE69:
> Bonmin::Bab::branchAndBound(Bonmin::BabSetupBase&) (in
> /usr/lib/libbonmin.so.0)
> ==26498==  Uninitialised value was created by a stack allocation
> ==26498==    at 0x4690E1: Design::eval_grad_f(int, double const*, bool,
> double*) (DesignTMINLP.cxx:185)
> ==26498==
>
>
>  ==26498== Use of uninitialised value of size 8
> ==26498==    at 0x5FC6D10: Ipopt::DenseVector::AmaxImpl() const (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5ECCBF1: Ipopt::BacktrackingLineSearch::DetectTinyStep()
> (in /usr/lib/libipopt.so.0)
> ==26498==    by 0x5ED0575:
> Ipopt::BacktrackingLineSearch::FindAcceptableTrialPoint() (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5EEC8C0: Ipopt::IpoptAlgorithm::Optimize(bool) (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E7A1F3: Ipopt::IpoptApplication::call_optimize() (in
> /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E7DF6C:
> Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr<Ipopt::NLP> const&,
> Ipopt::SmartPtr<Ipopt::AlgorithmBuilder>&) (in /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E7EF17:
> Ipopt::IpoptApplication::OptimizeNLP(Ipopt::SmartPtr<Ipopt::NLP> const&)
> (in /usr/lib/libipopt.so.0)
> ==26498==    by 0x5E79D59:
> Ipopt::IpoptApplication::OptimizeTNLP(Ipopt::SmartPtr<Ipopt::TNLP> const&)
> (in /usr/lib/libipopt.so.0)
> ==26498==    by 0x4EF5E84:
> Bonmin::IpoptSolver::OptimizeTNLP(Ipopt::SmartPtr<Ipopt::TNLP> const&) (in
> /usr/lib/libbonmin.so.0)
> ==26498==    by 0x4EDA733:
> Bonmin::OsiTMINLPInterface::solveAndCheckErrors(bool, bool, char const*)
> (in /usr/lib/libbonmin.so.0)
> ==26498==    by 0x4EDC126: Bonmin::OsiTMINLPInterface::initialSolve(char
> const*) (in /usr/lib/libbonmin.so.0)
> ==26498==    by 0x51E82D6: CbcModel::initialSolve() (in
> /usr/lib/libCbc.so.0)
> ==26498==  Uninitialised value was created by a stack allocation
> ==26498==    at 0x4690E1: Design::eval_grad_f(int, double const*, bool,
> double*) (DesignTMINLP.cxx:185)
>
>
>
>  As per the above report, the uninitialized value is created by the
> function eval_grad_f() , but I am using the same function for wnnlp and it
> works just fine. I tried stepping into the program using gdb but as I am
> interfacing using *.so files, gdb is not letting me do it.
>
>
>
> Any inputs will definitely help.
>
>
>  Thanks in advance.
>
>
>  Regards,
>  Ujwal Ramesh
> Graduate Student,
> University Of Cincinnati
> Ph: +1-513-302-4771
>   ------------------------------
> *From:* Ramesh, Ujwal (rameshul)
> *Sent:* Wednesday, October 29, 2014 2:45 PM
> *To:* Tony Kelman; bonmin at list.coin-or.org
> *Subject:* Re: [Bonmin] Unconstrained MINLP
>
>
> Sure Tony,
>
>
>  I will provide that soon.
>
>
>  Thanks and regards,
>  Ujwal Ramesh
> Graduate Student,
> University Of Cincinnati
> Ph: +1-513-302-4771
>   ------------------------------
> *From:* Tony Kelman <kelman at berkeley.edu>
> *Sent:* Wednesday, October 29, 2014 2:43 PM
> *To:* Ramesh, Ujwal (rameshul); bonmin at list.coin-or.org
> *Subject:* Re: [Bonmin] Unconstrained MINLP
>
>   I think you’ll have to provide some simple example code of what you’re
> trying to do, and the error message in its entirety, for anyone to be able
> to tell exactly where the problem lies.
>
>
>  *From:* Ramesh, Ujwal (rameshul) <rameshul at mail.uc.edu>
> *Sent:* Wednesday, October 29, 2014 11:39 AM
> *To:* bonmin at list.coin-or.org
> *Subject:* [Bonmin] Unconstrained MINLP
>
>
> Hi All,
>
>
>
> I am trying to run Bonmin for my application which is an unconstrained
> MINLP. I am calling Bonmin through a C++ interface.
>
>
>
> To invoke Bonmin, I need to define a few virtual functions inm y code.
>
>
>
> As my application is an unconstrained MINLP, I will not be defining the
> constraint variables, constraint functions,function to compute jacobian and
> the function to compute the hessian of the Lagrangean ( eval_g,
> eval_jac_g,eval_h etc. ).
>
>
>  By not defining the above function I am initializing the respective
> vectors, matrices and the variables (number of non zeros in jacobian and
> hessian ) to NULL but this is causing the solver to fail with a length
> error.
>
>
>
> I am a rookie to optimization and any inputs as to what I am missing is
> much appreciated. I guess I am missing something conceptually as I have
> double checked syntactical/logical correctness of code.
>
>
>
> Thanks a lot in advance.
>
>
>
> Regards,
>  Ujwal Ramesh
> Graduate Student,
> University Of Cincinnati
> Ph: +1-513-302-4771
>
> ------------------------------
> _______________________________________________
> Bonmin mailing list
> Bonmin at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/bonmin
>
> _______________________________________________
> Bonmin mailing list
> Bonmin at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/bonmin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/bonmin/attachments/20141105/341587dd/attachment-0001.html>


More information about the Bonmin mailing list