# [Ipopt] Matlab crashes when infeasible solution is found

Siddharth Goyal siddelec at gmail.com
Tue Jan 10 11:46:06 EST 2012

```Yes, it works fine for a feasible problem. for example if I change the problem statement to,
>> min x1^2+x2^2
>> such that x1-3X2 =0,
>> 1<x1,x2<10

I get the following results on matlab console.

This is Ipopt version 3.8stable, running with linear solver ma57.

Number of nonzeros in equality constraint Jacobian...:        2
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:        2
variables with only lower bounds:        0
variables with lower and upper bounds:        2
variables with only upper bounds:        0
Total number of equality constraints.................:        1
Total number of inequality constraints...............:        0
inequality constraints with only lower bounds:        0
inequality constraints with lower and upper bounds:        0
inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
0  7.2701000e+00 5.30e-01 5.11e+00   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
1  7.2565014e+00 4.99e-01 1.39e+01  -5.3 1.69e-01    -  9.72e-01 5.84e-02h  1
2  1.0008950e+01 4.44e-16 1.20e-15  -2.1 5.00e-01    -  1.00e+00 1.00e+00h  1
3  1.0000089e+01 4.44e-16 2.90e-06  -8.0 1.34e-03    -  9.90e-01 9.91e-01f  1
4  9.9999998e+00 0.00e+00 9.57e-10 -10.0 1.34e-05    -  1.00e+00 1.00e+00f  1

Number of Iterations....: 4

(scaled)                 (unscaled)
Objective...............:   9.9999998194553239e+00    9.9999998194553239e+00
Dual infeasibility......:   9.5732740321517994e-10    9.5732740321517994e-10
Constraint violation....:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   4.7273292320677366e-08    4.7273292320677366e-08
Overall NLP error.......:   4.7273292320677366e-08    4.7273292320677366e-08

Number of objective function evaluations             = 5
Number of objective gradient evaluations             = 5
Number of equality constraint evaluations            = 5
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 1
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 0
Total CPU secs in IPOPT (w/o function evaluations)   =      0.851
Total CPU secs in NLP function evaluations           =      0.043

EXIT: Optimal Solution Found.

ans =

3.0000    1.0000

Siddharth
On Jan 10, 2012, at 11:37 AM, Ray Zimmerman wrote:

> It might be related to the libraries it attempts to use to print to the console. Can you get it to print progress successfully for a feasible problem?
>
> --
> Ray Zimmerman
> Senior Research Associate
> 419A Warren Hall, Cornell University, Ithaca, NY 14853
> phone: (607) 255-9645
>
>
>
>
> On Jan 10, 2012, at 10:54 AM, Siddharth Goyal wrote:
>
>> Hi,
>>
>> I have a precompiled ipopt.mexmaci64 file which was complied on a different system. I am able to run all the predefine examples (eg. examplehs051,...) with the mex file on my system. However, when there is no feasible solution Matlab crashes. Is it because mex file was complied on another system? If not, what can be the possible reason?
>>
>> BTW, I was trying to solve a simple problem,
>> min x1^2+x2^2
>> such that x1+3X2 =0,
>> 1<x1,x2<10
>>
>> I have used the following code.
>>
>> function [x, info] = examplehs051
>>
>>   x0         = [ 2.5 0.5 ];  % The starting point.
>>    options.lb = [1 1 ];  % Lower bound on the variables.
>>   options.ub = [+10 +10];  % Upper bound on the variables.
>>
>>   options.cl = [ 0 ];             % Lower bounds on constraints.
>>   options.cu = [ 0 ];             % Upper bounds on constraints.
>>
>>   % Set the IPOPT options.
>>   options.ipopt.jac_c_constant        = 'yes';
>>   options.ipopt.hessian_approximation = 'limited-memory';
>>   options.ipopt.tol                   = 1e-7;
>>
>>   % The callback functions.
>>   funcs.objective         = @objective;
>>   funcs.constraints       = @constraints;
>>   funcs.jacobian          = @jacobian;
>>   funcs.jacobianstructure = @jacobian;
>>
>>   % Run IPOPT.
>>   [x info] = ipopt(x0,funcs,options);
>>
>> % ----------------------------------------------------------------------
>> function f = objective (x)
>>   f = x(1)^2 + x(2)^2;
>>
>> % ----------------------------------------------------------------------
>> function g = gradient (x)
>>   g = 2*[ x(1) ;
>> 	  x(2) ]';
>> % ----------------------------------------------------------------------
>> function c = constraints (x)
>>   c = [ x(1) + 3*x(2)   ];
>>
>> % ----------------------------------------------------------------------
>> function J = jacobian (x)
>>   J = sparse([ 1  +3 ]);
>>
>>
>> Any suggestion is highly appreciated
>> Thanks
>>
>> Siddharth
>> _______________________________________________
>> Ipopt mailing list
>> Ipopt at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/ipopt
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20120110/34c23824/attachment.html>
```