in GA ... How can I define my problem constants once ? and how can I know the final values of the other variables (not the objective function)
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hello, I am using GA, with some integer variables and nonlinear constrains, I stated all the work in the same .m file (the output function, the nonlinear constrains function, and the fitness function) I found that I have to repeat the definition of my problem constants three times (one inside each function loop), which make my code so long, 1- How can I set/define my problem variables only once for all functions ? 2- After the optimization stop, can I know the values of all variables in the workspace as it the case of the usual MATLAB runs ? 3- How can I display/plot the final values of the variables which are neither the objective function nor from nvars ? thanks in advance, Mamdouh
Answers (1)
Alan Weiss
on 22 Jan 2014
0 votes
If you use nested functions you can share the parameters among the objective, constraint, and output functions. Your main function should have exta outputs that give the values you are interested in, such as the values of all the variables in the workspace and anything else you like.
Alan Weiss
MATLAB mathematical toolbox documentation
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!