If I try to minimize with constraints a function of several variables, with Gamma regularized function involved in the constraints it seems to works, as shown below (this is just a dummy example problem to try), where S, A , β and m
are constants previously declared and assigned a value:
Minimize[-Log[v] - Log[y] - Log[z],
Gamma[m, S*A*400^β*m*v^(1/m)]/Gamma[m] +
Gamma[m, S*A*400^β*m*z^(1/m)]/Gamma[m] +
Gamma[m, S*A*400^β*m*y^(1/m)]/Gamma[m] <= 1 && v <= 0.1 &&
v >= 0.001 && z <= 0.1 && z >= 0.001 && y <= 0.1 && y >= 0.001, {v,
y, z}]
{6.90776, {v -> 0.1, y -> 0.1, z -> 0.1}}
Now, since I need later to solve a problem with hundreds of variables, I try the same problem with an array of variables, but it does not work:
Minimize[{\!\(
\*UnderoverscriptBox[\(∑\), \(i = 1\), \(3\)]\(-Log[h[i]]\)\),
Join[{\!\(
\*UnderoverscriptBox[\(∑\), \(i = 1\), \(3\)]\(GammaRegularized[
1, S*A*
\*SuperscriptBox[\(400\), \(β\)]*m*h[i]]\)\) <=
1}, {Table[h[i] <= 0.1, {i, 3}] /.
List -> And} , {Table[h[i] >= 0.001, {i, 3}] /.
List -> And}] /. List -> And}, Table[h[i], {i, 3}]]
Minimize[{-Log[h[1]] - Log[h[2]] - Log[h[3]],
E^(-123.319 h[1.]) + E^(-123.319 h[2.]) + E^(-123.319 h[3.]) <= 1 &&
h[1] <= 0.1 && h[2] <= 0.1 && h[3] <= 0.1 && h[1] >= 0.001 &&
h[2] >= 0.001 && h[3] >= 0.001}, {h[1], h[2], h[3]}]
After trying several options, it seems that if I rewrite the problem using only variables h[i], instead of the expression in the argument to the GammarRegularized
function it works again (see below):
Minimize[{\!\(
\*UnderoverscriptBox[\(∑\), \(i = 1\), \(3\)]\(-Log[
\*FractionBox[\(h[i]\), \(S*A*
\*SuperscriptBox[\(400\), \(β\)]*m\)]]\)\), Join[{\!\(
\*UnderoverscriptBox[\(∑\), \(i = 1\), \(3\)]\(GammaRegularized[
1, h[i]]\)\) <=
1}, {Table[h[i] <= S*A*400^β*m*0.1, {i, 3}] /.
List -> And} , {Table[
h[i] >= S*A*400^β*m*0.001, {i, 3}] /. List -> And}] /.
List -> And}, Table[h[i], {i, 3}]]
{6.90776, {h[1] -> 12.3319, h[2] -> 12.3319, h[3] -> 12.3319}}
Why is it that I cannot use a expression as argument? I would need to pass expressions in my real problem as argument.
S
,A
,\[Beta]
andm
are you using? $\endgroup$(*Parameters*) S = 10^-9.2 cl = 3*10^8 f = 5.9*10^9 w = cl/f A = (4*\[Pi]/w)^(2/1) \[Beta] = 2.5 m = 1
$\endgroup$