0
votes

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!

2

2 Answers

4
votes

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
votes

Alright, now I found it ...

apparently there is another function

m.integer_var_cube(keys1, keys2, keys3)