Giter Club home page Giter Club logo

Comments (11)

ChrisRackauckas avatar ChrisRackauckas commented on June 16, 2024

Is there an MWE for this? It would be good to track this down. I don't see how Pantelides is involved, it should just be tearing.

CC @YingboMa

from optimization.jl.

ccoffrin avatar ccoffrin commented on June 16, 2024

Should be able to be reproduced with this script, https://github.com/lanl-ansi/rosetta-opf/blob/main/test/runtests.jl with latest tagged releases.

from optimization.jl.

YingboMa avatar YingboMa commented on June 16, 2024

Do you have an MWE? How can you even run it with the latest MTK?

(rosetta-opf) pkg> dev ModelingToolkit
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package NonconvexUtils [c48e48a2]:
 NonconvexUtils [c48e48a2] log:
 ├─possible versions are: 0.1.0-0.4.1 or uninstalled
 ├─restricted by compatibility requirements with Symbolics [0c5d862f] to versions: 0.1.0-0.1.3 or uninstalled
 │ └─Symbolics [0c5d862f] log:
 │   ├─possible versions are: 0.1.0-5.3.1 or uninstalled
 │   ├─restricted to versions 5 by ModelingToolkit [961ee093], leaving only versions: 5.0.0-5.3.1
 │   │ └─ModelingToolkit [961ee093] log:
 │   │   ├─possible versions are: 8.56.0 or uninstalled
 │   │   └─ModelingToolkit [961ee093] is fixed to version 8.56.0
 │   └─restricted by compatibility requirements with DomainSets [5b8099bc] to versions: [0.1.0-0.1.26, 5.2.0-5.3.1] or uninstalled, leaving only versions: 5.2.0-5.3.1
 │     └─DomainSets [5b8099bc] log:
 │       ├─possible versions are: 0.0.1-0.6.6 or uninstalled
 │       └─restricted to versions 0.6 by ModelingToolkit [961ee093], leaving only versions: 0.6.0-0.6.6
 │         └─ModelingToolkit [961ee093] log: see above
 └─restricted by compatibility requirements with Nonconvex [01bcebdf] to versions: 0.4.0-0.4.1 — no versions left
   └─Nonconvex [01bcebdf] log:
     ├─possible versions are: 0.1.0-2.1.2 or uninstalled
     └─restricted to versions 2 by an explicit requirement, leaving only versions: 2.0.0-2.1.2

from optimization.jl.

ccoffrin avatar ccoffrin commented on June 16, 2024

Here is how you can setup an environment just for the Optimization example,

] add PowerModels, Optimization, OptimizationMOI, ModelingToolkit, Ipopt

This resulted in the following versions,

  [b6b21f68] Ipopt v1.2.1
  [961ee093] ModelingToolkit v8.57.0
  [7f7a1694] Optimization v3.14.1
  [fd9f6733] OptimizationMOI v0.1.13
  [c36e90e8] PowerModels v0.19.9

Then run,

include("optimization.jl"); solve_opf("$(@__DIR__)/data/pglib_opf_case5_pjm.m")

I get the following error,

