how to execute optimization of a function which runs a simulink model?

조회 수: 1 (최근 30일)
Matteo Dentis
Matteo Dentis 2017년 12월 15일
댓글: Matteo Dentis 2017년 12월 18일
My problem is to find an optimal value o a matrix "K" 1x16 which maximize the output of 12 simulation of a simulink model. I have a simulink model which produce a certain set of output. The same simulink model is running 12 times and I have to evaluate the minimum output over the 12 simulation runs. Then, I wrote a function that when it is called with input argument "K" it returns the minimum output (a scalar) over the 12 simulation runs of the simulink model. Eventually, I would like to maximize such output by changing the value of "K". Note that the 12 simulation runs launched by the funcion I wrote have the same parameter K.
I tried to use the basic call of "ga", i.e. [K, val] = ga(@myfun, 16) since there are basically 16 parameters (since K is a matrix 1x16) and myfun is the function which launch the 12 simulation runs with the input K. The function returns the oputput while the minimum output of the 12 simulations is found. Using this formulation, I found that the result is always the same, and I know that it is not the optimal.
I used the same method by using fminimax instead of ga, and the result was the same. I tried with different K0 a initial value for K but nothing changed.
Am I doing it wrong? In general, is it possible to solve an optimization problem in which the fitness function is not analytical but it is related to a simulink model (even if the function which launch the simulation of the simulink it is formally a matlab function)?
Thank you all!
Matteo
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 12월 15일
"In general, is it possible to solve an optimization problem in which the fitness function is not analytical but it is related to a simulink model"
Yes.
The general process you describe is acceptable.
It sounds as if you might have problems either in myfun or in the function that returns the minimum output of the 12 runs of myfun.
Matteo Dentis
Matteo Dentis 2017년 12월 18일
Thank you for the clarification Walter!
I'm rather satisfied by the fact that I'm following an acceptable process in trying to solve my problem.
You may be right about the fact that the problem can be inside myfun: it was returning the value "Inf" if some output of the simulink is out of certain limits, this was set by myself.
However, removing such limits, nothing changed: after a number of iterations, the process is successfully stopped (with fminimax), but the solution didn't chage.
In addition, in using fminimax, I set the intial value of K and I know that there is a better value of K (but not sure that is the optimal one) in a neighborhood of +/-40% of the initial K (I found such value with a random technique). I'm surprised that setting such initial value, the algorithms, neither fminimax nor ga, found a little different solution iteration after iteration.
Anyway, I will check again "myfun"... Thank you again!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by