This is not a one to one of my problem, but shows the behavior well
using JuMP
using HiGHSlb_t = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
ub_t = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
len_t = length(lb_t)M_t = Model()
set_optimizer(M_t, HiGHS.Optimizer)@variable(M_t, lb_t[i] <= z[i=1:len_t] <= ub_t[i], Int)
@constraint(M_t, sum(z) <= 500)@objective(M_t, Max, sum(z))
optimize!(M_t)
answer =
for i in 1:len_t
push!(answer, value(z[i]))
end@show answer;
Below is the output
Running HiGHS 1.7.0 (git hash: 50670fd4c): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
Matrix [1e+00, 1e+00]
Cost [1e+00, 1e+00]
Bound [1e+00, 1e+02]
RHS [5e+02, 5e+02]
Presolving model
1 rows, 10 cols, 10 nonzeros 0s
0 rows, 0 cols, 0 nonzeros 0s
0 rows, 0 cols, 0 nonzeros 0s
Presolve: OptimalSolving report
Status Optimal
Primal bound 500
Dual bound 500
Gap 0% (tolerance: 0.01%)
Solution status feasible
500 (objective)
0 (bound viol.)
0 (int. viol.)
0 (row viol.)
Timing 0.00 (total)
0.00 (presolve)
0.00 (postsolve)
Nodes 0
LP iterations 0 (total)
0 (strong br.)
0 (separation)
0 (heuristics)
answer = Any[1.0, 1.0, 1.0, 1.0, 1.0, 95.0, 100.0, 100.0, 100.0, 100.0]