Clear Filters
Clear Filters

is the selected solution the optimal one?

1 view (last 30 days)
Housam
Housam on 13 Mar 2021
Commented: Walter Roberson on 13 Mar 2021
linprog always selects the lower limits (zero) for the last two variables and the upper limit for the second variable. However, the values should not be zeros.
question2: how can i visualize the feasible region, plotting the constraints?
objfunc.Constraints.econs1 = var1 + var2 == vector(i);
objfunc.Constraints.cons1 = var1 + var2 <= var3;
objfunc.Constraints.cons2 = var5 >= 3 * var4;
f= [49.1 49.1 98 577 1306];
vector=[950;1200;2000;20000];
for i=1:length(vector)
A= [1 1 -1 0 0
0 0 0 -3 1]
b= [0 0]
Aeq=[1 1 0 0 0]
beq=vector(i)
lb=[0;0;0;0;0]
ub=[25112; 1255; 25112-0.05*25112; 1255; 3*1255]
options = optimoptions('linprog','Algorithm','dual-simplex','Display','iter');
[x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,ub,options)
X{i,1}=x
FVAL{i,1}=fval + 580
end
  4 Comments
Housam
Housam on 13 Mar 2021
Thanks for the reply.
zero is physically not an acceptable solution. then how can i improve my problem formulation to maximize the last two variables instead
Walter Roberson
Walter Roberson on 13 Mar 2021
lb=[0;0;0;0;0]
tells it that 0 is acceptable. If 0 is not acceptable change the appropriate lb entry to hold the smallest acceptable value such as eps(realmin) which technically is not 0. However if the rejection is for physical reasons perhaps you should use the planck distance or 1/avagadro's number or whatever value corresponds to one quanta

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!