I’m not sure whether this is reasonable, but it is somewhat misleading.
Compare the 2 lines where I draw 3 orange balls.
julia> import JuMP, Gurobi; GRB_ENV = Gurobi.Env();
Set parameter Username
Set parameter LicenseID to value 2663413
Academic license - for non-commercial use only - expires 2026-05-11
julia> import LinearAlgebra.⋅ as ⋅ # dot product
julia> import Random; Random.seed!(3); # ⚠️ when modify this, U should also modify hyperparam
julia>
julia> begin
I = 7; # number of types of demand
w = rand(2.3:.01:4.8, I); # length of each demand
S = 2 # number of scenes
d = [5.0 7.44; 5.0 3.72; 4.0 3.57; 2.0 2.48; 6.0 4.96; 2.0 2.48; 2.0 1.24] # number of demads in 2 scenes
J = 3; # number of types of raw rolls
W = 2.57 * [3, 4, 5.]; # unit length of each type of raw roll
c = [.32 .44; .38 .32; .44 .30]; # (delayed to 2nd stage) cost of producing one unit length of raw roll
end;
julia> begin
Rfm = JuMP.Model(() -> Gurobi.Optimizer(GRB_ENV)); # a reformulation which facilitates decomposition
JuMP.@variable(Rfm, m[1:J]);
JuMP.@variable(Rfm, 0 ≤ n[1:I, 1:J, 1:S], Int);
JuMP.@variable(Rfm, 0 ≤ b[1:J, 1:S] ≤ 4, Int);
JuMP.@constraint(Rfm, [j = 1:J, s = 1:S], w ⋅ view(n, :, j, s) ≤ W[j]b[j, s]);
JuMP.@constraint(Rfm, [i = 1:I, s = 1:S], sum(view(n, i, :, s)) ≥ d[i, s]); # 🟡 [β ≥ 0]
JuMP.@constraint(Rfm, [j = 1:J, s = 1:S], m[j] == b[j, s]); # 🟡 [π]
JuMP.@objective(Rfm, Min, sum(c[j, s]b[j, s]/S for j = 1:J, s = 1:S));
end;
julia> JuMP.optimize!(Rfm)
Gurobi Optimizer version 12.0.2 build v12.0.2rc0 (win64 - Windows 11.0 (26100.2))
CPU model: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz, instruction set [SSE2|AVX|AVX2|AVX512]
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 26 rows, 51 columns and 102 nonzeros
Model fingerprint: 0x78f1bb14
Variable types: 3 continuous, 48 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 1e+01]
Objective range [1e-01, 2e-01]
Bounds range [4e+00, 4e+00]
RHS range [1e+00, 7e+00]
Found heuristic solution: objective 4.4000000
Presolve removed 6 rows and 6 columns
Presolve time: 0.00s
Presolved: 20 rows, 45 columns, 90 nonzeros
Variable types: 0 continuous, 45 integer (0 binary)
Root relaxation: objective 3.791803e+00, 🟠🟠🟠
Explored 1 nodes (25 simplex iterations) in 0.00 seconds (0.00 work units)
Thread count was 8 (of 8 available processors)
Solution count 2: 4.02 4.4
Optimal solution found (tolerance 1.00e-04)
Best objective 4.020000000000e+00, best bound 4.020000000000e+00, gap 0.0000%
julia> JuMP.unset_integer.(n); JuMP.unset_integer.(b);
julia> JuMP.optimize!(Rfm)
Gurobi Optimizer version 12.0.2 build v12.0.2rc0 (win64 - Windows 11.0 (26100.2))
Iteration Objective Primal Inf. Dual Inf. Time
0 0.0000000e+00 4.119000e+01 0.000000e+00 0s
28 3.4581323e+00 0.000000e+00 0.000000e+00 0s
Solved in 28 iterations and 0.00 seconds (0.00 work units)
Optimal objective 3.458132296e+00 🟠🟠🟠