为什么我在 CPLEX 中读入节约束 t#0#1 而不是 t[1][1] 中的输出?

Why I read in output in the section constraint t#0#1 and not t[1][1] in CPLEX?

如果我有一个像 Y[i][j] 和 t[i][j] 这样的变量,其中 i=1..20 (I),j=1..10 (J) 和这个约束

forall (i in I)
  forall (j in J)
t[i][j] <= Y[i][j]

为什么在输出中看到约束是类型 t#0#1 <= Y#0#1 而实际上它应该是:t[1][1]<=Y[1] [1] ?谢谢

因为当您的数组有很多值时,opl cplex 会更改索引以节省内存,但您可以通过更改设置告诉 cplex 不要这样做

让我引用文档:

More about the “Big map naming threshold” option

The setting determines how the map name is printed, both on most screen outputs and in CPLEX exported files:

•If the map is considered big (by default, greater than or equal to 100), then numerical indices are used. For example, in the LP file exported from the nurses example:

id1985: costByDepartments#0 - 150 nurseAssignments#0#0

  • 168 nurseAssignments#1#0 - 102 nurseAssignments#2#0 ...

•If the map is considered small (by default, smaller than 100), then the real index values are used:

id1985: costByDepartments("Emergency")

  • 150 nurseAssignments({"Anne",11,1,25})({"Emergency","Monday",2,8,3,5})
  • 168 nurseAssignments({"Bethanie",4,5,28})({"Emergency","Monday",2,8,3,5}) ...

This option is currently used to switch between short and full map item names, for example, the names of decision variables or submaps. Big maps have short names.

假设您想更改此阈值。你可以写

execute
{
thisOplModel.settings.bigmapthreshold=1000000;

}