Optimization 带软时间窗和IBM ILOG CPLEX的旅行商(TSP)

Optimization 带软时间窗和IBM ILOG CPLEX的旅行商(TSP),optimization,cplex,Optimization,Cplex,我正试图在OPL和ibmilogcplex中设置一个旅行推销员问题,用软时间窗口来解决这个问题。毕竟我有这个问题,因为安装了一个较小的版本,但是找不到我的错误,所以我很无奈 请原谅我在编程OPL时可能有点复杂,我从来没有做过这样的事情 TSP问题涉及1个仓库(x[1][1])和3个客户。从车辆段开始,必须访问所有三位客户,然后返回车辆段 因此,时间窗口(a[i],b[i])可以被超过并转到下面 w是到早的输出时间,m是到晚的输出时间 基础数据位于.dat文件中 我认为问题在于方程式4c和4d,它

我正试图在OPL和ibmilogcplex中设置一个旅行推销员问题,用软时间窗口来解决这个问题。毕竟我有这个问题,因为安装了一个较小的版本,但是找不到我的错误,所以我很无奈

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

TSP问题涉及1个仓库(x[1][1])和3个客户。从车辆段开始,必须访问所有三位客户,然后返回车辆段

因此,时间窗口(a[i],b[i])可以被超过并转到下面

w是到早的输出时间,m是到晚的输出时间

基础数据位于.dat文件中

我认为问题在于方程式4c和4d,它应该可以消除这些小项

因为我很不幸完全不懂

我将非常感谢任何帮助

提前谢谢

迈克尔

OPL程序(.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;

}
//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];

@&“朋友”可能会在很短的时间内帮助您完成此任务。。。如果你在这里发布你的问题:谢谢你的提示。时间总是个问题:-(我自己教我所有东西,因为我找不到任何教程或其他东西,你会帮助我的。