`HiGHS.jl` gives strange results

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.

1 Like

If Case-1 reporting OTHER_ERROR is just because M1 is an unbounded problem

Case 1 reports OTHER_ERROR because HiGHS cannot solve non-convex QPs.

You cannot use HiGHS to solve such problems. Try Gurobi instead.

but the result of Case-2 is misreported as OPTIMAL ,

Case 2 is a bug. HiGHS should report that it does not support solving non-convex QPs.

julia> using JuMP, HiGHS

julia> model = Model(HiGHS.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: HiGHS

julia> @variable(model, x)
x

julia> @variable(model, y)
y

julia> @objective(model, Max, x * y)
x*y

julia> optimize!(model)
Running HiGHS 1.7.0 (git hash: 50670fd4c): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
  Cost   [0e+00, 0e+00]
  Bound  [0e+00, 0e+00]
Iteration, Runtime, ObjVal, NullspaceDim
0, 0.000216, 0.000000, 2
2, 0.000243, 0.000000, 2
Model   status      : Optimal
Objective value     :  0.0000000000e+00
HiGHS run time      :          0.00

julia> solution_summary(model)
* Solver : HiGHS

* Status
  Result count       : 1
  Termination status : OPTIMAL
  Message from the solver:
  "kHighsModelStatusOptimal"

* Candidate solution (result #1)
  Primal status      : FEASIBLE_POINT
  Dual status        : FEASIBLE_POINT
  Objective value    : 0.00000e+00
  Objective bound    : 0.00000e+00
  Relative gap       : Inf
  Dual objective value : 0.00000e+00

* Work counters
  Solve time (sec)   : 2.83053e-04
  Simplex iterations : 0
  Barrier iterations : 0
  Node count         : -1

I’ll open an issue: kHighsModelStatusOptimal reported for non-convex QP · Issue #1727 · ERGO-Code/HiGHS · GitHub

1 Like

Is there any open-source solver that supports non-convex QPs?

1 Like
  • Ipopt.jl can find a local solution.
  • You could try Alpine.jl
  • You could try AmplNLWriter.jl with Couenne_jll.jl
using JuMP, AmplNLWriter, Couenne_jll
model = Model(() -> AmplNLWriter.Optimizer(Couenne_jll.amplexe))
@variable(model, 0 <= x <= 2)
@variable(model, 0 <= y <= 2)
@constraint(model, x + y <= 2)
@objective(model, Max, x * y)
optimize!(model)
solution_summary(model)
1 Like