w = sdpvar(n,1);
w0 = sdpvar(1,1);
Constraints = [w>=0, sum(w)==1];
Objective = - (A(:,i).'*w - D(:,i).'*(u + V*w + r*(entropy(w))));
optimize(Constraints,Objective,sdpsettings('debug',1,'solver','baron'));
Index exceeds the number of array elements (0).
Error in baron
Error in baron
Error in baron
Error in callbaron (line 85)
[x,fval,exitflag,info,allsol] = baron(obj,A,rl,ru,lb,ub,con,cl,cu,xtype,x0,opts);
Error in solvesdp (line 361)
eval(['output = ' solver.call '(interfacedata);']);
Error in optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:});
K>> obj = @(x)(x(1)-(-x(1)*log(x(1))-x(2)*log(x(2))))K>> baron(obj,[],[],[],[],[],[],[],[],['CC'])
K>> obj = @(x)(-(-x(1)*log(x(1))-x(2)*log(x(2)))+x(1))K>> baron(obj,[],[],[],[],[],[],[],[],['CC'])
CONVEX_EQUATIONS <list equation names>;
This equation declaration can be used to specify constraints that are convex. This is optional and must follow after the EQUATIONS declaration and before the equation definitions.
>> optimize(Constraints,Objective,sdpsettings('solver','knitro','verbose',0))
ans =
struct with fields:
yalmipversion: '20190425' yalmiptime: 1.559811467071738e-01 solvertime: 9.301885329282590e-02 info: 'Successfully solved (KNITRO)' problem: 0
>> optimize(Constraints,Objective,sdpsettings('solver','mosek','verbose',0))
ans =
struct with fields:
yalmipversion: '20190425' yalmiptime: 1.066808792425237e-01 solvertime: 4.319120757476922e-03 info: 'Successfully solved (MOSEK)' problem: 0
>> sdpvar x>> optimize(x>=0,x,sdpsettings('solver','mosek','verbose',0))
ans =
struct with fields:
yalmipversion: '20190425'
yalmiptime: 1.037132350146018e-01 solvertime: 1.286764985395122e-03
load('upper_soltn.mat')
w = sdpvar(n,1);
solver_time= [];
Constraints = [w>=0, sum(w)==1];
tic
%Objective = -(d'*u + d'*V*w - (1+d'*r)*sum(w.*log(w)));
Objective = -(d'*u + d'*V*w + max(0,(1+d'*r))*entropy(w) - tau);
P = optimize(Constraints,Objective,sdpsettings('solver','mosek','verbose',0));
solver_time = [solver_time P.solvertime];
wsave = value(w);
%yalmip clear;
for i=1:n
w = sdpvar(n,1);
Constraints = [w>=0, sum(w)==1];
%Objective = - (A(:,i).'*w - D(:,i).'*(u + V*w + r*(-sum(w.*log(w)))));
Objective = - (A(:,i).'*w - D(:,i).'*(u + V*w + r*(entropy(w))));
P = optimize(Constraints,Objective,sdpsettings('solver','mosek','verbose',0));
solver_time = [solver_time P.solvertime];
wsave = [wsave value(w)];
yalmip clear;
end
tocsave('save_w', 'wsave')
for i=1:q
w = sdpvar(n,1);
Constraints = [w>=0, sum(w)==1];
%Objective = u(i) + V(i,:)*w + r(i)*(-sum(w.*log(w)));
Objective = u(i) + V(i,:)*w + r(i)*(entropy(w));
P = optimize(Constraints,Objective,sdpsettings('solver','mosek','verbose',0));
solver_time = [solver_time P.solvertime];
wsave = [wsave value(w)];
yalmip clear;
end
toc
save('save_w', 'wsave')