0

To solve my inventory problem I need a three-dimensional decision variable x_{ij}^t

I am new to the CPLEX Python API docplex and all I found so far is

m = Model(name='inventory_problem')
x = m.integer_var_matrix(keys1=all_origins, keys2=all_destinations)

which would cover i and j in the indeces but how can I include the third dimension?

I guess it is not very difficult but I just cannot find it ... Thanks very much!

rkersh
  • 4,447
  • 2
  • 22
  • 31
steph
  • 555
  • 2
  • 6
  • 21

2 Answers2

5

Apart from using integer_var_cube() you can use integer_var_dict():

x = m.integer_var_dict((i, j, t) for i in ... for j in ... for t in ...)

With that you can then neatly reference as x[i,j,t]. This also extends to more than 3 dimensions.

0

Alright, now I found it ...

apparently there is another function

m.integer_var_cube(keys1, keys2, keys3)
steph
  • 555
  • 2
  • 6
  • 21