Skip to content

Conversation

andrewrosemberg
Copy link
Collaborator

@andrewrosemberg andrewrosemberg commented Aug 19, 2025

integrate POI to #281

Copy link
Member

@joaquimg joaquimg left a comment

Choose a reason for hiding this comment

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

Looking good!

@andrewrosemberg
Copy link
Collaborator Author

andrewrosemberg commented Aug 19, 2025

trying to add a ParametricVectorQuadraticFunction test

function test_jump_psd_cone_with_parameter_pv_v_pv()
    model = DiffOpt.conic_diff_model(SCS.Optimizer)
    @variable(model, x)
    @variable(model, p in MOI.Parameter(1.0))
    @constraint(
        model,
        con,
        [p * x, (2 * x - 3), p * 3 * x] in
        MOI.PositiveSemidefiniteConeTriangle(2)
    )
    @objective(model, Min, x)
    optimize!(model)
    direction_p = 2.0
    DiffOpt.set_forward_parameter(model, p, direction_p)
    DiffOpt.forward_differentiate!(model)
    # ERROR
end

but hitting:

julia> DiffOpt.forward_differentiate!(model)
ERROR: MathOptInterface.UnsupportedAttribute{MathOptInterface.ConstraintName}: Attribute MathOptInterface.ConstraintName() is not supported by the model.
Stacktrace:
  [1] throw_set_error_fallback(model::DiffOpt.ConicProgram.Model, attr::MathOptInterface.ConstraintName, index::MathOptInterface.ConstraintIndex{…}, value::String; error_if_supported::MathOptInterface.SetAttributeNotAllowed{…})
    @ MathOptInterface ~/.julia/packages/MathOptInterface/pjTDD/src/attributes.jl:603
  [2] throw_set_error_fallback(model::DiffOpt.ConicProgram.Model, attr::MathOptInterface.ConstraintName, index::MathOptInterface.ConstraintIndex{…}, value::String)
    @ MathOptInterface ~/.julia/packages/MathOptInterface/pjTDD/src/attributes.jl:593
  [3] set(::DiffOpt.ConicProgram.Model, ::MathOptInterface.ConstraintName, ::MathOptInterface.ConstraintIndex{…}, ::String)
    @ MathOptInterface ~/.julia/packages/MathOptInterface/pjTDD/src/attributes.jl:553
  [4] set(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, attr::MathOptInterface.ConstraintName, constraint_index::MathOptInterface.ConstraintIndex{…}, name::String)
    @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/pjTDD/src/Bridges/bridge_optimizer.jl:1732
  [5] set(model::ParametricOptInterface.Optimizer{…}, attr::MathOptInterface.ConstraintName, c::MathOptInterface.ConstraintIndex{…}, name::String)
    @ ParametricOptInterface ~/.julia/packages/ParametricOptInterface/8gg7e/src/MOI_wrapper.jl:540
  [6] _pass_attribute(dest::ParametricOptInterface.Optimizer{…}, src::MathOptInterface.Utilities.CachingOptimizer{…}, index_map::MathOptInterface.Utilities.IndexMap, cis_src::Vector{…}, attr::MathOptInterface.ConstraintName)
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/pjTDD/src/Utilities/copy.jl:146
  [7] pass_attributes(dest::ParametricOptInterface.Optimizer{…}, src::MathOptInterface.Utilities.CachingOptimizer{…}, index_map::MathOptInterface.Utilities.IndexMap, cis_src::Vector{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/pjTDD/src/Utilities/copy.jl:131
  [8] _pass_constraints(dest::ParametricOptInterface.Optimizer{…}, src::MathOptInterface.Utilities.CachingOptimizer{…}, index_map::MathOptInterface.Utilities.IndexMap, variable_constraints_not_added::Vector{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/pjTDD/src/Utilities/copy.jl:258
  [9] default_copy_to(dest::ParametricOptInterface.Optimizer{…}, src::MathOptInterface.Utilities.CachingOptimizer{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/pjTDD/src/Utilities/copy.jl:393
 [10] copy_to(dest::ParametricOptInterface.Optimizer{…}, src::MathOptInterface.Utilities.CachingOptimizer{…})
    @ ParametricOptInterface ~/.julia/packages/ParametricOptInterface/8gg7e/src/MOI_wrapper.jl:2005
 [11] _diff(model::DiffOpt.Optimizer{MathOptInterface.Utilities.CachingOptimizer{…}})
    @ DiffOpt ~/Workspace/DiffOpt.jl/src/moi_wrapper.jl:709
 [12] forward_differentiate!(model::DiffOpt.Optimizer{MathOptInterface.Utilities.CachingOptimizer{…}})
    @ DiffOpt ~/Workspace/DiffOpt.jl/src/moi_wrapper.jl:573
 [13] forward_differentiate!(model::Model)
    @ DiffOpt ~/Workspace/DiffOpt.jl/src/jump_moi_overloads.jl:363
 [14] top-level scope
    @ REPL[40]:1
Some type information was truncated. Use `show(err)` to see complete types.

Copy link

codecov bot commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.67%. Comparing base (c36d46d) to head (87c7cb6).
⚠️ Report is 1 commits behind head on jg/jumpapi.

Additional details and impacted files
@@             Coverage Diff             @@
##           jg/jumpapi     #302   +/-   ##
===========================================
  Coverage       88.67%   88.67%           
===========================================
  Files              16       16           
  Lines            2057     2057           
===========================================
  Hits             1824     1824           
  Misses            233      233           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrewrosemberg
Copy link
Collaborator Author

trying to add a ParametricVectorQuadraticFunction test

`...

Adding constraint as anonymous for now.

@andrewrosemberg
Copy link
Collaborator Author

Fixed constraint name on jump-dev/ParametricOptInterface.jl#189

@joaquimg joaquimg merged commit 5f7bcdf into jg/jumpapi Aug 20, 2025
4 of 7 checks passed
@joaquimg joaquimg deleted the ar/newdo branch August 20, 2025 00:30
joaquimg added a commit that referenced this pull request Aug 20, 2025
* initial sketch

* rm method

* add JuMP API and test it

* add diff_model test

* Fix conic error (#284)

* fix conic error

* use jump psd problem

* [docs] update to Documenter@1 (#286)

* [docs] update to Documenter@1

* Update

* update

* format

* Pass attributes through Objective.FunctionConversionBridge (#287)

* Pass attributes through Objective.FunctionConversionBridge

* Fix

* add test

* fix tol

* fix test

* add reverse test

---------

Co-authored-by: joaquimg <[email protected]>

* bump POI

* cleanup

---------

Co-authored-by: Oscar Dowson <[email protected]>
Co-authored-by: Benoît Legat <[email protected]>
Co-authored-by: joaquimg <[email protected]>

* fix parameters support

* Update jump-api pr (#294)

* prepare more tests

* sketch

* temp examples

* remove printing

* remove printing

* remove duplicatie def

* move definition

* format

* format

* simplify conic model

* force nlp on nlp tests

* fix param tests

* cleanup parameter usage

* remove code

* cleanup usage of parameters

* format

* add temp dep

* format

* add temp dep

* fix PSDSquare

* temp fix for tests

* format

* Improve name handling, cleanup parameter error messages, remove slack

* re-enable constraint names

* Integrate new POI (#302)

* integrate new POI

* remove test

* rm adhoc pkg add

* fix docs

* add POI test and docs

* rm test_solve_conflict

* format

* add parameter in cone test

* add back name constraint vect

* Update Project.toml

---------

Co-authored-by: Joaquim <[email protected]>

* add tests

* format

---------

Co-authored-by: Andrew Rosemberg <[email protected]>
Co-authored-by: Oscar Dowson <[email protected]>
Co-authored-by: Benoît Legat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants