Originally posted by: Marko_Obert
Hi,
I want to create a range with a step, similar to e.g. numpy.arange (https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html)
start = 1
stop = 3
step = 0.5
to obtain a range of: 1.0, 1.5, 2.0, 2.5
According to the documention https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.5.1/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_opl_range.html it is possible to define a range of type "float"
"range float 1.0 ... 2.0 "but I can not find a paramter to define the step.
If this is not possible, I would like to try an alternative solution, but I'm also not sure how to achieve it.
in common.mod I create an hours tuple:
{float} Hours= ...; ## [1, 1.5, 2.0, 2.5.... 8759.5, 8760]
Is it somehow possible to "slice" an subset of this tuple
start = 4000
stop = 4002
e.g. subset = Hours[start:stop] ? => subset = [4000.0, 4000.5, 4001.5]
Kind regards,
Marko
#CPLEXOptimizers#DecisionOptimization