# Optimization of a blackbox function with an equality constraint?

I believe this would be an interesting problem.

I have a blackbox function which can take 2-60 input variables $(X_1,X_2,...X_n)$ which are to be optimized. I'm calling this objective function as a blackbox function because it's parameters consists of the input variables $(X_1,X_2,...X_n)$ and variables from a simulation output $(Y_1,Y_2,...Y_n)$.These simulation output variables $(Y_1,Y_2,...Y_n)$ takes the input variables $(X_1,X_2,...X_n)$ as inputs for their simulation. Each variable in $(Y_1,Y_2,...Y_n)$ can be represented as a function of all $X_i$'s.

i.e. $Y_i = N(X_1,X_2,...X_n)$. Where N represents a network being simulated.
Both $Xi$'s and $Yi$'s have variable bounds.

My optimization problem can be formulated as :

Objective:

Minimize $\sum_{i=0}^n (A_iX_i+B_iX_iY_i)$

Constraints:

1. $\sum_{i=0}^n X_i =Const$
2. $X_{imin}<=X_i<=X_{imax}$
3. $0<=Y_i<=Y_{imax}$
4. $0<=X_iY_i<=(X_iY_i)_{max}$

$A_i$'s and $B_i$'s are constants.

Further information:

1. Each simulation might takes 3-20 sec depending of the complexity of the network and number of input variables $(X_i)$

2. The objective function is nonlinear for sure but other characteristics are unknown (Uni-modal or multi-modal, smooth or non-smooth, convex or non convex, noisy or non-noisy)

3. One good news is that I have an initial feasible point $X0=(X_1,X_2...X_n)$

1. We can also treat the $X_i$'s as integers. This also means that the constant on the equality constraint $(X_1+X_2+...X_n=Const)$ can also be treated as an integer by rounding the decimal to the nearest integer.(I don't know if it helps). Whereas $A_i$'s and $B_i$'s are positive real numbers.

My need:

1.Choice of optimization algorithm?

2.A suitable open source solver in python that has strong computational power.

So far what I've come across:

1. With my search for a solution to my needs, I have most often come across SURROGATE MODELLING, BAYESIAN APPROACH; Derivative FREE METHODS, EVOLUTION ALGORITHMS

2. Solvers for Surrogate Modelling PYSOT; RBFOpt from COIN-OR ;

3. Solvers for Bayesian approach BayesOpt,hyperopt;GPyOpt; fmfn
4. Solvers for Derivative free blackbox optimization methods yabox

Most of the above methods don't accept equality constraints which is my main concern.

My question:

My question is basically to satisfy my needs.

1. Is there a suitable algorithm to solve my problem? If yes, suggest some free python solvers.

Also welcome:

Any new ideas or suggestions to solve such a problem are also welcome. Various suggestions on how I could tailor my problem to place it in a suitable class of problems and then applying a suitable solver are also welcome.

I really appreciate your time. Thanks :-)

• A tip: You can use MathJax to typeset your mathematical formulas. This will make the question much easier to read. (Believe in me with mathJax is more easy to read, and all the math this question can be write with it). Small note I think that the example is not $i=2$, but is $n=2$ (try to check). – Mauro Vanzetto Feb 22 '18 at 11:12
• Scipy.optimize admit equality constraints using the SLSQP solver. – nicoguaro Feb 22 '18 at 11:27
• @MauroVanzetto I took your advice and have used mathjax and it looks better. Thanks ;-) – Janson 7 Feb 22 '18 at 15:25
• @nicoguaro but does my problem fall into it's class? If so how? I'm asking because as much as I've read in stackexchange, not many have recommended scipy to a similar problem – Janson 7 Feb 22 '18 at 15:28
• The how, you can check the documentation. It might be not the best option, but I can't say if it suits your needs or not. If you can formulate your problem as a convex problem, maybe you can check cvxpy. – nicoguaro Feb 22 '18 at 15:37

Isn't an equality constraint $$Ax=b$$ equivalent to writing 2 inequality constraints $$Ax\leq b$$ and $$Ax \geq b$$? And as I know, GPyOpt supports arbitrary inequality constraints.