是否有一种简单的方法可以将 LP 模型作为 IP 求解,即将连续变量转换为积分一次,而不需要对模型进行任何其他更改?
最佳答案
在 Java/Concert API 中,您可以通过添加 IloConversion 将变量或变量数组从连续更改为整数。反对你的模型。如果您有一个 IloNumVar 或 IloNumVarArray x,并且想要将其转换为整数,则可以使用以下命令创建转换对象
// create the conversion object and save a reference
IloConversion makeInteger cplex.conversion(x, IloNumVarType.Int);
// To modify the model, add the conversion object to the model
cplex.add(makeXInteger);
// solve the model,
IloBool success = cplex.solve();
// revert the model back to continuous
cplex.remove(makeXInteger);
关于java - CPLEX (12.5) Java API,将 LP 解析为 IP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24243902/