Given a positive integer $d$ and some $0 < t < 1$ I would like to find a global minimum1 for $$ \sum_{k = 1}^n d^2 \tan\left(\frac{\pi}{2} \, x_k\right) + 8 d $$ over $n \in \Bbb{Z}_{> 0}$ and $x_1,\dotsc,x_n \in [a,b]$ for some fixed $0 < a < b < 1$, subject to the constraint $$ 1 - \prod_{k = 1}^n (1-x_k) \geq t. $$ At this point I should probably mention that in my studies I had very little experience with numerical optimization, and that I am very new to Mathematica — I learned it while toying with this problem.
This is the code I have so far
a = Rationalize[0.1];
b = Rationalize[0.95];
(* Target function *)
fFactory[n_, d_] := Sum[d^2 * Tan[x[i] * Pi/2] + 8*d, {i, n}];
(* Constraints *)
gFactory[n_] := 1 - Product[(1 - x[i]), {i, n}];
cFactory[n_, t_] := Join[{g >= t}, Table[a <= x[i] <= b, {i, n}]];
vFactory[n_] := Array[x, n];
min[n_, d_, t_] := NMinimize[{fFactory[n, d], cFactory[n, t]}, vFactory[n]];
and it does seem to work. For example min[3, 1, 0.85]
results in
{27.0299, {x[1] -> 0.612702, x[2] -> 0.612702, x[3] -> 0.1}}
However this isn't actually a global minimum. For example
gRoot[n_, t_] := 1 - Surd[1 - t, n];
expectedMin[n_, d_, t_] := n*genF[1, d] /. x[1] -> gRoot[n, t];
allows us to compute the value of the target function for
$$ x_1 = \dotsb = x_n = 1 - \sqrt[n]{1-t} $$
and expectedMin[3, 1, 0.85]
gives 26.7184
. I tried changing the Method
option of NMinimize
(as detailed in the documentation), but all of "NelderMead"
, "DifferentialEvolution"
, "SimulatedAnnealing"
, and "RandomSearch"
gave the same result.
Is there a way to tweak the options of NMinimize
, or another function altogether, that would allow me to get a better result?
[1] You can find more background on this problem from the related questions on Mathematics.SE and Arqade.
Note: I would actually like an exact solution, but from the documentation it seems that the algorithms used by Minimize
don't work for this problem. Therefore I'd welcome some pointers on how to solve this problem using the Lagrange multipliers or the Karush–Kuhn–Tucker conditions.
x[i]
undistinguished? They are probably all equal ... $\endgroup$