Skip to content

Conversation

@ZedongPeng
Copy link
Collaborator

Description

This PR adds support for MOI.RawOptimizerAttribute to the OptimizerCache.

Previously, attempting to pass solver-specific parameters (such as "l_inf_ruiz_iterations") via JuMP’s set_optimizer_attribute would fail because OptimizerCache did not have the necessary methods to store or retrieve raw attributes, resulting in a MathOptInterface.UnsupportedAttribute error.

Reproduction of the Issue

Before this fix, running the following code resulted in a generic LoadError:

using JuMP
import MathOptInterface as MOI
using cuPDLPx

model = read_from_file("2club200v15p5scn.mps.gz")
undo = relax_integrality(model);

println("Read MPS succeed.")
set_optimizer(model, cuPDLPx.Optimizer)
set_optimizer_attribute(model, "verbose", true)
# The line below previously caused the crash
set_optimizer_attribute(model, "l_inf_ruiz_iterations", 0)
set_optimizer_attribute(model, "iteration_limit", 200)

optimize!(model)
println(solution_summary(model))

Output

ERROR: LoadError: MathOptInterface.UnsupportedAttribute{MathOptInterface.RawOptimizerAttribute}: Attribute MathOptInterface.RawOptimizerAttribute("l_inf_ruiz_iterations") is not supported by the model.
Stacktrace:
  [1] throw_set_error_fallback(model::cuPDLPx.OptimizerCache, attr::MathOptInterface.RawOptimizerAttribute, value::Int64; error_if_supported::MathOptInterface.SetAttributeNotAllowed{…})
    @ MathOptInterface ~/.julia/packages/MathOptInterface/03Qtw/src/attributes.jl:631
  ...
  [7] set(m::Model, attr::MathOptInterface.RawOptimizerAttribute, value::Int64)
    @ JuMP ~/.julia/packages/JuMP/e83v9/src/optimizer_interface.jl:1264

Hi @blegat . I implemented the storage using model.ext, but I am not sure if this is the best practice (or if there is a preferred way to handle this in MOI). Could you give it a look when you have time? Thank you so much.

@ZedongPeng ZedongPeng requested a review from blegat January 18, 2026 03:49
end

function MOI.set(model::OptimizerCache, param::MOI.RawOptimizerAttribute, value)
_raw_attr_storage(model)[Symbol(param.name)] = value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should throw(MOI.UnsupportedAttribute(param)) if itls not supported before this line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants