如何按序列约束编写用于调度的序列



现在,我尝试EQ7:添加一个新约束,使每个start_pour[k][j]都与其他约束不同,start_pour[k][j]等于site_process_time[c]到可运行的模型。它展示了一个宽松的解决方案=没有可行的解决方案。我如何编写此约束?谢谢。

EQ7 :
forall(c in customer)
sum(k in truck, j in job)
(start_pour[k][j] + site_process_time[c] + (M*(1-x[c][k][j]))) <= 
sum(k in truck, j in job)
(start_pour[k][j] + (M*(1-x[c][k][j])));

.国防部

int c =...;
int k =...;
int j =...;
range customer     =   1..c;
range truck        =   1..k;
range job          =   1..j;

float demand[customer]=...;
float travel[customer]=...;
float plant_process_time[customer]=...; 
float site_process_time[customer]=...; 
float capacity[truck]=...;
int M=...;

dvar int+ start_load[truck][job];
dvar int+ start_pour[truck][job];
dvar boolean x[customer][truck][job];
dvar boolean y[customer];
/***************************************/
dexpr float Travel_Cost =  sum(c in customer, k in truck, j in job)
x[c][k][j];
dexpr float Penalty_Cost = sum(c in customer)
M*y[c];
minimize   Travel_Cost  + Penalty_Cost;
/***************************************/
subject to { 
EQ2 : //Assignment
forall(k in truck, j in job)
sum(c in customer)
x[c][k][j] <= 1 ;

EQ3 : //Precedence
forall(k in truck, j in job : j > 1)
sum(c in customer)
x[c][k][j] <=
sum(c in customer)
x[c][k][j-1];
EQ4 : //Demand <= Supply
forall(c in customer)
sum(k in truck, j in job)
x[c][k][j] * capacity[k] >= demand[c] * (1-y[c]);

EQ5 : //Job-Time Sequencing;
forall(c in customer, k in truck, j in job)
start_load[k][j] + plant_process_time[c] + travel[c] <= start_pour[k][j] + (M*(1-x[c][k][j-1]));

EQ6 : //Job-Time Sequencing;
forall(c in customer, k in truck, j in job: (j-1) in job)
start_pour[k][j-1] + site_process_time[c] + travel[c] <= start_load[k][j]+ (M*(1-x[c][k][j-1]));
}

..DAT

c = 2;
k = 2;
j = 5;
demand = [10 30];
travel = [5 10];
plant_process_time = [1 1];
site_process_time = [2 2];
capacity = [4 5];
M= 100000;

要使sur模型工作,您至少需要更改

EQ5 : //Job-Time Sequencing;
forall(c in customer, k in truck, j in job)
start_load[k][j] + plant_process_time[c] + travel[c] <= start_pour[k][j] + (M*(1-x[c][k][j-1]));

EQ5 : //Job-Time Sequencing;
forall(c in customer, k in truck, j in job:(j-1) in job)
start_load[k][j] + plant_process_time[c] + travel[c] <= start_pour[k][j] + (M*(1-x[c][k][j-1]));

然后你可以使用逻辑约束而不是大 M

EQ5 : //Job-Time Sequencing;
forall(c in customer, k in truck, j in job:(j-1) in job)
(1==x[c][k][j-1] ) => (start_load[k][j] + plant_process_time[c] + travel[c] <= start_pour[k][j]);

对于EQ7,您可以从

EQ7 :
forall(c in customer)
forall(ordered k,k2 in truck, ordered  j,j2 in job)
start_pour[k][j] != start_pour[k2][j2];

甚至

EQ7 :
forall(c in customer)
forall(ordered k,k2 in truck, ordered  j,j2 in job)
((1==x[c][k][j] ) && (1==x[c][k2][j2]))=> (abs(start_pour[k][j] -start_pour[k2][j2]) >=plant_process_time[c]);

如果您想考虑处理时间

我建议您查看 CPLEX 中的 CPOptimizer,因为它非常适合调度。

最新更新