using JuMP, HiGHS
## Case-1
M1 = Model(HiGHS.Optimizer)
@variable(M1, d[1:2])
g1 = @expression(M1, (1/100) * (d[1] - 1))
g2 = @expression(M1, (1/100) * (d[2] - 2))
@constraint(M1, 0 <= g1 <= 1)
@constraint(M1, 0 <= g2 <= 1)
@variable(M1, 0 <= x[1:2])
@objective(M1, Max, d' * x)
optimize!(M1)
value.(d), value.(x), objective_value(M1), termination_status(M1)
# RESULT:
# Running HiGHS 1.7.0 (git hash: 50670fd4c): Copyright (c) 2024 HiGHS under MIT licence terms
# Coefficient ranges:
# Matrix [1e-02, 1e-02]
# Cost [0e+00, 0e+00]
# Bound [0e+00, 0e+00]
# RHS [1e-02, 1e+00]
# Iteration, Runtime, ObjVal, NullspaceDim
# 0, 0.000000, 0.000000, 0
# lambda = -99999999999.998978
# Highs::returnFromRun: return_status = -1 != 0 = run_return_status For model_status_ = Not Set
# Model status : Not Set
# HiGHS run time : 0.01
# ([1.0, 2.0], [0.0, 2.0e7], 0.0, MathOptInterface.OTHER_ERROR)
## Case-2
M2 = Model(HiGHS.Optimizer)
@variable(M2, 0 <= d[1:2] <= 1)
@variable(M2, 0 <= x[1:2])
@objective(M2, Max, d' * x)
optimize!(M2)
value.(d), value.(x), objective_value(M2), termination_status(M2)
# RESULT:
# Running HiGHS 1.7.0 (git hash: 50670fd4c): Copyright (c) 2024 HiGHS under MIT licence terms
# Coefficient ranges:
# Cost [0e+00, 0e+00]
# Bound [1e+00, 1e+00]
# Iteration, Runtime, ObjVal, NullspaceDim
# 0, 0.000999, 0.000000, 0
# 1, 0.001996, 0.000000, 0
# Model status : Optimal
# Objective value : 0.0000000000e+00
# HiGHS run time : 0.01
# ([0.0, 0.0], [0.0, 0.0], 0.0, MathOptInterface.OPTIMAL)
If Case-1
reporting OTHER_ERROR
is just because M1
is an unbounded problem, M2
is also unbounded in a similar fashion but the result of Case-2
is misreported as OPTIMAL
, although neither value.(d)
nor value.(x)
is an optimal solution as expected.