1

I'm new to CPLEX, I wonder how to define decision variables like xijk but only those with subscript i < j or i ≠ j using OPL.

The code is like

int jobsNum = ...;
int machinesNum = ...;

range jobs = 0..jobsNum-1
range machines = 0..machinesNum-1;

dvar boolean x[jobs][jobs][machines];

x[jobs][jobs][machines] is the relative processing sequence of job i and job j on machine k, but if I put it like this it will introduce some redundant variables, so I wonder if I can write something like

dvar boolean x[i in jobs][j in jobs: j < i][machines];
rkersh
  • 4,447
  • 2
  • 22
  • 31
Li Danyuan
  • 121
  • 8

1 Answers1

1

let me give you an example

int jobsNum = 3;
int machinesNum = 4;

range jobs = 0..jobsNum-1;
range machines = 0..machinesNum-1;

tuple t
{
int i;
int j;
}

{t} transitions={<i,j> | ordered i,j in jobs};

dvar boolean x[transitions][machines];

subject to
{
x[<1,2>][1]==1;
}
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15