如何从ojalgo优化结果中找到相对差距?

问题描述 投票:0回答:1

(混合整数)模型求解成功后,如何找到结果的相对差距?

ExpressionsBasedModel model = new ExpressionsBasedModel();
//... create objective, variables and expressions ...
Optimisation.Result result = model.minimise();
if (result.getState().isFeasible()) {
    System.out.println("Objective Value = " + result.getValue());
    System.out.println("Relative Gap = ");
}
mathematical-optimization ojalgo
1个回答
0
投票

(目前)没有办法提取它。

您可以通过设置来控制求解器中使用的 MIP 间隙:

ConfigurableStrategy strategy = IntegerStrategy.DEFAULT.withGapTolerance(NumberContext.of(4));
model.options.integer(strategy);

通过打开进度记录,求解器将输出有关其找到的解决方案的信息:

model.options.progress(IntegerSolver.class); 

通过进度记录的输出,您应该能够确定合适的 mip 间隙容差。

如果返回的解决方案的状态为“OPTIMAL”,则间隙小于配置的容差。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.