Alan Weiss <aweiss@mathworks.com> wrote in message <o1h1mp$sl2$1@newscl01ah.mathworks.com>...
> On 11/24/2016 10:35 AM, Dom Fazzari wrote:
> > Hi everyone
> > I've some troubles with this code I've just written:
> > gs = GlobalSearch;
> > G1 = @(x)(x0(1).*((-96.19)+
> > log((x0(1))/(sum(x0)))))+(x0(2).*((-103.5765)+
> > log((x0(2))/(sum(x0)))))+(x0(3).*((-60.7612)+
> > log((x0(3))/(sum(x0)))))+(x0(4).*((-157.2666)+
> > log((x0(4))/(sum(x0)))))+(x0(5).*((-15.7762)+
> > log((x0(5))/(sum(x0)))))+(x0(6).*((-93.7912)+
> > log((x0(6))/(sum(x0)))))+(x0(7).*((-152.1869784261)+
> > log((x0(7))/(sum(x0)))))...
> > +(x0(8).*((-65.1308)+
> > log((x0(8))/(sum(x0)))))+(x0(9).*((-156.5081915685)+
> > log((x0(9))/(sum(x0)))));
> > opts =
> > optimoptions(@fmincon,'Algorithm','interior-point','MaxFunEvals',1000000,'MaxIter',10000000,'TolCon',1e-12);
> >
> > problem =
> > createOptimProblem('fmincon','x0',[+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4],...
> >
> > 'objective',G1,'lb',[0 0 0 0 0 0 0 0 0],'Aeq',[1 1 1 2 0 1 2 1 2;4 2
> > 0 0 2 6 4 2 2;1 0 1 1 0 2 2 1 1],'beq',[1;4;1],'options',opts);
> > [xmin,fmin,flag,outpt,allmins] = run(gs,problem);
> >
> > I want to find the global minimum,but matlab output is :
> > Undefined function 'optimoptions' for input arguments of type
> > 'function_handle'.
> >
> > Error in globalresearch (line 9)
> > opts =
> > optimoptions(@fmincon,'Algorithm','interior-point','MaxFunEvals',1000000,'MaxIter',10000000,'TolCon',1e-12);
> >
> >
> > I can't really find the problem, maybe fmincon is redundant?
> > I run matlab R2011b.
> >
> > Thanks in advance for any answer!
>
> You are using recent documentation for your problem, but you have an
> older version of MATLAB. optimoptions was introduced in R2013a. Use
> optimset instead, and use the correct documentation for your MATLAB version.
>
> Alan Weiss
> MATLAB mathematical toolbox documentation
Thank you for your kind reply, Alan!
I modified my code in this way:
gs = GlobalSearch;
G1 = (x0(1)*((-96.19)+ log((x0(1))/(sum(x0)))))+(x0(2)*((-103.5765)+ log((x0(2))/(sum(x0)))))+(x0(3)*((-60.7612)+ log((x0(3))/(sum(x0)))))+(x0(4)*((-157.2666)+ log((x0(4))/(sum(x0)))))+(x0(5)*((-15.7762)+ log((x0(5))/(sum(x0)))))+(x0(6)*((-93.7912)+ log((x0(6))/(sum(x0)))))+(x0(7)*((-152.1869784261)+ log((x0(7))/(sum(x0)))))...
+(x0(8)*((-65.1308)+ log((x0(8))/(sum(x0)))))+(x0(9)*((-156.5081915685)+ log((x0(9))/(sum(x0)))));
options = optimset('Algorithm','interior-point','MaxFunEvals',1000000,'MaxIter',10000000,'TolCon',1e-12);
problem = createOptimProblem('fmincon','x0',[+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4],...
'objective',G1,'lb',[0 0 0 0 0 0 0 0 0],'Aeq',[1 1 1 2 0 1 2 1 2;4 2 0 0 2 6 4 2 2;1 0 1 1 0 2 2 1 1],'beq',[1;4;1],'options',options);
[xmin,fmin,flag,outpt,allmins] = run(gs,problem);
xmin;
fmin;
but I still get an error as an output:
"Undefined function 'x0' for input arguments of type 'double'.".
I found this type of error depends usually on a wrong choose of directory, but this is not the case.
What could be an other reason?
Thank you again!
> On 11/24/2016 10:35 AM, Dom Fazzari wrote:
> > Hi everyone
> > I've some troubles with this code I've just written:
> > gs = GlobalSearch;
> > G1 = @(x)(x0(1).*((-96.19)+
> > log((x0(1))/(sum(x0)))))+(x0(2).*((-103.5765)+
> > log((x0(2))/(sum(x0)))))+(x0(3).*((-60.7612)+
> > log((x0(3))/(sum(x0)))))+(x0(4).*((-157.2666)+
> > log((x0(4))/(sum(x0)))))+(x0(5).*((-15.7762)+
> > log((x0(5))/(sum(x0)))))+(x0(6).*((-93.7912)+
> > log((x0(6))/(sum(x0)))))+(x0(7).*((-152.1869784261)+
> > log((x0(7))/(sum(x0)))))...
> > +(x0(8).*((-65.1308)+
> > log((x0(8))/(sum(x0)))))+(x0(9).*((-156.5081915685)+
> > log((x0(9))/(sum(x0)))));
> > opts =
> > optimoptions(@fmincon,'Algorithm','interior-point','MaxFunEvals',1000000,'MaxIter',10000000,'TolCon',1e-12);
> >
> > problem =
> > createOptimProblem('fmincon','x0',[+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4],...
> >
> > 'objective',G1,'lb',[0 0 0 0 0 0 0 0 0],'Aeq',[1 1 1 2 0 1 2 1 2;4 2
> > 0 0 2 6 4 2 2;1 0 1 1 0 2 2 1 1],'beq',[1;4;1],'options',opts);
> > [xmin,fmin,flag,outpt,allmins] = run(gs,problem);
> >
> > I want to find the global minimum,but matlab output is :
> > Undefined function 'optimoptions' for input arguments of type
> > 'function_handle'.
> >
> > Error in globalresearch (line 9)
> > opts =
> > optimoptions(@fmincon,'Algorithm','interior-point','MaxFunEvals',1000000,'MaxIter',10000000,'TolCon',1e-12);
> >
> >
> > I can't really find the problem, maybe fmincon is redundant?
> > I run matlab R2011b.
> >
> > Thanks in advance for any answer!
>
> You are using recent documentation for your problem, but you have an
> older version of MATLAB. optimoptions was introduced in R2013a. Use
> optimset instead, and use the correct documentation for your MATLAB version.
>
> Alan Weiss
> MATLAB mathematical toolbox documentation
Thank you for your kind reply, Alan!
I modified my code in this way:
gs = GlobalSearch;
G1 = (x0(1)*((-96.19)+ log((x0(1))/(sum(x0)))))+(x0(2)*((-103.5765)+ log((x0(2))/(sum(x0)))))+(x0(3)*((-60.7612)+ log((x0(3))/(sum(x0)))))+(x0(4)*((-157.2666)+ log((x0(4))/(sum(x0)))))+(x0(5)*((-15.7762)+ log((x0(5))/(sum(x0)))))+(x0(6)*((-93.7912)+ log((x0(6))/(sum(x0)))))+(x0(7)*((-152.1869784261)+ log((x0(7))/(sum(x0)))))...
+(x0(8)*((-65.1308)+ log((x0(8))/(sum(x0)))))+(x0(9)*((-156.5081915685)+ log((x0(9))/(sum(x0)))));
options = optimset('Algorithm','interior-point','MaxFunEvals',1000000,'MaxIter',10000000,'TolCon',1e-12);
problem = createOptimProblem('fmincon','x0',[+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4,+1e-4],...
'objective',G1,'lb',[0 0 0 0 0 0 0 0 0],'Aeq',[1 1 1 2 0 1 2 1 2;4 2 0 0 2 6 4 2 2;1 0 1 1 0 2 2 1 1],'beq',[1;4;1],'options',options);
[xmin,fmin,flag,outpt,allmins] = run(gs,problem);
xmin;
fmin;
but I still get an error as an output:
"Undefined function 'x0' for input arguments of type 'double'.".
I found this type of error depends usually on a wrong choose of directory, but this is not the case.
What could be an other reason?
Thank you again!