params_vb.vb.


params_vb.vb.


'版权所有2021,Gurobi优化狗万app足彩,LLC * /'使用与模型关联的参数。“使用不同的参数,将MIP解决了几秒钟。“选择最小的MIP间隙的那个,并且恢复优化直到找到最佳解决方案。导入系统导入gurobi类params_vb共享子主(args为string())如果args.length <1那么console.out.writeline(“用法:params_vb文件名”)返回结束如果尝试'读取模型并验证它是mipDimen Env作为新的Grbenv()Dim M作为新GrbModel(erv,args(0))如果m.ismip = 0那么控制台(“模型不是整数程序”)Environment.exit(1)结束if'设置2秒的时间限制M.Parameters.Timelimit = 2.0'现在用不同的MIPFocus Dim BestModel的模型作为新GrbModel(M)BestModel.Optimize()为Integer = 1到3 m.reset()m.Parameters.MIPFocus = i m.Optimize() If bestModel.MIPGap > m.MIPGap Then Dim swap As GRBModel = bestModel bestModel = m m = swap End If Next ' Finally, delete the extra model, reset the time limit and ' continue to solve the best model to optimality m.Dispose() bestModel.Parameters.TimeLimit = GRB.INFINITY bestModel.Optimize() Console.WriteLine("Solved with MIPFocus: " & bestModel.Parameters.MIPFocus) Catch e As GRBException Console.WriteLine("Error code: " + e.ErrorCode & ". " + e.Message) End Try End Sub End Class