I read about NelderMeadMinimize package. How can I set constraints on the parameters? For example I want to minimize an equation with $10$ parameters such as ${a_1, a_2, ....}$. I want to put the condition $a_1 > 0$. How can I do that?
EDIT 1:
As an example I have $10$ equations and $10$ unknown parameters which I want to find them by minimizing problem1:
problem1 = (-30 + A3/A1)^2 + (4 e3a α1 α3 + 2 d2 β1)^2
+ (-2 A3 - 2 c2 α3 + 4 c4a α3^3 + 8 e3a α1 β1)^2 + (4 e3a α1^2 + 2 d2 β3)^2
+ (-3.13995 - 2 c2 + 2 d2 + 12 c4a α1^2 - 4 e3a β3)^2
+ (-1.49499 - 2 c2 + 2 d2 + 4 c4a α1^2 + 4 e3a β3)^2
+ (-2.10157 - 4 c2 d2 + 24 c4a d2 α1^2 - 16 e3a^2 α3^2 - 8 d2 e3a β3)^2
+ (-0.0277073 - 4 c2 d2 + 8 c4a d2 α1^2 - 16 e3a^2 α3^2 + 8 d2 e3a β3)^2
+ (-2 A1 - 2 c2 α1 + 4 c4a α1^3 + 4 e3a α3 β1 + 4 e3a α1 β3)^2
+ (0.00429025 α1^2)/((β1 Sqrt[1 - (2 c2 + 2 d2 - 4 c4a α1^2 - 4 e3a β3)/Sqrt[ 64
e3a^2 α3^2 + (2 c2 + 2 d2 - 4 c4a α1^2 - 4 e3a β3)^2]])/(Sqrt[2] α1)
+ Sqrt[1 + (2 c2 + 2 d2 - 4 c4a α1^2 - 4 e3a β3)/Sqrt[64 e3a^2 α3^2
+ (2 c2 + 2 d2 - 4 c4a α1^2 - 4 e3a β3)^2]]/Sqrt[2])^2;
parameters1 = {c2, d2, e3a, c4a, α1, α3, β1, β3, A1, A3};
function1 = Function @@ {parameters1, problem1};
minimizer =
With[{nelderMead = NelderMeadMinimize`Dump`CompiledNelderMead[function1, parameters1],
bounds = {-1, 1}, dimension = Length[parameters1],
tolerance = Sqrt[$MachineEpsilon]},
Compile[{{dummy, _Integer, 0}},
nelderMead[RandomReal[bounds, {dimension + 1, dimension}], tolerance, -1],
CompilationOptions -> {"ExpressionOptimization" -> True,
"InlineCompiledFunctions" -> True},
RuntimeOptions -> {"CompareWithTolerance" -> False,
"EvaluateSymbolically" -> False},
RuntimeAttributes -> Listable(*"Parallelization"->True*),
CompilationTarget -> "C"]];
ans = {First[#], Thread[parameters1 -> Rest[#]]} & /@
Take[minimizer@Range[3000] // Sort, 10]
I know that $\alpha_1$, $\alpha_3$, $\beta_1$, $\beta_3$, $A_1$, and $A_3$ should be positive. How can I put these constraints on these parameters when applying NelderMead minimization? Is it possible?
EDIT 2
First one should download the package and also needs to run:
Needs["CCompilerDriver`"]