[Ipopt] Segmentation fault for very simple problem

Stefan Vigerske stefan at math.hu-berlin.de
Wed Jun 8 10:46:19 EDT 2011


Hi,

> bool DemoProblem::get_nlp_info( Index&  n, Index&  m, Index&  nnz_jac_g,
>                               Index&  nnz_h_lag, IndexStyleEnum&  index_style )
> {
> 	n = 2;
> 	m = 0;
> 	index_style = TNLP::C_STYLE;
> 	return true;
>}

You should set nnz_jac_g to 0 and nnz_h_lag to 2.

> bool DemoProblem::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; }

You should implement this method properly to return the hessian of the 
objective, multiplied by obj_factor.

> it works fine and I get no segmentation fault. I don't see where I'm
> making a mistake here. Maybee somebody can help me?

Run in a debugger. Try valgrind.

Stefan

-- 
Stefan Vigerske
Humboldt University Berlin, Numerical Mathematics
http://www.math.hu-berlin.de/~stefan



More information about the Ipopt mailing list