What is MultiStart's behaviour, if the objective function of a startpoint returns nan?

1 次查看(过去 30 天)
Hey all,
What is MultiStart's behaviour, if the objective function of a StartPoint returns nan?
Suppose I define problem and MultiStart objects for 20 StartPoints:
min_fun = @(x) obj_function(x, t, modelStuff, data);
fopts = optimoptions('fmincon');
ms = MultiStart('UseParallel', true, 'StartPointsToRun', 'bounds');
prob = createOptimProblem('fmincon', 'objective', min_fun, 'x0', x0, 'lb', lb, 'ub', ub, options=fopts);
[myFit.x, myFit.f_val, myFit.exitflag, myFit.outpt, myFit.allmins] = run(ms, prob, 20);
When I run MultiStart on a problem, which returns nan, Matlab returns the following console output:
Objective function returned NaN; trying a new point...
Unfortunately I can not find any detailed description of what that means, neither in the documentation of MultiStart, nor the code of it itself. Does that message mean MultiStart tries another StartPoint instead, or just skip the current one and move on to the next StartPoint? Is the total number StartPoints evaluated "to the end" of whatever stopping criteria still the amount specified? Or does this message mean, that a StartPoint less than specified (20) was evaluated?
Why:
I am trying to fit parameters of a model to experimental data via MultiStart, to use parallel computation. To fit my parameters, I simulate a model dependant upon the input paramters and with the experimental data calculate a cost function / objective function to be minimized.
Some parameter combinations can result in infeasible simulations, that are valid numerically or mathematically speaking, but do not make physical sense. Unfortunately I can not just bound these parameters in a specific way to stay out of infeasible result domains, because they do not result in infeasible regions by themselves, only specific combinations of multiple parameters and their interactions do.
One approach I took so far is a short function called by the objective function to check the feasibilty of the simulation. If the simulation is not feasible, the objective funtion just returns nan. Should I maybe return a very high "cost" in this case instead?

回答(1 个)

Karan Singh
Karan Singh 2023-8-23
When we have a NaN being returned in a MultiStart algorithm and MATLAB showing the error
Objective function returned NaN; trying a new point...
It means that “MultiStart” will discard the current starting point, thus moving on to the next point in the series. And it will end until it has evaluated all the starting points or if a stopping criterion is met.
The purpose of discarding a starting point that returns NaN is to ensure the reliability of the optimization process. NaN values in the objective function can occur due to various reasons, such as invalid inputs or numerical instability. By discarding such points and moving on to the next one, MultiStart aims to find a valid solution by exploring different regions of the search space.
As for your other questions:
  • Returning NaN from the objective function when a simulation is infeasible is one approach, but it may not provide the desired behaviour in terms of optimization.
  • Returning a very high "cost" or objective function value when a simulation is infeasible can be a better approach. This approach ensures that infeasible parameter combinations are penalized heavily during optimization, discouraging the algorithm from exploring those regions of the search space. However, it is important to choose an appropriate value for the high cost.
  • The exact value will depend on your specific problem and the scale of the objective function values. You want the high cost to be significantly larger than feasible values but not so large that it causes numerical issues or dominates the optimization process.
Additionally, we can have strategies to handle unfeasible simulations as
  1. Adjusting parameter bounds: If certain combinations of parameters lead to infeasible simulations, you can adjust the parameter bounds dynamically during the optimization process.
  2. Constraint handling: If there are specific constraints that define the feasibility of the simulations, you can incorporate them into the optimization problem formulation.
It may also be helpful to refer the MATLAB documentation. For more optimization strategies. Find multiple local minima - MATLAB (mathworks.com)

类别

Help CenterFile Exchange 中查找有关 Global or Multiple Starting Point Search 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by