How to write fitness function in matlab.
Mostrar comentarios más antiguos
2 comentarios
KALYAN ACHARJYA
el 30 de Jun. de 2019
Proper elaboration and specific questions gets fast response.
Shivam Gupta
el 2 de Jul. de 2019
Respuestas (1)
Zhangxi Feng
el 1 de Jul. de 2019
0 votos
Please add some more information for your question so we can better help you.
A fittness function is just like any other function except it is expected to return a specific output that will be used by whatever function is calling the fittness function. Looks like you need to implement the function in the image you attached.
By the way, windows have a snipping tool that can easily capture screenshots without needing to use your camera.
Jesse
4 comentarios
Shivam Gupta
el 2 de Jul. de 2019
Zhangxi Feng
el 2 de Jul. de 2019
Editada: Zhangxi Feng
el 2 de Jul. de 2019
It sure is a very complicated problem. The fittness function is basically an error function. See how you need to minimize the primary objective? You just need to convert that minimize into some sort of error. For example, at what point do you consider this function minimized? Maybe if the values don't differ by more than 1e-5 after 10 generations?
The constraints that the objectives are subjected to actually makes your problem easier. I do not understand this particular model but I assume the constraints apply on the input parameters of the two objectives. Simply address this on the inputs.
I know it can be daunting at first because there is no clear template for writting a fittness function, but as I mentioned before, the function is like any other function except it is expected to return an error that genetic algorithm needs to evaluate the generation's population.
function err = myFittnessFunction(par, other inputs)
some_calculated_value = someFunction(par)
err = some_calculated_value - some_expected_value
end
Shivam Gupta
el 2 de Jul. de 2019
Zhangxi Feng
el 2 de Jul. de 2019
Although I have implemented a fittness function with genetic algorithm but I never used the GUI. I just straight up programmed it. I am not familiar with the GUI part of the GA or GAmultiobj. Nevertheless, you can first try to create a simple error function that returns anything and see the results for yourself as a start.
Categorías
Más información sobre Genetic Algorithm en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!