Clear Filters
Clear Filters

geometric linear programming help

4 views (last 30 days)
Gustav Eklund
Gustav Eklund on 8 Jan 2020
Answered: Jyothis Gireesh on 22 Jan 2020
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] =
Error in test (line 9)
[sol,fval,exitflag,output] = linprog(problem)
the code:
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);
[sol,fval,exitflag,output] = linprog(problem)
if (z<=i)

Answers (1)

Jyothis Gireesh
Jyothis Gireesh on 22 Jan 2020
From the code provided above, it is my understanding that there is a quadratic constraint involving “x”and “y” in addition to the non-negative constraints.
According to MATLAB documentation, it may not be a recommended practice to use “linprog” as it is better suited for problems involving a linear objective function and at least one linear constraint. A “fmincon”solver may be more appropriate in this case as indicated by the error message.
Please refer to the following documentation link on “Linear on Quadratic Objective with Quadratic Constraints” which contains pointers on how to reformulate the problem.

Community Treasure Hunt

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

Start Hunting!