我正在使用 or-tools 来解决 CP 问题。求解器给出了一个可行的解决方案,如下所示。它的意思是:
X1=345, X2=437, ..., X6=1150, X7=716, X8=788...etc.
random_list=[345, 437, 801, 981, 1068, 1150, 716, 788, 860, 982, 1069, 1151, 717, 789, 861, 944, 1026, 1152, 718, 790, 862, 984, 1071, 1153, 719, 791, 863, 985, 1072, 1154, 354, 436, 622, 1073, 1155]
The adjacent elements' gap ranged from -880 to 364.
实际上我想获得如下排序的变量并将约束设置为相邻元素的间隙。例如,间隙应在 10 到 50 之间。那么这样设置约束是否可行?
order_list=[345, 354, 436, 437, 622, 716, 717, 718, 719, 788, 789, 790, 791, 801, 860, 861, 862, 863, 944, 981, 982, 984, 985, 1026, 1068, 1069, 1071, 1072, 1073, 1150, 1151, 1152, 1153, 1154, 1155]
X1=345, X30=354, X31=436, X2=437,.... # the variables are not in order as definition.
The adjacent elements' gap ranged from 1 to 185.
谢谢你。