Here in VRPTW, the depot is labeled with index 0, customers are 1..n, and vehicles are 1..K.
Decision variable y[i][k] denotes the time when customer i is visited by vehicle k.
Binary decision variable x[i][j][k]=1, if vehicle k travles from node i to node j.

To represent the time windows constraint and eliminate subtour, we have the following code:

for(IloInt i=0;i<n;i++)
  for(IloInt j=1;j<n;j++)
    for(IloInt k=0;k<K;k++) {

where SerTime is the time required to serve customer i, and Distance is the distance between node i and node j.

But why I am always faced up this error:

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I am confused, and want to know how to represent the time windows constraint. Thanks very much!

asked 25 Apr '13, 07:28

LinYuan's gravatar image

accept rate: 0%

edited 25 Apr '13, 07:56

fbahr's gravatar image

fbahr ♦

A quick search on the web shows that this is a MS Visual Studio error, not a CPLEX error. There are some discussion of relevant questions on IBM CPLEX forums, so you should check as well. In particular, check the webpages here, here, and here. It seems that it could be a memory problem or a debug/release mode configuration problem.


answered 25 Apr '13, 09:03

Ehsan's gravatar image

Ehsan ♦
accept rate: 16%

Thanks, later I find that if I add the condition i!=j, the program run perfectly. But I don't know why.

(25 Apr '13, 09:11) LinYuan

I bet Distance[i][i] or x[i][i]isn't well defined

(25 Apr '13, 09:26) jfpuget

In addition, I think that your loops are not well defined...

They should be:

for(IloInt i=0;i<n;i++)
  for(IloInt j=1;j<n+1;j++)
    for(IloInt k=0;k<K;k++)

answered 25 Apr '13, 10:10

mrtncou's gravatar image

accept rate: 0%

edited 25 Apr '13, 11:18

I guess this is not a Cplex problem. You might be using an outdated operating system like XP or some of essential libraries in Visual Studio are not included. Try updating your working system as much as possible. For example, a better configuration would be:

Windows 8.1 + Visual Studio 2013 (Ultimate Ver.) + IBM Ilog Cplex 12.6

Make sure that you install the Visual Studio with all libraries. Your block of code should work well, however, if the code got any logical problem, then the Error message had to do with the Syntax or the Logic of your program.


answered 02 Mar '15, 05:47

monash's gravatar image

accept rate: 0%

edited 02 Mar '15, 05:53

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 25 Apr '13, 07:28

Seen: 3,144 times

Last updated: 02 Mar '15, 05:53

OR-Exchange! Your site for questions, answers, and announcements about operations research.