Gurobi提供了一组C ###类型的解决方案

时间:2018-09-30 23:13:11

标签: python gurobi

我正在使用最新版本的Gurobi来通过Python优化MIP模型。

优化器求解模型并给出以下消息:

Optimize a model with 804 rows, 848 columns and 2004 nonzeros
Model has 192 quadratic constraints
Variable types: 720 continuous, 128 integer (124 binary)
Coefficient statistics:
  Matrix range     [1e-02, 1e+06]
  QMatrix range    [1e+00, 1e+00]
  QLMatrix range   [2e-03, 1e+00]
  Objective range  [9e-02, 1e+00]
  Bounds range     [1e+00, 1e+00]
  RHS range        [5e-01, 1e+06]
Presolve removed 796 rows and 648 columns
Presolve time: 0.00s
Presolved: 200 rows, 200 columns, 556 nonzeros
Variable types: 192 continuous, 8 integer (4 binary)
Found heuristic solution: objective 4676.0580000

Root relaxation: objective 4.675492e+03, 96 iterations, 0.00 seconds

    Nodes    |    Current Node    |     Objective Bounds      |     Work
 Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time

     0     0 4675.49199    0    3 4676.05800 4675.49199  0.01%     -    0s
H    0     0                    4675.4995720 4675.49199  0.00%     -    0s

Explored 1 nodes (96 simplex iterations) in 0.03 seconds
Thread count was 8 (of 8 available processors)

Solution count 2: 4675.5 4676.06 

Optimal solution found (tolerance 1.00e-04)
Best objective 4.675499571970e+03, best bound 4.675491987015e+03, gap 0.0002%

在查看m.getVars()时,我看到以下变量:

    C624      1.97984 
    C625      1.82252 
    ...
    C718      5.47093 
    C719      3.97195 

不用说它们从C624连续地变为C719,并且它们仅采​​用正值(我不知道它是否与我使用的参数和模型有关)。

它们是什么意思?

1 个答案:

答案 0 :(得分:1)

在将变量添加到模型时,如果定义name参数,则可以看到具有给定名称的变量。如

Var_y = model.addVar(vtype=GRB.INTEGER, name="Var_y")