Group Abstract Group Abstract

Message Boards Message Boards

Solve the following non-linear integer max-problem with NMaximize?

Hi! I have tried to solve the following non-linear integer max-problem, without setting some lower (positive) bounds on Q1, Q2 & Q3, just being positive. Mathematica fails to find the optimal solotion, unless I increase the lower bounds for Q2 & Q3 to about 40. I have solved the same problem in LINGO and found the global solution {P -> 60., Q1 -> 0, Q2 -> 52., Q3 -> 60., y1 -> 0, y2 -> 1, y3 -> 1, \z1 -> 0, z2 -> 0, z3 -> 1} in less than a second. Any suggestions?

NMaximize[{(Q1 + Q2 + Q3) (P - 20) + 3*0.5 (80 - P) Q1*z1 + 
   2*0.5 (100 - 0.8 P) Q2*z2 + 2*0.5 (90 - 0.5 P) Q3*z3, 
  z1 + z2 + z3 == 1 && Q1 == (80 - P) y1 && Q2 == (100 - 0.8 P) y2 && 
   Q3 == (90 - 0.5 P) y3 && 2 <= y1 + y2 + y3 <= 3 && 
   3 <= y1 + y2 + y3 + z1 + z2 + z3 <= 4 && 
   2 <= y1 + y2 + y3 + z1 <= 3 && 2 <= y1 + y2 + y3 + z2 <= 3 && 
   2 <= y1 + y2 + y3 + z3 <= 3 && Q1 >= 0 && Q2 >= 0 && Q3 >= 0 && 
   1 >= y1 >= 0 && 1 >= y2 >= 0 && 1 >= y3 >= 0 && z1 >= 0 && 
   z2 >= 0 && z3 >= 0 && 80 > P > 20 && y1 \[Element] Integers && 
   y2 \[Element] Integers && y3 \[Element] Integers && 
   z1 \[Element] Integers && z2 \[Element] Integers && 
   z3 \[Element] Integers}, {P, Q1, Q2, Q3, y1, y2, y3, z1, z2, z3}]
Attachments:
8 Replies

It's probably a good idea to always try several different methods.

POSTED BY: Frank Kampas

I've found that using Simulated Annealing for NMinimize and NMaximize often works better than the default Nelder Mead method.

POSTED BY: Frank Kampas

Hi Frank! I have tried "Simulated Annealing" with many different options according to tutorial, but I did not get the correct one! On the other hand, the "Differential Evolution" suggested by Mariusz above works fine (but still a little bit slower than LINGO).

POSTED BY: Neil Singer

Hello

NMaximize with standard options Fail yes is True .From this tutorial a get answer what LINGO gave you.

Other helpful things.

Ordinary user,Regards MI.

Attachments:
POSTED BY: Mariusz Iwaniuk

Thanks very much Mariusz! It was as I expected. However, I am surprised one should need to select the method for NMaximize for such a relatively "easy" problem and the solution provided by Mathematica was very bad indeed. For LINGO, I did not need to select their methods, it found it very fast!

Hi! I followed the standard code by Mathematica. I have solved more than thousand problems with NMaximize, without any problem before. I do not think there is a problem with the code (which is attached). My question is why I need to tighten the lower bounds in Q2>=40 & Q3>=40 in order to get a solution, (as you can see in the file), while in LINGO such a strengthening is not required. I have the feeling that Mathematica is fast around the zero values in Q2, Q3, and does not search for the global solution.

Attachments:
POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard