Maxima with equality constraints

273 Views Asked by At

I am trying to create an algorithm that finds the global maximum to a function with (in)equality constraints numerically. However, I am trying to fit that into a webpage (for example, via javascript.

So there are 2 things I can try:

  1. Try to include a CAS with javascript/php/etc. (this is a non-Math.SE thing)
  2. Write such an algorithm myself.

I know quite a bit about my function (which is 22-dimensional), I have the exact term which depends on several additional parameters that can be replaced by actual values before evaluating. The function itself is just a product of fractions of terms that are linear in every variable, for example $$\frac{a+b}{c-d+p_1}\cdot\frac{e+f\;p_2}{g}\cdot\frac{p_3}{h}$$ ($a,\cdots,g$ are variables, $p_1,p_2,p_3$ are constants) And the function does not have singularities in the allowed boundaries.

My equality constraints are just of the form $a+b+c+d+e=9$ and $a\ge0, \;b\ge0,\;...$

Mathematica can find the extremas to any given precision within very short times, however it cannot find a general form in dependency of all constants.

Calculating the gradient of my function is not a problem either, solving the 26-dimensional non-linear equation system is however. Therefore, I guess the approach via laplacian coefficients is non-viable. The function appears to be neither concave nor convex, as many solving methods rely on this information, I am kinda stuck here.

On top of that, I am actually only searching for integer solutions (I am happy with real-valued solutions anyways, several tests show that the solutions tended to be nearly integer-valued anyways), however I calculated that there is a total of 57314457200 ways to fill in the variables while fulfilling the constraints (brute-forcing falls out here) and I do not know much about mixed-integer optimization.

So my main questions are:

  • Are there any algorithms that efficiently and easily solve this problem?
  • How does one handle the fact that there are 22 inequality constraints, which have to be turned on and off in turn, resulting in a total of $2^{22}=4194304$ problems that have to be solved?

I am happy with partial solutions and keywords. I am sure that there is such a solution, (as Mathematica reliably calculates the optimums) however I would be glad not to be forced to write/include a full CAS for this.

Thank you very much.