Matlab: max (q1+...q6), st. g*q<P, b1*q<W, 0.2P+0.4W<300000
Please help!
The codes are below, Gourbi does not give solution, where is wrong with the codes?
max (q1+...q6), st. g*q<P, b1*q<W, 0.2P+0.4W<300000, P>0.W>0
q=[q1, q2, ... g6] is integer
P,W, are real.
clear; clc;
names = { 'q1' ; 'q2' ; 'q3' ; 'q4' ; 'q5' ; 'q6' ; 'P';'W'};
g=[4.9 9.5 33.1 120.2 457.1 1778];
b1= [ 100 50 25 12.5 6.25 1.563]*10;
pw1 = [g -1 0];
bw1 = [b1 0 -1];
user_max = 0;
try
clear model ;
model.A = sparse([pw1;bw1; [zeros(1,6) 0.4 0.2]]);
model.obj = ones(1,6); %% objective is on all users
model.rhs = [0 0 300000 ];
model.sense = '<<<' ;
model.vtype(1:6) = 'I' ;
%model.vtype(7:8) = 'C';
model.modelsense = 'max' ;
clear params ;
params.outputflag = 0;
params.resultfile = 'mip10.lp' ;
result = gurobi(model, params);
disp(result)
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
投稿コメントは受け付けていません。
コメント
1件のコメント