manbet体育手机客户端


lpmethod_vb.vb


' Copyright 2019, 狗万app足彩Gurobi Optimization, LLC ' ' ' Solve a model with different values of Method parameter;显示哪个值解出的时间最短。导入系统导入Gurobi类lpmethod_vb共享子主(ByVal args As String())长度< 1,然后控制台。Try ' Read model and verify that it is a MIP Dim env As New GRBEnv() Dim model As New GRBModel(env, args(0)) '返回结束方法Dim bestMethod As Integer = -1 Dim bestTime As Double = model.get(GRB.DoubleParam.TimeLimit) For i As Integer = 0 To 2 model. reset () model. parameters .Method = i model. optimize () If model。Status = GRB.Status.OPTIMAL Then bestTime = model。Runtime bestMethod = i ' Reduce the TimeLimit parameter to save time ' with other methods model.Parameters.TimeLimit = bestTime结束如果Next '报告哪个方法最快如果bestMethod = -1然后控制台。WriteLine("无法解决此模型")Else Console。WriteLine("Solved in " & bestTime & _ " seconds with Method: " & bestMethod) End If ' Dispose of model and env model.Dispose() env.Dispose() Catch e As GRBException Console。WriteLine("错误代码:" & e.ErrorCode & ")。& e.Message)结束尝试结束子结束类