MATLAB Answers

0

Constrained mixed integer optimization: genetic algorithm used with SimEvents. How can I set a simulation output as a constraint?

Asked by Valerio Contaldo on 27 Oct 2013
Latest activity Commented on by Valerio Contaldo on 1 Nov 2013
I'm using the genetic algorithm from the MATLAB Global Optimization Toolbox with SimEvents , in order to implement a mixed integer optimization making use of simulation outputs to evaluate the fitness function. My model is pretty similar to the one described in this video from MathWorks website:
Reading the documentation, I found that ga can solve constrained problems only if such constraints are linear inequalities. The constraints are supposed to be written as functions of the problem's variables, that in this case are the number of resources used during the simulation.
I would like, instead, to set a constraint that takes into account another simulation output (e.g. the drain utilization), i.e. minimize
objfun = backlog*10000 + cost
where backlog is a simulation output (obtained using simOut.get), considering the following constraint:
drain_utilization > 0.7
where drain_utilization is another simulation output (again, obtained using simOut.get).
Is it possible or this feature is not supported by the Global Optimization Toolbox? Thank you in advance and forgive me for any improper term, but I'm new to the Global Optimization Toolbox.

  0 Comments

Sign in to comment.

1 Answer

Answer by Teresa Hubscher-Younger on 28 Oct 2013

Hi Valerio,
If I understand your question, you are asking whether you can use more than one simulation output in an objective function of a genetic algorithm. The answer is yes. If you can log the data or save it in the simulation output, it should be in the MATLAB workspace and thus available to the non-linear constraint function for calculation.
If both the values for your objective function and your constraint function are coming from the same simulation, this example provides a reference for how to have the simulation run only 1 time for an evaluation of both the objective and constraint functions: http://www.mathworks.com/help/optim/ug/objective-and-nonlinear-constraints-in-the-same-function.html
Let me know if you need further help, Teresa

  1 Comment

Hi Teresa,
Thank you very much for the quick answer! Making use of nested functions should allow me to run the simulation 1 time only and to evaluate both the objective and constraint function.
The point is that I still do not understand if I can use the simulation output ( e.g. drain utilization ) as a constraint. In fact, reading the documentation of ga, my problem should be
X = ga (obj, Nvars, A, b, [ ], [ ], lb, ub, INTCON)
where the variables (X) are the number of resources used during the simulation, and the inequality constraints are supposed to be written as:
A*X <= b
while I would like to set a constraint that makes an "indirect" use of X, since the value of the simulation output drain utilization is determined by the number of resources used during the simulation, but it can not be "analytically" obtained from X.
Here I attach an image with a part of my code, to let you better understand what I'm trying to do. I have not made use of nested functions, because I don't exactly know how and where I could use them, but I placed a comment where I guess it could be most likely the case.
Main function :
Objective function :
Thank you again!
Valerio

Sign in to comment.