GLOP - Google OR 工具 - 选择单纯形法

问题描述

我在 GLOP 中使用认线性求解器(我认为它是双单纯形)并得到 ABnorMAL 结果。

我想改用普通单纯形(如本文所述 - https://github.com/google/or-tools/issues/1868),但我不知道如何更改此设置。如何更改求解器? (顺便使用 C#)

解决方法

您需要更改求解器的参数。

课程在这里:http://google.github.io/or-tools/dotnet/classGoogle_1_1OrTools_1_1LinearSolver_1_1MPSolverParameters.html

您需要更改整数参数http://google.github.io/or-tools/dotnet/classGoogle_1_1OrTools_1_1LinearSolver_1_1MPSolverParameters.html#a3b8427a9f4368fd831af8f8c61fb823c

要改变的参数是http://google.github.io/or-tools/dotnet/classGoogle_1_1OrTools_1_1LinearSolver_1_1MPSolverParameters.html#a7319655592ea63d50ef2a6645e309784

要分配的值为 http://google.github.io/or-tools/dotnet/classGoogle_1_1OrTools_1_1LinearSolver_1_1MPSolverParameters.html#a79b59c0c868544afdaa05d89c8f8541f

,

Laurent 给出了上面的正确步骤。这是创建这些参数并传递给求解器的实用代码(如果有人感兴趣):

var Params = new Google.OrTools.LinearSolver.MPSolverParameters();
Params.SetIntegerParam(MPSolverParameters.IntegerParam.LP_ALGORITHM,(int) MPSolverParameters.LpAlgorithmValues.PRIMAL);
Solver.ResultStatus solved = solver.Solve(Params);