1
$\begingroup$

The feasible region is the rectangle defined by

40,000 <= x <= 80,000
30,000 <= y <= 50,000

intersected with the half-plane x + y <= 110,000.

The optimum is on the upper left hand corner where the lines y = 50,000 and x = 40,000 intersect.

How can I make a plot to visualize this problem?

$\endgroup$
  • $\begingroup$ What is the formula you are optimising? $\endgroup$ – Edmund Sep 23 '17 at 19:48
  • $\begingroup$ the formula is '19125. - 0.590625 x + 1.1875 y' $\endgroup$ – soso Sep 23 '17 at 21:22
2
$\begingroup$

You may use RegionPlot and ImplicitRegion to visualise the region. The Optimization guide will be useful to verify your results with functions like Maximize.

I have taken the problem as $\text{Max}(y-x)$ since none was provided.

With[{reg = ImplicitRegion[x + y <= 110000, {{x, 40000, 80000}, {y, 30000, 50000}}]},
 RegionPlot[
  reg,
  Epilog -> {Red, PointSize[Scaled[.04]], 
    Point[{x, y}] /. Last@Maximize[-x + y, {x, y} ∈ reg]}
  ]
 ]

Mathematica graphics

Hope this helps.


Update for ContourPlot

ContourPlot[
 -x + y, {x, 40000, 80000}, {y, 30000, 50000},
 RegionFunction -> Function[{x, y, z}, x + y <= 110000],
 Epilog -> {Red, PointSize[Scaled[.04]], 
   Point[{x, y}] /.
    Last@Maximize[-x + y, {x, y} ∈
       ImplicitRegion[x + y <= 110000, {{x, 40000, 80000}, {y, 30000, 50000}}]]},
 PlotPoints -> 25,
 PlotLegends -> Automatic
 ]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you so much. but how can I plot the lines on the same graph? $\endgroup$ – soso Sep 23 '17 at 20:34
  • $\begingroup$ @soso By lines are you referring to contours? If so then see ContourPlot and its the RegionFunction option. $\endgroup$ – Edmund Sep 23 '17 at 20:58
  • $\begingroup$ How can I do it? $\endgroup$ – soso Sep 23 '17 at 21:07
  • $\begingroup$ @soso This is kind of awkward because you have accepted someone else's answer but it appears that you need my answer and also would like me to put in more work to refine my answer. I see you are new here so I will hook you up this time. However, in future keep it mind that it is a bit rude to rude accept another answer then ask another poster to refine their answer because that is the one you really want. You are messing with people's imaginary Interweb points. You'll quickly make a bad name for yourself. $\endgroup$ – Edmund Sep 23 '17 at 21:13
  • $\begingroup$ I'm so sorry. I'm new here. I was not know that I have just to press the answer that I accept. I'm really sorry about that $\endgroup$ – soso Sep 23 '17 at 21:19
0
$\begingroup$

The feasible region is given by

plot3d = Plot3D[
   x + y, 
  {x, 4, 8}, 
  {y, 3, 5}, 
  RegionFunction -> Function[{x, y}, x + y <= 11], 
  MeshStyle -> None, 
  ColorFunction -> "SolarColors"
]

This point is used to visualy locate the optimum

point3d = Graphics3D[{
  Blend[{Blue, White}], 
  PointSize[Scaled[0.025]], 
  Point[{4, 5, 9}]
 }
]

Combining the two

Show[
  plot3d, 
  point3d
]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.