using MathOptInterface, HiGHS
const MOI = MathOptInterface
s = """
variables: x
minobjective: 1.0 * x * x
"""
h = MOI.instantiate(HiGHS.Optimizer, with_bridge_type = Float64)
MOIU.loadfromstring!(h, s)
println(h)
dest = MOI.FileFormats.Model(format = MOI.FileFormats.FORMAT_LP)
MOI.copy_to(dest, h)
h2 = sprint(write, dest)
println(h2)
prints:
Minimize ScalarQuadraticFunction{Float64}:
0.0 + 1.0 x²
Subject to:
minimize
obj:
subject to
Bounds
x free
End
so the objective gets lost in the copy_to apparently. this does not occur when using other QP solvers instead of HiGHS, e.g. with DAQP it correctly prints:
Minimize ScalarQuadraticFunction{Float64}:
0.0 + 1.0 x²
Subject to:
minimize
obj: [ 2 x ^ 2 ]/2
subject to
Bounds
x free
End
an MRE:
prints:
so the objective gets lost in the copy_to apparently. this does not occur when using other QP solvers instead of HiGHS, e.g. with DAQP it correctly prints:
@odow