我尝试编写Nourinejad等人的模型“车辆搬迁和员工在单向汽车共享系统中重新平衡”的模型。
我的模型中没有错误,但我只得到一个轻松的解决方案。我不明白为什么。
int n = 4;
range user = 1..n;
int vehicle_relocation_time[user][user]=...;
int staff_rebalance_time[user][user]=...;
tuple User{
int origin;
int destination;
int departure_time;
int arrival_time;
}
{User} Users = ...;
int c_reloc = 40;
int c_rebal = 40;
dvar boolean x1[user][user];
dvar boolean x2[user][user][user][user];
minimize
sum(i,j in Users) vehicle_relocation_time[i.destination][j.origin]*x1[i.destination,j.origin]*c_reloc
+ sum(i,j,p,q in Users)staff_rebalance_time[j.origin][p.destination]*c_rebal;
subject to {
forall (j in Users)ctConstraint2:
sum (i in Users) x1[i.destination,j.origin] == 1;
forall(i in user)
x1[i,i] == 0;
forall (j in Users)ctConstraint:
sum(i in Users: i != j) x1[i.destination,j.origin] - sum(i in Users: i != j) x1[j.destination,i.origin] == 0;
forall (i,j in Users : i != j && i.destination != j.origin)ctConstraint4:
x1[i.destination,j.origin] * (j.departure_time - vehicle_relocation_time[i.destination][j.origin] - i.arrival_time) >= 0 ;
forall (i,j,p,q in Users: i != j && p!=q)ctConstraint5:
x2[i.destination,j.origin,p.destination,q.origin] * (p.arrival_time-i.arrival_time
- vehicle_relocation_time[i.destination][j.origin] - staff_rebalance_time[j.origin][p.destination]) >= 0;
forall (p,q in Users: p!=q)ctConstraint6:
sum(i,j in Users: i != j) x2[i.destination,j.origin,p.destination,q.origin] == sum(r,s in Users: r != s) x2[p.destination,q.origin,r.destination,s.origin];
forall(i,j in Users: i != j)ctConstraint7:
x1[i.destination,j.origin]*vehicle_relocation_time[i.destination][j.origin] <= sum(p,q in Users: p!=q) x2[i.destination,j.origin,p.destination,q.origin];
forall(i,j in Users: i != j) ctConstraint8:
sum(p,q in Users: p!=q) x2[i.destination,j.origin,p.destination,q.origin] <= x1[i.destination,j.origin];
forall(p,q in Users: p!=q) ctConstraint9:
sum(i,j in Users: i != j) x2[i.destination,j.origin,p.destination,q.origin] <= x1[p.destination,q.origin];
}
如果,通过“放松”解决方案,您的意思是并非所有约束都被考虑在内,那可能是因为您的模型实际上是不可行的,并且一些约束被自动放宽以便无论如何都能提供解决方案。
这是在IDE中使用oplrun
求解模型时的默认行为。