Minimize ax+(a+4)y, subject to constraints bx+y>=3 & x+4y>=c
and implicit non-negative constraints
LPT[a_,b_,c_]:=Table[Max[Table[{LinearProgramming[{a,
a+4},{{b,1}},{3}],LinearProgramming[{a,
a+5},{{1,4}},{c}]}[[i,j]],{i,2}]],{j,2}];
LPTP[a_,b_,c_]:=Module[{x,y},
T=Flatten[{Table[a*x+(a+4)*y==1+.5i,
{i,7}],b*x+y==3,x+4y==c}];
PL=Flatten[{Table[1+.5i,{i,7}],{3,c}}];
ContourPlot[Evaluate[T],{x,-.1,5},{y,-.1,1},
PlotRange->All,Axes->True,Frame->False,
ContourStyle->{Dotted,Dotted,Dotted,Dotted,
Dotted,Thick,Dashed,Thick,Thick},
PlotLegends->PL,Background->RGBColor["silver"],
Epilog->Style[Circle[LPT[a,b,c],.1],
Darker[Magenta,.7]],ImageSize->500]];
LPTP[1,2,4]
and implicit non-negative constraints
LPT[a_,b_,c_]:=Table[Max[Table[{LinearProgramming[{a,
a+4},{{b,1}},{3}],LinearProgramming[{a,
a+5},{{1,4}},{c}]}[[i,j]],{i,2}]],{j,2}];
LPTP[a_,b_,c_]:=Module[{x,y},
T=Flatten[{Table[a*x+(a+4)*y==1+.5i,
{i,7}],b*x+y==3,x+4y==c}];
PL=Flatten[{Table[1+.5i,{i,7}],{3,c}}];
ContourPlot[Evaluate[T],{x,-.1,5},{y,-.1,1},
PlotRange->All,Axes->True,Frame->False,
ContourStyle->{Dotted,Dotted,Dotted,Dotted,
Dotted,Thick,Dashed,Thick,Thick},
PlotLegends->PL,Background->RGBColor["silver"],
Epilog->Style[Circle[LPT[a,b,c],.1],
Darker[Magenta,.7]],ImageSize->500]];
LPTP[1,2,4]
No comments:
Post a Comment