例钢管下料
问题:某钢管零售商从钢管厂进货,将钢管按照顾客的要求切割后售出,从钢管厂进货时得到的原料钢管都是19 m.
(1)现有一客户需要50根4 m ,20根6 m和 15根8 m 的钢管.应如何下料最节省?
(2)零售商如果采用的不同切割模式太多,将会导致生产过程的复杂化,从而增加生产和管理成本,所以该零售商规定采用的不同切割模式不能超过3种.此外,该客户除需要(1)中的三种钢管外,还需要10根5m的钢管.应如何下料最节省?
难点
主要在于切割方案的设定
在钢管下料问题中,随着钢管需求种类的增多,切割方案的数量也会急剧变多。因此靠穷举法列举出所有的切割方案进行求解是不现实的。此时就需要用到列生成法
主要思想
在大规模线性规划问题中假设共有
N
N
N个变量需要求解,先确定其中的
n
n
n个变量参与到模型中(基变量),令其余
N
−
n
N-n
N−n个变量为0(非基变量)。这样的问题称为限定主问题。
在求解到限定主问题之后,计算其影子价格,进一步计算其
R
e
d
u
c
e
c
o
s
t
Reduce\quad cost
Reducecost(非基变量的检验数),若
R
e
d
u
c
e
c
o
s
t
<
0
Reduce\quad cost<0
Reducecost<0则次非基变量可以使得函数值更优,因此问题就转化为了一个子问题
M
i
n
R
e
d
u
c
e
c
o
s
t
=
c
j
−
P
i
∗
a
j
Min \qquad Reduce\quad cost = c_j - Pi*a_j
MinReducecost=cj−Pi∗aj,
P
i
有
两
重
含
义
(
1
)
通
过
求
解
R
M
P
问
题
得
到
的
影
子
价
格
(
2
)
通
过
求
解
R
M
P
对
偶
问
题
得
到
的
对
偶
变
量
Pi有两重含义\\ (1)通过求解RMP问题得到的影子价格\\ (2)通过求解RMP对偶问题得到的对偶变量
Pi有两重含义(1)通过求解RMP问题得到的影子价格(2)通过求解RMP对偶问题得到的对偶变量
c
j
为
在
目
标
函
数
中
新
加
入
的
变
量
x
n
+
1
的
系
数
a
j
为
限
制
性
主
问
题
添
加
新
变
量
x
j
后
约
束
方
程
的
系
数
c_j为在目标函数中新加入的变量x_{n+1}的系数\\ a_j为限制性主问题添加新变量x_j后约束方程的系数
cj为在目标函数中新加入的变量xn+1的系数aj为限制性主问题添加新变量xj后约束方程的系数
具体公式推导参考列生成算法参考以及《Python最优化算法实战》-苏振裕
模型建立
假设目前共有
n
n
n种切割方案
x
1
,
x
2
.
.
.
x
n
x_1,x_2...x_n
x1,x2...xn,共有
m
m
m种钢管种类需求,那么第
i
i
i种切割方案产生的第
j
j
j种钢管的个数为
c
i
j
c_{ij}
cij,每种切割方案的使用次数为
y
i
y_i
yi(每根钢管只使用一种切割方案)那么本题第一问我们可以假设只有3种切割方案,分别只生产4m,6m,8m的钢管,那么这三种方案可分别产生3种钢管的个数为4,3,2根,利用列生成法再生成其他的钢管切割方案,第一问可建立模型如下(下料最节省理解为使用的钢管数量最少)
M
i
n
∑
i
=
1
i
=
3
y
i
S
.
T
.
{
4
∗
y
1
>
=
50
3
∗
y
2
>
=
20
2
∗
y
3
>
=
15
Min \qquad \sum_{i=1}^{i=3} y_i\\ S.T.\left\{ \begin{aligned} 4*y_1>=50\\ 3*y_2>=20\\ 2*y_3>=15\\ \end{aligned} \right.
Mini=1∑i=3yiS.T.⎩⎪⎨⎪⎧4∗y1>=503∗y2>=202∗y3>=15
#代码1-1
import gurobipy as grb
model = grb.Model()
# 定义变量
y1 = model.addVar(name='y1')
y2 = model.addVar(name='y2')
y3 = model.addVar(name='y3')
# 添加约束
model.addConstr(4*y1>=50,'第1种钢管')
model.addConstr(3*y2>=20,'第2种钢管')
model.addConstr(2*y3>=15,'第3种钢管')
model.addConstr(y1 >= 0)
model.addConstr(y2 >= 0)
model.addConstr(y3 >= 0)
# 目标函数
model.setObjective(y1+y2+y3, grb.GRB.MINIMIZE)
# 求解
model.optimize()
# 打印变量
dual = model.getAttr(grb.GRB.Attr.Pi, model.getConstrs())
print(dual)
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 6 rows, 3 columns and 6 nonzeros
Model fingerprint: 0x4a595d48
Coefficient statistics:
Matrix range [1e+00, 4e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 5e+01]
Presolve removed 6 rows and 3 columns
Presolve time: 0.02s
Presolve: All rows and columns removed
Iteration Objective Primal Inf. Dual Inf. Time
0 2.6666667e+01 0.000000e+00 0.000000e+00 0s
Solved in 0 iterations and 0.02 seconds
Optimal objective 2.666666667e+01
[0.25, 0.3333333333333333, 0.5, 0.0, 0.0, 0.0]
最终得到影子价格为
Constraint Pi
第1种钢管 0.25
第2种钢管 0.333333
第3种钢管 0.5
可继续建立模型计算有无
R
e
d
u
c
e
c
o
s
t
<
0
Reduce\quad cost<0
Reducecost<0
M
i
n
1
−
0.25
∗
a
1
−
0.333333
∗
a
2
−
0.5
∗
a
3
S
.
T
.
{
4
∗
a
1
+
6
∗
a
2
+
8
∗
a
3
<
=
19
a
1
,
a
2
,
a
3
>
=
0
Min \qquad 1-0.25*a_1-0.333333*a_2-0.5*a_3\\ S.T.\left\{ \begin{aligned} 4*a_1+6*a_2+8*a_3<=19\\ a_1,a_2,a_3>=0 \end{aligned} \right.
Min1−0.25∗a1−0.333333∗a2−0.5∗a3S.T.{4∗a1+6∗a2+8∗a3<=19a1,a2,a3>=0
import gurobipy as grb
from gurobipy import *
model = grb.Model()
# 定义变量
a1 = model.addVar(vtype=grb.GRB.INTEGER,name='a1')
a2 = model.addVar(vtype=grb.GRB.INTEGER,name='a2')
a3 = model.addVar(vtype=grb.GRB.INTEGER,name='a3')
# 添加约束
model.addConstr(4*a1+6*a2+8*a3<=19,'钢管长度约束')
model.addConstr(a1 >= 0)
model.addConstr(a2 >= 0)
model.addConstr(a3 >= 0)
# 目标函数
model.setObjective(1-0.25*a1-0.333333*a2-0.5*a3, grb.GRB.MINIMIZE)
# 求解
model.optimize()
# 打印变量
print('目标函数值是:', model.objVal)
for v in model.getVars():
print(v.varName, '=', v.x)
# 获取约束的对偶变量的值
#model.printAttr('Pi')
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 4 rows, 3 columns and 6 nonzeros
Model fingerprint: 0x7a02d529
Variable types: 0 continuous, 3 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 8e+00]
Objective range [3e-01, 5e-01]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 2e+01]
Found heuristic solution: objective 0.0000000
Presolve removed 4 rows and 3 columns
Presolve time: 0.01s
Presolve: All rows and columns removed
Explored 0 nodes (0 simplex iterations) in 0.03 seconds
Thread count was 1 (of 8 available processors)
Solution count 2: -0.083333 0
Optimal solution found (tolerance 1.00e-04)
Best objective -8.333300000000e-02, best bound -8.333300000000e-02, gap 0.0000%
目标函数值是: -0.0833330000000001
a1 = 3.0
a2 = 1.0
a3 = -0.0
R e d u c e c o s t = − 0.0833330000000001 < 0 Reduce\quad cost=-0.0833330000000001<0 Reducecost=−0.0833330000000001<0故新的切割方案为分别生产三种钢管3,1,0根,将新的生产方案带入模型再次求解
M i n ∑ i = 1 i = 4 y i S . T . { 4 ∗ y 1 + 3 ∗ y 4 > = 50 3 ∗ y 2 + 1 ∗ y 4 > = 20 2 ∗ y 3 > = 15 Min \qquad \sum_{i=1}^{i=4} y_i\\ S.T.\left\{ \begin{aligned} 4*y_1+3*y_4>=50\\ 3*y_2+1*y_4>=20\\ 2*y_3>=15\\ \end{aligned} \right. Mini=1∑i=4yiS.T.⎩⎪⎨⎪⎧4∗y1+3∗y4>=503∗y2+1∗y4>=202∗y3>=15
import gurobipy as grb
model = grb.Model()
# 定义变量
y1 = model.addVar(name='y1')
y2 = model.addVar(name='y2')
y3 = model.addVar(name='y3')
y4 = model.addVar(name='y4')
# 添加约束
model.addConstr(4*y1+3*y4>=50,'第1种钢管')
model.addConstr(3*y2+1*y4>=20,'第2种钢管')
model.addConstr(2*y3>=15,'第3种钢管')
model.addConstr(y1 >= 0)
model.addConstr(y2 >= 0)
model.addConstr(y3 >= 0)
model.addConstr(y4 >= 0)
# 目标函数
model.setObjective(y1+y2+y3+y4, grb.GRB.MINIMIZE)
# 求解
model.optimize()
# 打印对偶变量
dual = model.getAttr(grb.GRB.Attr.Pi, model.getConstrs())
print(dual)
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 7 rows, 4 columns and 9 nonzeros
Model fingerprint: 0x29392b6d
Coefficient statistics:
Matrix range [1e+00, 4e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 5e+01]
Presolve removed 5 rows and 1 columns
Presolve time: 0.02s
Presolved: 2 rows, 3 columns, 4 nonzeros
Iteration Objective Primal Inf. Dual Inf. Time
0 7.5000000e+00 1.750000e+01 0.000000e+00 0s
3 2.5277778e+01 0.000000e+00 0.000000e+00 0s
Solved in 3 iterations and 0.04 seconds
Optimal objective 2.527777778e+01
[0.2222222222222222, 0.3333333333333333, 0.5, 0.0, 0.0, 0.0, 0.0]
对偶变量为0.2222222222222222, 0.3333333333333333, 0.5
import gurobipy as grb
from gurobipy import *
model = grb.Model()
# 定义变量
a1 = model.addVar(vtype=grb.GRB.INTEGER,name='a1')
a2 = model.addVar(vtype=grb.GRB.INTEGER,name='a2')
a3 = model.addVar(vtype=grb.GRB.INTEGER,name='a3')
# 添加约束
model.addConstr(4*a1+6*a2+8*a3<=19,'钢管长度约束')
model.addConstr(a1 >= 0)
model.addConstr(a2 >= 0)
model.addConstr(a3 >= 0)
# 目标函数
model.setObjective(1-0.2222222222222222*a1-0.3333333333333333*a2-0.5*a3, grb.GRB.MINIMIZE)
# 求解
model.optimize()
# 打印变量
print('目标函数值是:', model.objVal)
for v in model.getVars():
print(v.varName, '=', v.x)
# 获取约束的对偶变量的值
#model.printAttr('Pi')
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 4 rows, 3 columns and 6 nonzeros
Model fingerprint: 0xa7a1061a
Variable types: 0 continuous, 3 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 8e+00]
Objective range [2e-01, 5e-01]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 2e+01]
Found heuristic solution: objective 0.1111111
Presolve removed 4 rows and 3 columns
Presolve time: 0.00s
Presolve: All rows and columns removed
Explored 0 nodes (0 simplex iterations) in 0.02 seconds
Thread count was 1 (of 8 available processors)
Solution count 2: -0.0555556 0.111111
Optimal solution found (tolerance 1.00e-04)
Best objective -5.555555555556e-02, best bound -5.555555555556e-02, gap 0.0000%
目标函数值是: -0.05555555555555536
a1 = 1.0
a2 = 1.0
a3 = 1.0
R e d u c e c o s t = − 0.05555555555555536 < 0 Reduce\quad cost=-0.05555555555555536<0 Reducecost=−0.05555555555555536<0故新的切割方案为分别生产三种钢管1,1,1根,将新的生产方案带入模型再次求解
M i n ∑ i = 1 i = 5 y i S . T . { 4 ∗ y 1 + 3 ∗ y 4 + 1 ∗ y 5 > = 50 3 ∗ y 2 + 1 ∗ y 4 + 1 ∗ y 5 > = 20 2 ∗ y 3 + 1 ∗ y 5 > = 15 Min \qquad \sum_{i=1}^{i=5} y_i\\ S.T.\left\{ \begin{aligned} 4*y_1+3*y_4+1*y_5>=50\\ 3*y_2+1*y_4+1*y_5>=20\\ 2*y_3+1*y_5>=15\\ \end{aligned} \right. Mini=1∑i=5yiS.T.⎩⎪⎨⎪⎧4∗y1+3∗y4+1∗y5>=503∗y2+1∗y4+1∗y5>=202∗y3+1∗y5>=15
import gurobipy as grb
model = grb.Model()
# 定义变量
y1 = model.addVar(name='y1')
y2 = model.addVar(name='y2')
y3 = model.addVar(name='y3')
y4 = model.addVar(name='y4')
y5 = model.addVar(name='y5')
# 添加约束
model.addConstr(4*y1+3*y4+1*y5>=50,'第1种钢管')
model.addConstr(3*y2+1*y4+1*y5>=20,'第2种钢管')
model.addConstr(2*y3+1*y5>=15,'第3种钢管')
model.addConstr(y1 >= 0)
model.addConstr(y2 >= 0)
model.addConstr(y3 >= 0)
model.addConstr(y4 >= 0)
model.addConstr(y5 >= 0)
# 目标函数
model.setObjective(y1+y2+y3+y4+y5, grb.GRB.MINIMIZE)
# 求解
model.optimize()
# 打印对偶变量
dual = model.getAttr(grb.GRB.Attr.Pi, model.getConstrs())
print(dual)
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 8 rows, 5 columns and 13 nonzeros
Model fingerprint: 0xc4e176f7
Coefficient statistics:
Matrix range [1e+00, 4e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 5e+01]
Presolve removed 5 rows and 0 columns
Presolve time: 0.02s
Presolved: 3 rows, 5 columns, 8 nonzeros
Iteration Objective Primal Inf. Dual Inf. Time
0 0.0000000e+00 2.500000e+01 0.000000e+00 0s
4 2.5000000e+01 0.000000e+00 0.000000e+00 0s
Solved in 4 iterations and 0.03 seconds
Optimal objective 2.500000000e+01
[0.25, 0.25, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0]
对偶变量为0.25, 0.25, 0.5
import gurobipy as grb
from gurobipy import *
model = grb.Model()
# 定义变量
a1 = model.addVar(vtype=grb.GRB.INTEGER,name='a1')
a2 = model.addVar(vtype=grb.GRB.INTEGER,name='a2')
a3 = model.addVar(vtype=grb.GRB.INTEGER,name='a3')
# 添加约束
model.addConstr(4*a1+6*a2+8*a3<=19,'钢管长度约束')
model.addConstr(a1 >= 0)
model.addConstr(a2 >= 0)
model.addConstr(a3 >= 0)
# 目标函数
model.setObjective(1-0.25*a1-0.25*a2-0.5*a3, grb.GRB.MINIMIZE)
# 求解
model.optimize()
# 打印变量
print('目标函数值是:', model.objVal)
for v in model.getVars():
print(v.varName, '=', v.x)
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 4 rows, 3 columns and 6 nonzeros
Model fingerprint: 0x0989fb15
Variable types: 0 continuous, 3 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 8e+00]
Objective range [3e-01, 5e-01]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 2e+01]
Found heuristic solution: objective 0.0000000
Presolve removed 4 rows and 3 columns
Presolve time: 0.01s
Presolve: All rows and columns removed
Explored 0 nodes (0 simplex iterations) in 0.03 seconds
Thread count was 1 (of 8 available processors)
Solution count 1: 0
Optimal solution found (tolerance 1.00e-04)
Best objective 0.000000000000e+00, best bound 0.000000000000e+00, gap 0.0000%
目标函数值是: 0.0
a1 = 4.0
a2 = -0.0
a3 = -0.0
R e d u c e c o s t = 0 Reduce\quad cost=0 Reducecost=0无更优的切割方案,故目前的切割方案有
方案 | 钢管1数量 | 钢管2数量 | 钢管3数量 |
---|---|---|---|
方案1 | 4 | 0 | 0 |
方案2 | 0 | 3 | 0 |
方案3 | 0 | 0 | 2 |
方案4 | 3 | 1 | 0 |
方案5 | 1 | 1 | 1 |
可建立模型如下
M
i
n
∑
i
=
1
i
=
5
y
i
S
.
T
.
{
4
∗
y
1
+
3
∗
y
4
+
1
∗
y
5
>
=
50
3
∗
y
2
+
1
∗
y
4
+
1
∗
y
5
>
=
20
2
∗
y
3
+
1
∗
y
5
>
=
15
Min \qquad \sum_{i=1}^{i=5} y_i\\ S.T.\left\{ \begin{aligned} 4*y_1+3*y_4+1*y_5>=50\\ 3*y_2+1*y_4+1*y_5>=20\\ 2*y_3+1*y_5>=15\\ \end{aligned} \right.
Mini=1∑i=5yiS.T.⎩⎪⎨⎪⎧4∗y1+3∗y4+1∗y5>=503∗y2+1∗y4+1∗y5>=202∗y3+1∗y5>=15
import gurobipy as grb
model = grb.Model()
# 定义变量
y1 = model.addVar(name='y1')
y2 = model.addVar(name='y2')
y3 = model.addVar(name='y3')
y4 = model.addVar(name='y4')
y5 = model.addVar(name='y5')
# 添加约束
model.addConstr(4*y1+3*y4+1*y5>=50,'第1种钢管')
model.addConstr(3*y2+1*y4+1*y5>=20,'第2种钢管')
model.addConstr(2*y3+1*y5>=15,'第3种钢管')
model.addConstr(y1 >= 0)
model.addConstr(y2 >= 0)
model.addConstr(y3 >= 0)
model.addConstr(y4 >= 0)
model.addConstr(y5 >= 0)
# 目标函数
model.setObjective(y1+y2+y3+y4+y5, grb.GRB.MINIMIZE)
# 求解
model.optimize()
# 求解
model.optimize()
print('目标函数值是:', model.objVal)
if model.status == GRB.OPTIMAL:
model.printAttr('X')
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 8 rows, 5 columns and 13 nonzeros
Model fingerprint: 0xc4e176f7
Coefficient statistics:
Matrix range [1e+00, 4e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 5e+01]
Presolve removed 5 rows and 0 columns
Presolve time: 0.02s
Presolved: 3 rows, 5 columns, 8 nonzeros
Iteration Objective Primal Inf. Dual Inf. Time
0 0.0000000e+00 2.500000e+01 0.000000e+00 0s
4 2.5000000e+01 0.000000e+00 0.000000e+00 0s
Solved in 4 iterations and 0.04 seconds
Optimal objective 2.500000000e+01
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 8 rows, 5 columns and 13 nonzeros
Coefficient statistics:
Matrix range [1e+00, 4e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 5e+01]
Solved in 0 iterations and 0.01 seconds
Optimal objective 2.500000000e+01
目标函数值是: 25.0
Variable X
-------------------------
y1 5
y4 5
y5 15
列生成法虽然可以迭代求出较优的切割方案,但是无法限制切割方案的个数,故可用另一种解法处理切割问题。以第二问为例(此方法同样可处理问题1)
(2)零售商如果采用的不同切割模式太多,将会导致生产过程的复杂化,从而增加生产和管理成本,所以该零售商规定采用的不同切割模式不能超过3种.此外,该客户除需要(1)中的三种钢管外,还需要10根5m的钢管.应如何下料最节省?
假设三种切割方案使用的钢管数分别为 x 1 , x 2 , x 3 x_1,x_2,x_3 x1,x2,x3,第 i i i种切割模式产生的第 j j j种钢管的个数为 r i j r_{ij} rij,那么可建立模型如下
M i n x 1 + x 2 + x 3 S . T . { ∑ i = 1 i = 3 r i j ∗ x i > = n e e d j , j = 1 , 2 , 3 , 4 16 < = 4 ∗ r i 1 + 6 ∗ r i 2 + 8 ∗ r i 3 + 5 ∗ r i 4 < = 19 , i = 1 , 2 , 3 Min \qquad x_1+x_2+x_3\\ S.T.\left\{ \begin{aligned} \sum_{i=1}^{i=3}r_{ij}*x_{i}>=need_{j},j=1,2,3,4\\ 16<=4*r_{i1}+ 6*r_{i2}+ 8*r_{i3}+ 5*r_{i4}<=19,i=1,2,3\\ \end{aligned} \right. Minx1+x2+x3S.T.⎩⎪⎪⎨⎪⎪⎧i=1∑i=3rij∗xi>=needj,j=1,2,3,416<=4∗ri1+6∗ri2+8∗ri3+5∗ri4<=19,i=1,2,3
import gurobipy as grb
from gurobipy import *
model = grb.Model()
# 定义变量
X = model.addVars(3 ,lb=0.0,vtype=GRB.INTEGER,name = 'X')
R = model.addVars(3,4,lb=0.0,vtype=GRB.INTEGER,name = 'R')
need = [50,20,15,10]
# 添加约束
model.addConstrs((grb.quicksum(R[i,j]*X[i] for i in range(3))>=need[j] for j in range(4)),"需求")
model.addConstrs((4*R[i,0]+6*R[i,1]+8*R[i,2]+5*R[i,3]<=19 for i in range(3)),"钢管长度限制")
model.addConstrs((4*R[i,0]+6*R[i,1]+8*R[i,2]+5*R[i,3]>=16 for i in range(3)),"钢管长度限制")
# 目标函数
model.setObjective(X.sum(), grb.GRB.MINIMIZE)
model.Params.NonConvex = 2#将线性规划变为非线性规划 模型将按照求解MIP的逻辑来求解此类非凸问题。
# 求解
model.optimize()
print('目标函数值是:', model.objVal)
# 打印变量
model.printAttr("X")
for v in model.getVars():
print(v.varName, '=', v.x)
Changed value of parameter NonConvex to 2
Prev: -1 Min: -1 Max: 2 Default: -1
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 6 rows, 15 columns and 24 nonzeros
Model fingerprint: 0x19322347
Model has 4 quadratic constraints
Variable types: 0 continuous, 15 integer (0 binary)
Coefficient statistics:
Matrix range [4e+00, 8e+00]
QMatrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [0e+00, 0e+00]
RHS range [2e+01, 2e+01]
QRHS range [1e+01, 5e+01]
Presolve time: 0.00s
Presolved: 34 rows, 28 columns, 84 nonzeros
Presolved model has 12 bilinear constraint(s)
Variable types: 1 continuous, 27 integer (0 binary)
Root relaxation: objective 1.250000e+01, 21 iterations, 0.00 seconds
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 12.50000 0 5 - 12.50000 - - 0s
H 0 0 50.0000000 12.50000 75.0% - 0s
0 0 12.50000 0 5 50.00000 12.50000 75.0% - 0s
H 0 0 33.0000000 12.50000 62.1% - 0s
0 0 12.50000 0 6 33.00000 12.50000 62.1% - 0s
0 0 12.50000 0 6 33.00000 12.50000 62.1% - 0s
0 2 12.50000 0 6 33.00000 12.50000 62.1% - 0s
H 20 21 32.0000000 12.50000 60.9% 10.2 0s
H 48 40 31.0000000 12.50000 59.7% 8.7 0s
H 59 42 30.0000000 12.50000 58.3% 7.7 0s
* 188 75 16 29.0000000 16.00000 44.8% 6.3 0s
* 263 90 13 28.0000000 16.00000 42.9% 5.7 0s
Cutting planes:
Gomory: 1
Explored 1202 nodes (5570 simplex iterations) in 0.39 seconds
Thread count was 8 (of 8 available processors)
Solution count 7: 28 29 30 ... 50
Optimal solution found (tolerance 1.00e-04)
Best objective 2.800000000000e+01, best bound 2.800000000000e+01, gap 0.0000%
目标函数值是: 28.0
Variable X
-------------------------
X[0] 10
X[1] 10
X[2] 8
R[0,0] 2
R[0,1] 1
R[0,3] 1
R[1,0] 3
R[1,1] 1
R[2,2] 2
X[0] = 10.0
X[1] = 10.0
X[2] = 8.0
R[0,0] = 2.0
R[0,1] = 1.0
R[0,2] = -0.0
R[0,3] = 1.0
R[1,0] = 3.0
R[1,1] = 1.0
R[1,2] = 0.0
R[1,3] = -0.0
R[2,0] = -0.0
R[2,1] = 0.0
R[2,2] = 2.0
R[2,3] = 0.0