Global optimization toolbox

3 Ansichten (letzte 30 Tage)
Af
Af am 12 Dez. 2011
Hi
I recently got a trial version of Global optimization toolbox (ID #1370077)and I was trying to implement some of the examples which are provided in the documentations using GA algorithm. However, it seems that I can not get it work the way it is explained in there. For example, Constrained Minimization Problem has a fairly simple structure but every time I run the codes it gives the following error:
Optimization terminated: average change in the fitness value less than options.TolFun and constraint violation is less than options.TolCon.
I tried to decrease the Constraint tolerance in my codes but apparently it does not change anything. Below I put the codes that I have been using to do this. I appreciate if somebody has an idea how to deal with this case.
Best regards Afshin
ObjectiveFunction = @my_funTst; nvars = 2; % Number of variables LB = [0 0]; % Lower bound UB = [1 13]; % Upper bound ConstraintFunction = @nlinconstTst; options = optimset('TolFun',1e-8,'TolCon',1e-8); [x,fval] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB,ConstraintFunction);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
On a separate file I have the objective and constraint functions
function y = my_funTst(x) y = 100 * (x(1)^2 - x(2)) ^2 + (1 - x(1))^2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [c ceq] = nlinconstTst(x)
c = [1.5 + x(1)*x(2) + x(1) - x(2); -x(1)*x(2) + 10]; ceq = [];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by