我有
IntVar[] orArea = new IntVar[N];
IntVar[] orCount = new IntVar[N];
IntVar[] orRows = new IntVar[N];
IntVar total_trim = model.intVar("trim", 0, 1000);
for (int i = 0; i < N; i++) {
orRows[i] = model.intVar("or_" + i + "_rows",0, 5);
orCount[i] = model.intVar("or_" + i + "_count", 0, O[i][2]);
orArea[i] = model.intScaleView(orCount[i],O[i][0] * O[i][1]);
}
我想获得 IntVar 的面积总和
像这样的东西:
IntVar totalAreas = orArea.sum();
并继续使用它
IntVar trimToOrder = total_trim.mul(1000000).div(totalAreas).intVar();
model.setObjective(Model.MINIMIZE, trimToOrder);