Setting bounds on objective/fitness functions during optimization

I am running a genetic algorithm multi-objective optimization with 2 objective functions. So far it has been working well in getting some results and the Pareto front. The problem is, however, that I am minimizing both fitness functions and would like to have results only below a certain value. For example, if one of the two objective functions is cost, I would like to limit my results to 0 < Cost < 100. So is it possible to set bounds on the objective function values? The only way I can think of doing this is to write the objective function as a non linear constraint of the form
Objective function - Threshold < 0
But I am not sure this works, and would like to know if there's a more straightforward way to bind the results.
Thank you! Ali

 Réponse acceptée

Nonlinear constraints are the solution. You can have two constraints, for example, for the example you cited:
function [c,ceq] = nonlcon(x)
... % Calculate Cost here
c(1) = 0 - Cost;
c(2) = Cost - 100;
ceq = [];
Alan Weiss
MATLAB mathematical toolbox documentation

2 commentaires

Just tried it and it worked very well!
Thank you Alan!
After some experimenting, I was able to correctly define and use the non-linear constraints, and set some bounds on the objective functions thanks to your help here.
I am currently facing the issue of using custom functions within the objective function, and I want to ask if that is possible.
I have two variables, x(1) and x(2) for which I want to minimize two objective functions on. One of the objective functions is the Cost, which is a simple linear function of the form
Cost = Price1*x(1)+Price2*x(2);
My second objective function, is a reliability parameter ranging from 0 to 1, where 0 means completely reliable or 0% failure and 1 means 100% failure. This reliability parameter is calculated in a custom function that I created which has the following form
[Parameter]=Parameter_finder(x(1),x(2),Power_Out,Load,Constant1,Constant2)
Where Power_Out and Load are 't x 1' vectors and Constant1&2 are just two constants, all of which are variables in my workspace.
The function runs an iterative simulation over 't' time steps representing a simulation over a year, and give Parameter as an output, which should be minimized.
Is it possible to have an objective function handle of the form
Obj = @(x)[Parameter_finder(x(1),x(2),Power_Out,Load,Constant1,Constant2)]
or something similar? I have not been able to find any document/discussion addressing custom functions or .m files as objective functions or constraints. The only alternative I thought of was performing a surface fit to find Parameter=f(x(1),x(2)) and isolate the other variables, and use the obtained fit as an objective function. However that takes way more time and is not as accurate as the iterative simulation.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by