Optimizing two models here, each model having its own set of parameters and an objective, but both models run on the same data which is difficult to compute, and which is computed based on both models' params. How can one optimize the models simultaneously both models relative to their respective objectives?
Here's what I've done so far:
ObjectiveFunction( model1, model2, data ): simulationResult = VeryExpensiveCall( model1, model2, data ) score1 = ComputeScore( model1, simulationResult ) score2 = ComputeScore( model2, simulationResult ) return score1 + score2 RunOptimization: genericOptimizer.SetMethod( "CRS2" ) genericOptimizer.SetMinObjective( ObjectiveFunction ) genericOptimizer.Optimize()
There is a problem with this solution of adding the individual scores to produce a combined one: the
genericOptimizer can get confused what parameter change affected a score and proceed in the wrong direction.
For example, supposed that between consecutive iterations
model2.param have changed, causing
score1 to decrease but
score2 to increase. The optimizer has no way of knowing that the change in
model1 was beneficial and in
model2 wasn't. It would seem that an optimizer that's aware of the model being a Cartesian product of two models should improve performance.
Thus the question: how can one take advantage of the Cartesian nature of the model and optimize for each objective?