我正试图通过OPL和IBM ILOG CPLEX中的软时间窗来设置一个旅行商问题来解决 . 毕竟我有Probelm,作为一个较小的版本安装,但找不到我的错误,所以我很无奈 .

请原谅我在编程OPL时可能有点复杂的方法,我从未做过这样的事情 .

TSP问题涉及1个仓库(x [1] [1])和3个客户 . 从仓库的Start开始,必须访问所有三个客户,然后返回到仓库 .

由此可以超过时间窗口(a [i],b [i])并且低于该值 .

w是早到的输出时间,m是迟到的输出时间 .

基础数据位于.dat文件中 .

我认为问题在于等式4c和4d,它应该消除子层 .

因为我不幸完全无能为力 .

我非常感谢任何帮助 .

提前致谢

迈克尔

OPL-Programm (.mod):

//number of Nodes

int V=...;

// initialization driving Time between two nodes

int u[1..V][1..V]=...;

//initialization Time-Windows

int a[2..V]=...;

int b[2..V]=...;

//initialization panalty-costs (not used in objective function)

int c1[2..V]=...;

int c2[2..V]=...;

// Helping Variable for Linearization

int M=51000;

//initialization decision variable

dvar boolean x [1..V][1..V];

//initialization of d,w, m 

//arrival Time

dvar int d[1..V];

// come too late

dvar int m[2..V];

//come too early // waitingtime

dvar int w[2..V];

//objective function

minimize

    sum( i in 1..V, j in 1..V)
                                u[i][j]*x[i][j]         
//  + sum(i in 2..V )
//                              c1[i]*w[i]  
//  + sum(i in 2..V)
//                              c2[i]*m[i]; 
    ;                                                     
//constraints

subject to{

//1)
// in each account only one edge must arrive TSP

forall(i in 2..V) sum(j in 1..V)x[i][j]==1;
//2) 3)
//Ensures that the depot (1) is left and is approached.

sum(j in 1..V)x[1][j]==1;

sum(i in 1..V)x[i][1]==1;

//4)
//Ensures that every customer is visited and leave afterwards.

forall(l in 2..V)

sum(i in 1..V)x[i][l]-sum(j in 1..V)x[l][j] ==0;

//4c) und 4d)
//prevents subtours

forall(i in 2..V, j in 1..V)

(w[i]+d[i]+u[i][j])-(M*(1-x[i][j]))<=d[j];

forall(j in 2..V)

x[1][j]*u[1][j]+w[j]<=d[j];

//4a)
//earliest arrival time z [i] equal is greater than the lower limit of the customer time window.

forall(i in 2..V)

a[i]-w[i]<=d[i];

//4b)
//earliest arrival z [i] is equal to less than the upper limit of the customer's time slot.

forall(i in 2..V )

b[i]+m[i]>=d[i];

forall(i in 1..V)

d[i]>=0;

forall(i in 2..V)

w[i]>=0;

forall(i in 2..V)

m[i]>=0;

}

The Data File (.dat):

//number of Nodes 

 V = 4;

// Traveltimes 

u=[ [1000, 3, 5, 30] [3, 1000, 30, 9] [5, 30, 1000, 4] [30, 9, 4, 1000] ];

//Time window lower limit // [Customer 1 Customer 2 Customer 3]

a=[ 23 , 3, 10];

//Time window limit // [Customer 1 Customer 2 Customer 3]

b=[50, 4, 30];

 //penalty costs // [Customer 1 Customer 2 Customer 3]

c1=[1, 1, 1];

//penalty costs // [Customer 1 Customer 2 Customer 3]

c2=[1, 1, 1];