GA calculates wrong penalty
3 次查看(过去 30 天)
显示 更早的评论
I have a GA problem with the optimization file Lowest. I set the initial population using a set of parameters X:
optim.options.InitialPopulationMatrix = X;
I check the result:
Lowest(X,[5 15], 1)
or indeed
Lowest(optim.options.InitialPopulationMatrix,[5 15], 1)
both yield
ans = 0.16.
I now define and run the following:
fopt = @(x)Lowest(x,[5 15],1);
[x,fval]=ga(fopt,optim.nvars,optim.Aineq,optim.bineq,[],[],optim.lb,optim.ub,[],optim.intcon,optim.options);
With optim.options.Display = 'iter'; The first values the GA run generates for me are always much higher than 0.16.
Why??!?
Any help greatly appreciated.
0 个评论
采纳的回答
Alan Weiss
2019-3-26
To answer your second question first, if you set a problem structure as documented then you can call ga by
[x,fval] = ga(problem)
For your first question, you can see the description of the penalty function in Integer ga algorithm. What I was trying to say is that your initial point might be infeasible, and then the penalty function is higher than the fitness function.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(2 个)
Alan Weiss
2019-3-26
You are probably seeing the result of the integer-constrained solver. The fitness function is modified by a penalty term. It is possible that your initial population matrix is not integer-feasible.
Also, since you seem to like making a struct for your problem, why not go all the way and use a real problem structure?
Alan Weiss
MATLAB mathematical toolbox documentation
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!