ERROR: InvalidSystemException: System is structurally singular
Stacktrace:
  [1] pantelides!(state::ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.NonlinearSystem}; finalize::Bool, maxiters::Int64)
    @ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/b9DXJ/src/structural_transformation/pantelides.jl:140
  [2] pantelides!
    @ ~/.julia/packages/ModelingToolkit/b9DXJ/src/structural_transformation/pantelides.jl:126 [inlined]
  [3] dummy_derivative_graph!(state::ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.NonlinearSystem}, jac::Function; state_priority::Function, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/b9DXJ/src/structural_transformation/partial_state_selection.jl:156
  [4] dummy_derivative_graph!
    @ ~/.julia/packages/ModelingToolkit/b9DXJ/src/structural_transformation/partial_state_selection.jl:152 [inlined]
  [5] dummy_derivative(sys::ModelingToolkit.NonlinearSystem, state::ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.NonlinearSystem}; simplify::Bool, mm::ModelingToolkit.SparseMatrixCLIL{Int64, Int64}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/b9DXJ/src/structural_transformation/symbolics_tearing.jl:633
  [6] _structural_simplify!(state::ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.NonlinearSystem}, io::Nothing; simplify::Bool, check_consistency::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ModelingToolkit.SystemStructures ~/.julia/packages/ModelingToolkit/b9DXJ/src/systems/systemstructure.jl:609
  [7] _structural_simplify!
    @ ~/.julia/packages/ModelingToolkit/b9DXJ/src/systems/systemstructure.jl:597 [inlined]
  [8] #structural_simplify!#23
    @ ~/.julia/packages/ModelingToolkit/b9DXJ/src/systems/systemstructure.jl:590 [inlined]
  [9] structural_simplify(sys::ModelingToolkit.NonlinearSystem, io::Nothing; simplify::Bool, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:check_consistency,), Tuple{Bool}}})
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/b9DXJ/src/systems/systems.jl:39
 [10] structural_simplify (repeats 2 times)
    @ ~/.julia/packages/ModelingToolkit/b9DXJ/src/systems/systems.jl:19 [inlined]
 [11] structural_simplify(sys::ModelingToolkit.OptimizationSystem; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/b9DXJ/src/systems/optimization/optimizationsystem.jl:612
 [12] structural_simplify
    @ ~/.julia/packages/ModelingToolkit/b9DXJ/src/systems/optimization/optimizationsystem.jl:599 [inlined]
 [13] instantiate_function(f::Function, cache::Optimization.ReInitCache{Vector{Float64}, SciMLBase.NullParameters}, adtype::Optimization.AutoModelingToolkit, num_cons::Int64)
    @ Optimization ~/.julia/packages/Optimization/Dzv2g/src/function/mtk.jl:94
 [14] OptimizationMOI.MOIOptimizationNLPCache(prob::SciMLBase.OptimizationProblem{true, SciMLBase.OptimizationFunction{true, Optimization.AutoModelingToolkit, var"#opf_objective#61"{Dict{String, Int64}, Dict{Symbol, Any}}, Nothing, Nothing, Nothing, var"#opf_constraints#62"{Dict{String, Int64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Symbol, Any}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Vector{Float64}, Vector{Float64}, Nothing, Vector{Float64}, Vector{Float64}, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::Ipopt.Optimizer; kwargs::Base.Pairs{Symbol, Nothing, NTuple{4, Symbol}, NamedTuple{(:maxiters, :maxtime, :abstol, :reltol), NTuple{4, Nothing}}})
    @ OptimizationMOI ~/.julia/packages/OptimizationMOI/d6uRx/src/nlp.jl:88
 [15] MOIOptimizationNLPCache
    @ ~/.julia/packages/OptimizationMOI/d6uRx/src/nlp.jl:84 [inlined]
 [16] #__init#34
    @ ~/.julia/packages/OptimizationMOI/d6uRx/src/OptimizationMOI.jl:224 [inlined]
 [17] __init
    @ ~/.julia/packages/OptimizationMOI/d6uRx/src/OptimizationMOI.jl:216 [inlined]
 [18] #init#555
    @ ~/.julia/packages/SciMLBase/qp2gL/src/solve.jl:148 [inlined]
 [19] init
    @ ~/.julia/packages/SciMLBase/qp2gL/src/solve.jl:146 [inlined]
 [20] solve(::SciMLBase.OptimizationProblem{true, SciMLBase.OptimizationFunction{true, Optimization.AutoModelingToolkit, var"#opf_objective#61"{Dict{String, Int64}, Dict{Symbol, Any}}, Nothing, Nothing, Nothing, var"#opf_constraints#62"{Dict{String, Int64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Symbol, Any}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Vector{Float64}, Vector{Float64}, Nothing, Vector{Float64}, Vector{Float64}, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::Ipopt.Optimizer; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ SciMLBase ~/.julia/packages/SciMLBase/qp2gL/src/solve.jl:83
 [21] solve(::SciMLBase.OptimizationProblem{true, SciMLBase.OptimizationFunction{true, Optimization.AutoModelingToolkit, var"#opf_objective#61"{Dict{String, Int64}, Dict{Symbol, Any}}, Nothing, Nothing, Nothing, var"#opf_constraints#62"{Dict{String, Int64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Int64, Float64}, Dict{Symbol, Any}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Vector{Float64}, Vector{Float64}, Nothing, Vector{Float64}, Vector{Float64}, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::Ipopt.Optimizer)
    @ SciMLBase ~/.julia/packages/SciMLBase/qp2gL/src/solve.jl:80
 [22] solve_opf(file_name::String)
    @ Main ~/Documents/dev/rosetta-opf/optimization.jl:340
 [23] top-level scope
    @ REPL[4]:1

from optimization.jl.

YingboMa avatar YingboMa commented on June 16, 2024

The fix of this particular bug is in SciML/ModelingToolkit.jl#2175 . However, the use of structural_simplify is wrong in Optimization.jl as well. See #539. So unfortunately, we have to disable the structural_simplify feature for the moment.

from optimization.jl.

ccoffrin avatar ccoffrin commented on June 16, 2024

Ok, in terms of getting this optimization.jl script working are you suggesting to wait for new releases to be tagged with these fixes or should the script be changed to disable the structural_simplify feature?

from optimization.jl.

YingboMa avatar YingboMa commented on June 16, 2024

It should be fixed in the new release.

from optimization.jl.

ccoffrin avatar ccoffrin commented on June 16, 2024

I can confirm the code is running.

FYI, the type of sol.retcode has changed from :LOCALLY_SOLVED (an Ipopt status code) to Success an enum from SciMLBase.ReturnCode, which is a breaking change unless the original return type was a bug.

from optimization.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 16, 2024

The original one was a bug.

from optimization.jl.

odow avatar odow commented on June 16, 2024

The original one was a bug.

This was a major motivation for MOI having a standardized set of tests that run across all solvers to check that they all uniformly implement the API. I guess it's a bit harder to do for Optimization.jl, but it might be worth looking into.

from optimization.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 16, 2024

We're getting there. But something like this isn't about tests, it's stricter type information. https://github.com/SciML/SciMLBase.jl/blob/master/src/solutions/optimization_solutions.jl#L26 sol.retcode is forced to be a ReturnCode.T so this forces that standardization. Optimization.jl still has quite a ways to go, probably like a year before it's really ready for the interface it needs, but until then it's at least useful.

from optimization.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.