simulation based optimisation with ga solver

Hi,
I am new in optimisation and struggling a bit. I want to optimise an objective function with decision variables p(1), p(2), p(3) etc that are binary. The problem is that if p(1) is 1 for example then the objective function is calculated through a simulation where different files are called. So for different values of decision variables the objective function is calculated differently through if constraints. I am trying to use ga solver but I cannot state the if constraints for the calculation of the objective function and call the files. Do you have any idea how this could work?
Thanks very much in advance Nicky

 Respuesta aceptada

Alan Weiss
Alan Weiss el 12 de Mayo de 2017
Write an objective function that calls whatever you like, such as:
function y = objfun(p)
if p(1) = 1
y = fun1(p);
elseif p(2) = 1
y = fun2(p);
% etc.
Here I assume that you have function files fun1.m, fun2.m, etc.
Alan Weiss
MATLAB mathematical toolbox documentation

1 comentario

Nicky Trivyza
Nicky Trivyza el 12 de Mayo de 2017
Thank you very much for your fast response. I will try it. Thanks,
Nicky

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 11 de Mayo de 2017

Comentada:

el 12 de Mayo de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by