CVX Mosek Problem: How can i use mosek with cvx solver and multiple constrains?
3 views (last 30 days)
Show older comments
I am trying to solve the problem: Food Manafacture I, form H. Paul Williams, Model Building in Mathematical Programming, fifth edition. Using cvx with mosek, but somethig is wrong and i dont know what. Above it is the code, i hope someone can help me.
The solution is: https://www.gurobi.com/resources/food-manufacture-i/, here te code is in python and i need it in matlab.
clc;clear all;
cvx_solver mosek
p = 150; %final price
gto = [110 120 130 110 115;
130 130 110 90 115;
110 140 130 100 95;
120 110 120 120 125;
100 120 150 110 105;
90 100 140 80 135]; %gto ->value of each oil, period x oil
price = 150;
IStore = [500 500 500 500 500];
total = [1000 1000 1000 1000 1000];
vegCapa = 200;
oilCapa = 250;
hardness_lb = 3;
hardness_ub = 6;
store_pricing = 5;
hardness = [8.8, 6.1,2.0,4.2,5.0];
cvx_begin
variable ft(6) integer;%ft -> produced
variable uto(6,5) integer;%uto -> used
variable sto(6,5) integer;%sto -> stock
variable bto(6,5) integer;%bto-> bought
maximize(price*sum(ft) - sum(sum(gto.*uto+store_pricing*sto)))
subject to
IStore + bto(1,:) == uto(1,:) + sto(1,:)
for i=2:1:length(gto)
sto(i-1,:) + bto(i,:) == uto(i,:) + sto(i,:)
sto(i,:) <= total;
sto(i,:) >= [0 0 0 0 0];
end
uto(:,1)+uto(:,2) <= vegCapa*ones(1,length(gto))'
uto(:,3)+uto(:,4)+uto(:,5) <= oilCapa*ones(1,length(gto))'
for i=1:1:length(gto)
3*ft(i) <= sum(hardness.*uto(i,:)) <= 6*ft(i)
end
sto(i,:) == IStore
ft == sum(uto')'
cvx_end
0 Comments
Answers (0)
See Also
Categories
Find more on Power and Energy Systems in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!