2
$\begingroup$

Iam trying to include a manipulate to NMaximize function to see how the output values are changing for p and t. By varying the variable w, x, y and z. Kindly please help me to resolve this, the file in attachment Thanks

Manipulate[[NMaximize[{
    (*Objective function*)
    -6 p + 92 t,
    (*Constraints*)
    -0.3 p + 12 t >= (w - 11.81) &&
     -4 p + 34 t >= (x - 228.92) &&
     -3 p + 133 t == (y - 163.28) &&
     6 p - 92 t >= (z - 128.69),
    p >= 0 &&
     t >= 0},
   {p, t}]],
 {w, 6, 16}, {x, 170, 200}, {y, 150, 300}, {z, 50, 200}]
$\endgroup$
2
$\begingroup$

enter image description here

Notice no change when moving the w and x sliders. May be you need to change the range for them as needed for your problem.

code

ClearAll[p, t];
Manipulate[
 NMaximize[{
   (*Objective function*)-6 p + 92 t,
   (*Constraints*)-0.3 p + 12 t >= (w - 11.81) && -4 p + 
      34 t >= (x - 228.92) && -3 p + 133 t == (y - 163.28) && 
    6 p - 92 t >= (z - 128.69), p >= 0 && t >= 0}, {p, t}
  ]
 ,
 {{w, 6, "w"}, 0, 10, 1, Appearance -> "Labeled"},
 {{x, 120, "x"}, 100, 170, 1, Appearance -> "Labeled"},
 {{y, 150, "y"}, 100, 300, 1, Appearance -> "Labeled"},
 {{z, 50, "z"}, 1, 200, 1, Appearance -> "Labeled"},

 TrackedSymbols :> {w, x, y, z}]
| improve this answer | |
$\endgroup$
  • $\begingroup$ Nasser, this answer might be improved by informing the asker where they went wrong? Very nice otherwise! $\endgroup$ – CA Trevillian Jun 8 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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