hello everone can you help me?
In the code i want to get maximum value of 3*x+4*x with the constrain x^2+y^2<=1 and n=9
I have a code that dosent work i get this errors
Error using separateOptimStruct (line 25)
Use FMINCON function for this problem structure.
Error in linprog (line 126)
[f,A,B,Aeq,Beq,lb,ub,x0,options] =
separateOptimStruct(f);
Error in test (line 9)
[sol,fval,exitflag,output] = linprog(problem)
the code:
n=9;
z=0;
for(k=0:1:(n-1))
x = optimvar('x','LowerBound',0,'UpperBound',[]);
y = optimvar('y','LowerBound',0,'UpperBound',[]);
prob = optimproblem('Objective',3*x + 4*y,'ObjectiveSense','max');
prob.Constraints.c1 =((x*x)+(y*y)<=1);
problem=prob2struct(prob);
[sol,fval,exitflag,output] = linprog(problem)
i=fval*(-1);
if (z<=i)
q=sol
z=i
end
k
end
0 Comments
Sign in to comment.