int nbKids=300;{int} seats={40,30}; // how many seats, {} means this is a setfloat costBus[seats]=[500,400];// Now let s see how preassign some decision variables// Suppose we know that we have exactly 6 buses 40 seats{int} preassignedseats={40};int preassignedvalues[preassignedseats]=[6];dvar int+ nbBus[s in seats]in((s in preassignedseats)?preassignedvalues[s]:0)..((s in preassignedseats)?preassignedvalues[s]:maxint);minimize sum(b in seats) costBus[b]*nbBus[b];subject to{ sum(b in seats) b*nbBus[b]>=nbKids;} 这篇关于是否可以在 CPLEX OPL 中为决策变量预分配值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-11 17:43