Derivative-free, Simulation-based Optimization I am working on derivative-free simulation-based optimization problems. I evaluate the objective function based on a simulation model without having any information about derivatives. I set up the problem in Python and now I want to compare different methods ((Nelder–Mead etc.) from different packages (scipy, NLopt, etc.).
The model consits of the following components and it is imported into Python as a "black box model" with input/outputs: 


*

*A "simple heat unit" that heats up water based on a given set-point trajectory.

*A pipe that transport the water to a building.

*A simplified building model incl. a simplified heating system.


The optimization problemis an optimal control (dynamic optimization) problem. The setup:


*

*Optimization horizon is 12 hours (=$t_f$)

*The temperature in the building is a constraint (lower bound = $T_L$  and upper bound = $T_U$). This temperature depends on the water-temperature delivered by the pipe and therefore on the set-point trajectory at the "simple heat unit".

*I discretized the input trajectory for the "simple heat unit" on an hourly base. These variables (in total 12) are the optimization variables.


My objective is to minimize the temperature at the "simple heat unit" (=$T_{Unit}$). Furthermore, I penalize constraint violations (temperature in the building) by adding penalty terms:


*

*$penaltyL = max (0, T_L - T_{Building}(t))$

*$penaltyU = max (0, T_{Building} (t)- T_U)$

*$\sigma$ is the penalty coefficients


The objective function is:
$min \int_{0}^{t_f} T_{Unit} dt+ \sigma (penaltyL + penaltyU) $
My questions:


*

*Should the value of the objective function be in the magnitude of 1? Should i scale it (now the integral term is around $1.5e7$)?

*If i scale the integral term to around 1, how should i choose the penalty coefficients $\sigma$ for the first iteration (or better: in what magnitude should "$\sigma (penaltyL + penaltyU)$" be?

*How would you increase the penalty term in each iteration?


Thank you very much for your help.
 A: *

*It's probably not necessary. Often people do normalize objective functions, but I think it's usually more for aesthetics (e.g. $\frac{1}{n}\sum_i a_i$ rather than $ \sum_i a_i $) or interpretation than some particular reason (there are surely cases where this is untrue. One issue might be numerical stability or accuracy reasons, but unless you are in the realm where this is an issue, it's likely unnecessary (and may even slow you down, e.g. in some Bayesian optimizations it is specifically ignored).

*Scaling the integral term is more sensible. In fact, if you can scale both the $\int_0^{t_f} T_{\text{Unit}}(t)\,dt$ and the $L_{\text{penalty}} + U_{\text{penalty}}$ term to be near, say, $1$, then tuning $\sigma$ will be much easier! However, in terms of choosing $\sigma$ nobody can really tell you... that requires domain knowledge. It depends on how much constraint violation you are willing to tolerate (e.g. how cheap the heating company wants to be :) )

*By each iteration, I assume you mean in the course of optimization (not time $t$ in the simulation, in which case you could define $\sigma(t)$ as a function of time). This really depends on the programming language and libraries you are using. It may not be possible with some libraries. However, there are some which might return intermediate results that you could use to set a global variable that alters $\sigma$. Or, you could optimize many times, each time at an iteratively better start point (the output of the last run) but e.g. with a higher $\sigma$.
