I am building a model with 624 decision variables. They are all continuous and have different lower and upper bounds. My problem is that when I print mdl.solution, the only decision variables that show are the ones with the lower bound -15 (from x48 to x192 and from x481 to x624). I am also using numpy arrays, however, the problem still stands if I cast them as lists.
Here is some code that might be useful to understand my problem:
horizon_t = 48
mdl.lb = np.hstack((np.zeros((horizon_t)), -15*np.ones((3*horizon_t)), np.zeros(6*horizon_t), -15*np.ones((3*horizon_t))))
mdl.ub = np.hstack((np.ones((horizon_t)), 15*np.ones((3*horizon_t)), np.ones(6*horizon_t), 15*np.ones((3*horizon_t))))
n_variables = 624
mdl.continuous_var_list(n_variables, mdl.lb, mdl.ub)
Thank you
is it a matter of not displaying 0 values ?
For instance, if I change a bit the bus example:
from docplex.mp.model import Model
mdl = Model(name='buses')
nbbus40 = mdl.integer_var(name='nbBus40')
nbbus30 = mdl.integer_var(name='nbBus30')
mdl.add_constraint(nbbus40*40 >= 300, 'kids')
mdl.minimize(nbbus40*500)
mdl.solve()
for v in mdl.iter_integer_vars():
print(v," = ",v.solution_value)
print()
print("default")
mdl.print_solution()
print()
print("with 0")
mdl.print_solution(print_zeros=True)
gives
nbBus40 = 8.0
nbBus30 = 0
default
objective: 4000
nbBus40=8
with 0
objective: 4000
nbBus40=8
nbBus30=0