SIAM

Constrained SIAM function

SIAM[{x1_,x2_}]:=Exp[Sin[50 x1]]+Sin[60 Exp[x2]]+Sin[70 Sin[x1]]+Sin[Sin[80 x2]]-Sin[10 (x1+x2)]+1/4 (x1^2+x2^2)
c[1][{x1_,x2_}]:=(x1^2)+ 0.3 x2
c[2][{x1_,x2_}]:=-(x1^3)- 0.5 x2
c[3][{x1_,x2_}]:= 1+x1+x2
c[4][{x1_,x2_}]:= 1+x1-x2
ContourPlot[
SIAM[{x1,x2}],
{x1,-0.7,0.5},{x2,-0.7,0.5},
Contours->Range[-5,5,0.5],
ColorFunctionScaling->False,
ColorFunction->Function[{z},Hue[((z+5)/10)]],
RegionFunction->Function[{x1,x2,z}, 
And[
c[1][{x1,x2}]>0, 
c[2][{x1,x2}]>0,
c[3][{x1,x2}]>0,
c[4][{x1,x2}]>0
]
]
]

ContourPlot[{
c[1][{x1,x2}]==0,
c[2][{x1,x2}]==0,
c[3][{x1,x2}]==0,
c[4][{x1,x2}]==0
},
{x1,-0.7,0.5},
{x2,-0.7,0.5}
]

Penalized SIAM function

QuadraIneq[c_]:= If[c>0,0,(c^2)]
LinearIneq[c_]:= If[c>0,0,-c]
SIAMPenalty[{x1_,x2_},μ_]:= SIAM[{x1,x2}]+(μ/2)Sum[QuadraIneq[c[i][{x1,x2}]],{i,1,4}] 
ContourPlot[
SIAMPenalty[{x1,x2},1000],
{x1,-0.7,0.5},{x2,-0.7,0.5},
Contours->Range[-5,5,0.5],
ColorFunctionScaling->False,
ColorFunction->Function[{z},Hue[((z+5)/10)]]
]

Barrier SIAM function

LogBarrier[c_]:= -Log[c]
SIAMBarrier[{x1_,x2_},ϵ_]:= SIAM[{x1,x2}]+ϵ Sum[LogBarrier[c[i][{x1,x2}]],{i,1,4}] 
ContourPlot[
SIAMBarrier[{x1,x2},0.01],
{x1,-0.7,0.5},{x2,-0.7,0.5},
Contours->Range[-5,5,0.5],
ColorFunctionScaling->False,
ColorFunction->Function[{z},Hue[((z+5)/10)]]
]

Positive Definate Quadratic

Constrained Quadratic function

Quad[{x1_,x2_}]:=3 (((x1-x2))^2)+ 2 (((x1+3 x2))^2)+ 2 x1 - x2
c[1][{x1_,x2_}]:=(x1^2)+ 0.3 x2
c[2][{x1_,x2_}]:=-(x1^3)- 0.5 x2
c[3][{x1_,x2_}]:= 1+x1+x2
c[4][{x1_,x2_}]:= 1+x1-x2
MmaPicNice=ContourPlot[
Quad[{x1,x2}],
{x1,-0.7,0.5},{x2,-0.7,0.5},
Contours->Range[-5,5,0.5],
ColorFunctionScaling->False,
ColorFunction->Function[{z},Hue[((z+5)/10)]],
RegionFunction->Function[{x1,x2,z}, 
And[
c[1][{x1,x2}]>0, 
c[2][{x1,x2}]>0,
c[3][{x1,x2}]>0,
c[4][{x1,x2}]>0
]
]
]

ContourPlot[{
c[1][{x1,x2}]==0,
c[2][{x1,x2}]==0,
c[3][{x1,x2}]==0,
c[4][{x1,x2}]==0
},
{x1,-0.7,0.5},
{x2,-0.7,0.5}
]

Penalized Quad function

QuadraIneq[c_]:= If[c>0,0,(c^2)]
LinearIneq[c_]:= If[c>0,0,-c]
QuadPenalty[{x1_,x2_},μ_]:= Quad[{x1,x2}]+(μ/2)Sum[QuadraIneq[c[i][{x1,x2}]],{i,1,4}] 
ContourPlot[
QuadPenalty[{x1,x2},10000],
{x1,-0.7,0.5},{x2,-0.7,0.5},
Contours->Range[-5,5,0.5],
ColorFunctionScaling->False,
ColorFunction->Function[{z},Hue[((z+5)/10)]]
]

QuadOpt[μ_,{x10_,x20_}]:=Module[
{x1,x2,fVal,sub},
{fVal,sub}=FindMinimum[ QuadPenalty[{x1,x2},μ], {{x1,x10},{x2,x20}}];
{fVal,{x1,x2}/.sub}
]
{x10,x20}={-0.2,0.05};
Data=Table[
μ=(2.0^i);
{fVal,{x10,x20}}=QuadOpt[μ,{x10,x20}];
{μ,fVal,{x10,x20}},
{i,1, 15}]

Lets see what it looks like.

ContourPlot[
Quad[{x1,x2}],
{x1,-0.4,0.2},{x2,0,0.1},
Contours->120,
ColorFunction->Hue,
RegionFunction->Function[{x1,x2,z}, 
And[
c[1][{x1,x2}]>0, 
c[2][{x1,x2}]>0,
c[3][{x1,x2}]>0,
c[4][{x1,x2}]>0
]
],
Epilog->Map[Point,Data[[All,3]]]
]

The built-in solver gives

FindMinimum[{
Quad[{x1,x2}],
And[
c[1][{x1,x2}]>0,
c[2][{x1,x2}]>0,
c[3][{x1,x2}]>0,
c[4][{x1,x2}]>0
]
},
{{x1,-0.2},{x2,0.03}}]

Barrier Quad function

LogBarrier[c_]:= -Log[c]
QuadBarrier[{x1_,x2_},ϵ_]:= Quad[{x1,x2}]+ϵ Sum[LogBarrier[c[i][{x1,x2}]],{i,1,4}] 
ϵ0=0.1;
{x10,x20}={-0.3829,0.04264};
ContourPlot[
QuadBarrier[{x1,x2},ϵ0],
{x1,-0.7,0.5},{x2,-0.7,0.5},
Contours->Range[-5,5,0.5],
ColorFunctionScaling->False,
Epilog->{Red,Point[{x10,x20}]},
ColorFunction->Function[{z},Hue[((z+5)/10)]]
]

QuadOptBarrier[ϵ_,{x10_,x20_}]:=Module[
{x1,x2,fVal,sub},
{fVal,sub}=FindMinimum[ QuadBarrier[{x1,x2},ϵ], {{x1,x10},{x2,x20}},
 Method->"Newton"
];
{fVal,{x1,x2}/.sub}
]
ϵ0=0.1;
{x10,x20}={-0.3829,0.04264};
Data=Table[
ϵ=ϵ0 (2.0^(-i));
{fVal,{x10,x20}}=QuadOptBarrier[ϵ,{x10,x20}];
{ϵ,fVal,{x10,x20}},
{i,0, 12}];
ListPlot[Data[[All,2]]]

Lets see what it looks like.

ContourPlot[
Quad[{x1,x2}],
{x1,-0.4,0.2},{x2,0,0.1},
Contours->120,
ColorFunction->Hue,
RegionFunction->Function[{x1,x2,z}, 
And[
c[1][{x1,x2}]>0, 
c[2][{x1,x2}]>0,
c[3][{x1,x2}]>0,
c[4][{x1,x2}]>0
]
],
Epilog->Map[Point,Data[[All,3]]],
PlotLabel->"Barrier"
]