multiple nonlinear inequality constraints

Hi, I am trying to impose two nonlinear inequality constraints, but I think the following codes actually may let the second constraint overwrite the first in c0.IneqProc. Any suggestions on how to impose multiple nonlinear inequality constraints would be appreciated!

proc ineqp1(struct PV p, struct DS d);
local stdt, stdcyc, stds, rtc, rts, rcs, v;
stdt=pvUnpack(p,"sigt");
stdcyc=pvUnpack(p,"sigc");
stds=pvUnpack(p,"sigs");
rtc=pvUnpack(p,"corr_tauc");
rts=pvUnpack(p,"corr_taus");
rcs=pvUnpack(p,"corr_cs");
v=zeros(3,3);
v[1,1]=stdt^2;
v[2,1]=rtc*stdt*stdcyc; v[1,2]=v[2,1];
v[2,2]=stdcyc^2;
v[3,3]=stds^2;
v[1,3]=rts*stdt*stds; v[3,1]=v[1,3];
v[2,3]=rcs*stdcyc*stds; v[3,2]=v[2,3];
retp(minc(eigh(v[1:3,1:3])) - 1e-5);
endp;
proc ineqp2(struct PV p, struct DS d);
local phi1,phi2;
phi1=pvUnpack(p,"rho1");
phi2=pvUnpack(p,"rho2");
retp(-1*(phi1*phi1+4*phi2) - 0);
endp;
c0.IneqProc = &ineqp1;
c0.IneqProc = &ineqp2;

0

You can only specify one procedure for inequality constraints.  You are right about what is happening to your code.  If you have more than one inequality constraint, stack them in the one procedure by concatenation and return that:

```proc ineqp1(struct PV p, struct DS d);
local stdt, stdcyc, stds, rtc, rts, rcs, v;
stdt=pvUnpack(p,"sigt");
stdcyc=pvUnpack(p,"sigc");
stds=pvUnpack(p,"sigs");
rtc=pvUnpack(p,"corr_tauc");
rts=pvUnpack(p,"corr_taus");
rcs=pvUnpack(p,"corr_cs");
v=zeros(3,3);
v[1,1]=stdt^2;
v[2,1]=rtc*stdt*stdcyc; v[1,2]=v[2,1];
v[2,2]=stdcyc^2;
v[3,3]=stds^2;
v[1,3]=rts*stdt*stds; v[3,1]=v[1,3];
v[2,3]=rcs*stdcyc*stds; v[3,2]=v[2,3];

local const1, const2;

const1 = minc(eigh(v[1:3,1:3])) - 1e-5

local phi1,phi2, const2;
phi1=pvUnpack(p,"rho1");
phi2=pvUnpack(p,"rho2");

const2 -1*(phi1*phi1+4*phi2) - 0;

retp(const1 | const2);

endp;
```

I have to admit that I don't understand the ' - 0'.

0

Thanks so much! It is working although imposing two nonlinear inequality constraints makes convergence really hard. I have removed '-0' in the codes. Many thanks!

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.