Message Boards Message Boards

1
|
3509 Views
|
9 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Can Wolfram manage maximizing a function with five variables?

Posted 10 years ago
Hello guys
I am new to wolfram. I do not know if there is any solver which can maximize a function with five variables with different conditions on each variables?
If I attempt to use wolfram it says the word maximize is not recognizable whereas the same thing works with a function with lesser variables.

Thank you

ex:
maximize ((a^2b^2k(1-k))/cd) for a+b+c+d =12.78ab,0<a<0.039/(1-k),0<(1-k)(ab/d)<0.058,0<k<1,0.1<b<20,0.1<c<20,0.1<d<20
POSTED BY: saiteja damera
9 Replies
In[2]:= NMaximize[{a^2 b^2 k (1 - k)/(c*d),
  a + b + c + d == 12.78 a*b, 0 <= a*(1 - k) <= 0.039,
  0 <= (1 - k) (a*b) <= 0.058*d, 0 <= k <= 1, 0.1 <= b <= 20,
  0.1 <= c <= 20, 0.1 <= d <= 20}, {a, b, c, d, k}]

Out[2]= {1.05107, {a -> 0.123521, b -> 20., c -> 0.1, d -> 11.3485,
  k -> 0.733567}}
Daniel,
Using Version 9, I get the above result, using the default settings and an objective function value of 0.04+ for differential evolution.
Using prerelease 12 of Version 10, I get your result for differential evolution and 0.712 for the default settings.
POSTED BY: Frank Kampas
If I eliminate d using the equality constraint, I get
sln = NMaximize[{(a^2 b^2 (1 - k) k)/((-a - b + 12.78` a b - c) c),
   0 <= a (1 - k) <= 0.039`,
   0 <= a b (1 - k) <= 0.058` (-a - b + 12.78` a b - c), 0 <= k <= 1,
   0.1` <= b <= 20, 0.1` <= c <= 20,
   0.1` <= -a - b + 12.78` a b - c <= 20}, {a, b, c, k}]

{1.07611, {a -> 0.131768, b -> 20., c -> 0.1, k -> 0.704028}}
which implies d = 13.4482.
If I use MathOptimizer Professional on the original equations (changing the problem to minimization), I get a similar result
 In[1]:= Needs["MathOptimizerProLF`callLGO`"]
 
 In[6]:= callLGO[-((a^2 b^2 k (1 - k))/(
   c*d)), {a + b + c + d == 12.78*a*b, 0 <= a*(1 - k), 
   a*(1 - k) <= 0.039,
   0 <= (1 - k)*a*b, (1 - k)*a*b <= 0.058*d}, {{a, 0, 1}, {b, .1,
    20}, {c, .1, 20}, {d, .1, 20}, {k, 0, 1}}]
 
 Out[6]= {-1.07612, {a -> 0.131769, b -> 20., c -> 0.1, d -> 13.4483,
  k -> 0.704027},
"Maximal Constraint Violation" ->
  2.36*10^-9, "Function Evaluations -> 10354"}
POSTED BY: Frank Kampas
Yes, I see what you mean.  I changed cd to c*d but didn't enclose it.
POSTED BY: Frank Kampas
Daniel, this is a maximization problem.  Isn't larger better? (* I changed the sign of the objective function for MathOptimizer Professional since it minimizes. *)
POSTED BY: Frank Kampas
Frank, look at your denominator. You let a tenant move upstairs (I hope you increased its rent).

I know the objective function was ambiguous as first posted, but I think the intent was for my interpretation.
POSTED BY: Daniel Lichtblau
NMaximize [{a^2 b^2 k (1 - k)/(c*d),
  a + b + c + d == 12.78 a*b, 0 <= a*(1 - k) <= 0.039,
  0 <= (1 - k) (a*b) <= 0.058*d, 0 <= k <= 1, 0.1 <= b <= 20,
  0.1 <= c <= 20, 0.1 <= d <= 20}, {a, b, c, d, k},
Method -> {"DifferentialEvolution"}, MaxIterations -> 500]

(* Out[51]= {0.0386336193579, {a -> 1.02753592256, b -> 0.10124504214,
  c -> 0.1, d -> 0.100759552445, k -> 0.962636482851}} *)

It can be done with default settings (no options) but the result is not quite as good.
POSTED BY: Daniel Lichtblau
Thank you. I would try to use Mathematica
POSTED BY: saiteja damera
Are you using Mathematica or Wolfram|Alpha? Wolfram|Alpha has limits on the complexity of the input it'll handle. It probably won't do a computation this large.

If you are using Mathematica, try using Maximize or  NMaximize. If you're new to Mathematica, you can get an introduction to Mathematica with the Mathematica Virtual Book.
POSTED BY: Sean Clarke
 In[1]:= Needs["MathOptimizerProLF`callLGO`"]
 
 In[3]:= NMaximize [{a^2 b^2 k (1 - k)/c d, a + b + c + d == 12.78 a b,
    0 < a < 0.039/(1 - k), 0 < (1 - k) (a b/d) < 0.058, 0 < k < 1,
   0.1 < b < 20, 0.1 < c < 20, 0.1 < d < 20}, {a, b, c, d, k}]
 
 Out[3]= {369.729, {a -> 0.157502, b -> 20., c -> 0.1, d -> 20.,
   k -> 0.752381}}
 
In[2]:= callLGO [- a^2 b^2 k (1 - k)/c d, {a + b + c + d == 12.78 a b,
   a <= 0.039/(1 - k),
  0 <= (1 - k) (a b/d), (1 - k) (a b/d) <= 0.058}, {{a, 0, 0.39}, {b,
   0.1, 20}, {c, 0.1, 20}, {d, 0.1, 20}, {k, 0, 1}}]

Out[2]= {-369.726, {a -> 0.157502, b -> 20., c -> 0.1, d -> 20.,
  k -> 0.752384},
"Maximal Constraint Violation" ->
  8.9403*10^-9, "Function Evaluations -> 9266"}
POSTED BY: Frank Kampas
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