Message Boards Message Boards

0
|
8055 Views
|
16 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to derive the global optimal value from several subset values?

Posted 11 years ago
Hi, everybody, I would like to ask you guys a little question. I have three maximization problems, they are Q1, Q2 and Q3, respectively, as you can see below:
Clear["`*"];
d2 = a - b*p2;Q1 = Maximize[{(p2*(a - b*p2) - (w2*(a - b*p2) - (v2*((a - b*p2))^2)/       2)), p2 >= a/b - (w2 - c)/(b*v2) && c < w2 < (a - b*c)*v2 + c &&     a/b > p2 > w2 > 0 && 2/b > v2 > 0}, {p2}]Q2 = Maximize[{(p2*d2 - (w2*d2 - (v2*(d2)^2)/2)),    p2 >= a/b - (w2 - c)/(b*v2) && (a - b*c)*v2 + c <= w2 < a/b &&     2/b > v2 > 0 && a/b > p2 > w2 > 0}, {p2}]Q3 = Maximize[{(p2*      d2 - (((w2)^2 - c^2)/(2*v2) + c*(d2 - (w2 - c)/v2))),    p2 <= a/b - (w2 - c)/(b*v2) && 0 < c < w2 < (a - b*c)*v2 + c &&     2/b > v2 > 0 && a/b > p2 > w2 > 0}, {p2}]
For Q1, I want to find the optimal p2 to maximize the first expression, i.e., p2*(a - b*p2) - (w2*(a - b*p2) - (v2*((a - b*p2))^2)/ 2)) , the same for Q2 and Q3.  In fact, it is easy to get the results for them respectively. However, my final purpose is going to find the global optimality, which means I have to compare the first expressions of the three problems. Therefore, I tried to use command Max[Q1, Q2, Q3], the result is odd. So there are two important questions: Firstly, how to pick up the optimal value of the first expressions from Q1, Q2 and Q3; secondly, which comand can be used to solve this problem of comparison since "Max" doesn't work at all. Thank you very much in advance. 
POSTED BY: Shaoyan Robert
16 Replies
Posted 11 years ago
Thank you, Frank, I will try.
POSTED BY: Shaoyan Robert
As to the integer variables, I wasn't suggesting that you convert your real variables to integer variables.
I suggest you add integer (actually binary) variables to the problem to convert it to a form that Maximize can handle.
The binary variables would handle the 3 different cases.
POSTED BY: Frank Kampas
The function Maximize has the pattern Maximize[ {obj, cons}, vars ].  I  think what you are trying to do is
Maximize[ {Max[ {obj1, cons1}, {obj2, cons2}, {obj3, cons3}], vars], which doesn't match the pattern.
That's why I suggested reformulating the problem with Integer variables. 
This sort of approach is quite common in optimization.  There is a whole book
of "tricks" in optimization "Model Buildng in Mathematical Programming" by H. Paul Williams, which describes
approaches of this sort.
POSTED BY: Frank Kampas
Perhaps you should add integer variables to put the 3 different cases into one calculation.
i1 = 1, i2 = 0, i3 = 0 for M1, etc.
POSTED BY: Frank Kampas
Posted 11 years ago
I don't think that's the main problem. Furthermore, I cann't add your constraint to my model, because they could be decimal numbers.  Frank, as an expert of mathematica, could  you give me any other suggestion? Thank you!
POSTED BY: Shaoyan Robert
Posted 11 years ago
Actually, I want to solve the following question:
 Clear["`*"];
 
 a = 10; b = 2; c = 3; k = 2; \[Phi] = 0.8; v2 = 0.6; \[Rho] = 0.2; Z \
 
 = 11; d2 = a - b*p2;
 
 M1 = Maximize[{(p2*d2 - (w2*d2 - (v2*(d2)^2)/2)) - \[Phi]*
 
      Max[(w2*d2 - (v2*(d2)^2)/2 -

        c*d2 - (p2*d2 - (w2*d2 - (v2*(d2)^2)/2))), 0] - \[Rho]*k*

     Max[(Z - (p2*d2 - (w2*d2 - (v2*(d2)^2)/2))), 0],

   p2 > w2 > c > 0 && c < w2 < (a*v2 + c)/(1 + b*v2),

   a/b > p2 >= a/b - (w2 - c)/(b*v2)}, {p2}]

M2 = Maximize[{(p2*d2 - (w2*d2 - (v2*(d2)^2)/2)) - \[Phi]*

     Max[(w2*d2 - (v2*(d2)^2)/2 -

        c*d2 - (p2*d2 - (w2*d2 - (v2*(d2)^2)/2))), 0] - \[Rho]*k*

     Max[(Z - (p2*d2 - (w2*d2 - (v2*(d2)^2)/2))), 0],

   p2 > w2 > c > 0 && (a*v2 + c)/(1 + b*v2) <= w2 < a/b &&

    a/b > p2 >= a/b - (w2 - c)/(b*v2) &&

    a/b - (w2 - c)/(b*v2) <= w2}, {p2}]

M3 = Maximize[{(p2*

       d2 - (((w2)^2 - c^2)/(2*v2) + c*(d2 - (w2 - c)/v2))) - \[Phi]*

     Max[((((w2)^2 - c^2)/(2*v2) + c*(d2 - (w2 - c)/v2)) -

        c*d2 - (p2*

           d2 - (((w2)^2 - c^2)/(2*v2) + c*(d2 - (w2 - c)/v2)))),

      0] - \[Rho]*k*

     Max[(Z - (p2*

           d2 - (((w2)^2 - c^2)/(2*v2) + c*(d2 - (w2 - c)/v2)))), 0],

   p2 <= a/b - (w2 - c)/(b*v2) && c < w2 < (a*v2 + c)/(1 + b*v2) &&

    a/b > p2 > w2 && p2 > w2 > c > 0}, {p2}]
Why  doesn't it work?
POSTED BY: Shaoyan Robert
Are you conditions all consistent?
Reduce[p2 >= a/b - (-c + w2)/(b v2) && c + (a - b c) v2 <= w2 < a/b &&
   a/b > p2 > w2 > 0 && 2/b > v2 > 0 && b > 0 &&
  p2 >= a/b - (-c + w2)/(b v2) && c < w2 < c + (a - b c) v2 &&
  a/b > p2 > w2 > 0 && 2/b > v2 > 0 && b > 0 &&
  p2 <= a/b - (-c + w2)/(b v2) && 0 < c < w2 < c + (a - b c) v2 &&
  a/b > p2 > w2 > 0 && 2/b > v2 > 0 && b > 0]
Returns False
POSTED BY: Frank Kampas
Posted 11 years ago
Thank you for your patience, Frank. You helped me a lot. In order to answer your question clearly, I uploaed several images to explain it, because it is not very convenient to type mathematical expressions here. I am looking forward to your reply. Thank you.








POSTED BY: Shaoyan Robert
Posted 11 years ago
Thank you, Frank. It sounds reasonable. Ok, may be it is too difficult to solve this problem, so I want to make it simpler and try to solve it with your method. 
 Clear["`*"];
 a = 10; b = 1; c = 1; v2 = 2; d2 = a - b*p2;
 Q1 = Maximize[{(p2*(a - b*p2) - (w2*(a - b*p2) - (v2*((a - b*p2))^2)/
         2)), p2 >= a/b - (w2 - c)/(b*v2) &&
      c < w2 < (a - b*c)*v2 + c && a/b > p2 > w2 > 0 &&
      2/b > v2 > 0}, {p2}];
 Q2 = Maximize[{(p2*d2 - (w2*d2 - (v2*(d2)^2)/2)),
     p2 >= a/b - (w2 - c)/(b*v2) && (a - b*c)*v2 + c <= w2 < a/b &&
      a/b > p2 > w2 > 0 && 2/b > v2 > 0}, {p2}];
Q3 = Maximize[{(p2*
       d2 - (((w2)^2 - c^2)/(2*v2) + c*(d2 - (w2 - c)/v2))),
    p2 <= a/b - (w2 - c)/(b*v2) && 0 < c < w2 < (a - b*c)*v2 + c &&
     a/b > p2 > w2 > 0 && 2/b > v2 > 0}, {p2}];
Maximize[{Max[Q1, Q2, Q3]}, {p2}]
The result is:
Maximize[{Max[
   Maximize[{(10 - p2)^2 + (10 - p2) p2 - (10 - p2) w2, False}, {p2}],
    Maximize[{-10 + p2 + (10 - p2) p2 + 1/2 (-1 + w2) +
      1/4 (1 - w2^2), False}, {p2}]]}, {p2}]
POSTED BY: Shaoyan Robert
2/b can't be greater than v2 since they are both equal to 2. That's where the False values are coming from.
POSTED BY: Frank Kampas
Posted 11 years ago
Thank you, Frank. You are right, so I changed the value of v2, i.e., a = 10; b = 1; c = 2; v2 = 1; d2 = a - b*p2;
 Clear["`*"];
 
 a = 10; b = 1; c = 2; v2 = 1; d2 = a - b*p2;
 
 Q1 = Maximize[{(p2*(a - b*p2) - (w2*(a - b*p2) - (v2*((a - b*p2))^2)/
 
         2)), p2 >= a/b - (w2 - c)/(b*v2) &&
 
      c < w2 < (a - b*c)*v2 + c && a/b > p2 > w2 > 0 && 2/b > v2 > 0 &&

      b > 0}, {p2}];

Q2 = Maximize[{(p2*d2 - (w2*d2 - (v2*(d2)^2)/2)),

    p2 >= a/b - (w2 - c)/(b*v2) && (a - b*c)*v2 + c <= w2 < a/b &&

     a/b > p2 > w2 > 0 && 2/b > v2 > 0 && b > 0}, {p2}];

Q3 = Maximize[{(p2*

       d2 - (((w2)^2 - c^2)/(2*v2) + c*(d2 - (w2 - c)/v2))),

    p2 <= a/b - (w2 - c)/(b*v2) && 0 < c < w2 < (a - b*c)*v2 + c &&

     a/b > p2 > w2 > 0 && 2/b > v2 > 0 && b > 0}, {p2}];

Maximize[Max[{Q1, Q2, Q3}], p2]
the result shows that the command 'Max' didn't find out the global optimal value from the three local optimal values. It just list the results of the three progamming problems. Of course, there is a problem with Q2 this time. I find it is diffulct to find out a group of values for a , b, and other parameters to satisfy all three problems.
POSTED BY: Shaoyan Robert
Max can take expression inside of Maximize.
Maximize[ { Max[ x, y ], 0 <= x <= 3, -2 <= y <= 5 }, { x, y} ] returns {5, { x -> 3, y -> 5} } 
POSTED BY: Frank Kampas
Try Maximize[Max[Q1, Q2, Q3], vars] for the vars in Q1, Q2, Q3. 
POSTED BY: Frank Kampas
Posted 11 years ago
Thank you for your reply, Frank, but it seems that it doesn't work.
POSTED BY: Shaoyan Robert
Posted 11 years ago
I think the main reason is that the command "Max" only works for numerial value instead of expressions which contains parameters. Anyway, thank you, Frank. Any other guys can give me some good suggestion?  thank you!
POSTED BY: Shaoyan Robert
Posted 11 years ago
I think there are many talented people who are good at using mathematica in this forum. Please help me to solve this problem, thank you very much!
POSTED BY: Shaoyan Robert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract