Skip to content

Better error message for missing guesses #3449

@AayushSabharwal

Description

@AayushSabharwal

Currently errors for missing guesses say "missing initial value" or "circular initial condition" (depending on where it originates). See:

ERROR: LoadError: Found symbolic value <<VALUE>> for variable <<VARIABLE>>. You may be missing an initial condition or have cyclic initial conditions. If this is intended, pass `symbolic_u0 = true`. In case the initial conditions are not cyclic but require more substitutions to resolve, increase `substitution_limit`. To report cycles in initial conditions of unknowns/parameters, pass `warn_cyclic_dependency = true`. If the cycles are still not reported, you may need to pass a larger value for `circular_dependency_max_cycle_length` or `circular_dependency_max_cycles`.


Stacktrace:
  [1] better_varmap_to_vars(varmap::Dict{Any, Any}, vars::Vector{SymbolicUtils.BasicSymbolic{Real}}; tofloat::Bool, use_union::Bool, container_type::Type, toterm::Function, promotetoconcrete::Nothing, check::Bool, allow_symbolic::Bool)
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/41wGH/src/systems/problem_utils.jl:340
  [2] process_SciMLProblem(constructor::Type, sys::ModelingToolkit.NonlinearSystem, u0map::Dict{Any, Any}, pmap::Dict{Any, Any}; build_initializeprob::Bool, implicit_dae::Bool, t::Nothing, guesses::Dict{Any, Any}, warn_initialize_determined::Bool, initialization_eqs::Vector{Any}, eval_expression::Bool, eval_module::Module, fully_determined::Nothing, check_initialization_units::Bool, tofloat::Bool, use_union::Bool, u0_constructor::typeof(identity), du0map::Nothing, check_length::Bool, symbolic_u0::Bool, warn_cyclic_dependency::Bool, circular_dependency_max_cycle_length::Int64, circular_dependency_max_cycles::Int64, substitution_limit::Int64, use_scc::Bool, kwargs::@Kwargs{})
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/41wGH/src/systems/problem_utils.jl:720

This error message should instead report a missing guess, since it is currently very misleading. The only way for a user to differentiate is via the stacktrace, which is bad for any number of reasons.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions