Skip to content

Optimization tests construct incomplete parameters for expression trajectories #4925

Description

@ChrisRackauckas-Claude

Summary

The Optimization test group fails on clean ModelingToolkit master d7f3ad523c00b4150281f259d1e97618fba79982 in the Expression-valued initial trajectories testset. A directly constructed MTKParameters omits the generated parameter var"v#0"(t) created by mtkcompile.

This is not caused by the ModelingToolkitBase version bump in #4920. The same failure was already present in the Julia 1 job for the feature PR that introduced the test: #4839 and https://github.com/SciML/ModelingToolkit.jl/actions/runs/31177291039/job/92863220273.

Clean reproduction

From an unmodified checkout at d7f3ad523c00b4150281f259d1e97618fba79982, on Julia 1.12.6:

$ GROUP=Optimization julialauncher +1.12 --project -e 'using Pkg; Pkg.test()'
Expression-valued initial trajectories: Error During Test at .../dynamic_optimization.jl:858
  Got exception outside of a @test
  Some parameters are missing from the variable map.
  Please provide a value or default for the following variables:

  var"v#0"(t)

Test Summary:                              | Pass  Error  Broken  Total      Time
Optimization                               |  184      1       1    186  23m36.4s
ERROR: Some tests did not pass: 184 passed, 0 failed, 1 errored, 1 broken.

The current downstream jobs fail identically:

Diagnosis

The test compiles systems in which structural processing introduces a generated parameter for the constant/input-like v(t). It then bypasses the same problem-processing path that successfully compiled and evaluated the initial trajectories:

p_test = MTKParameters(block, parammap)

Changing only that line to p_test = iprob.p is necessary but insufficient. A full local rerun still produced 184 passed, 1 errored, 1 broken after 25m18.3s. That replacement advances through the two fx assertions, two constant-expression assertions, and callable-rejection assertion, but the later independent system repeats the same pattern:

MTKParameters(psys, [a => 4.0])

After the first replacement, the testset again reports exactly 9 passes before the error, locating the remaining failure before the subsequent fp assertion. process_DynamicOptProblem already obtains a complete parameter object through process_SciMLProblem, and the initial-trajectory path successfully calls build_trajectory_function(..., p) with it.

The focused fix should use processed public problem parameters for both checks, for example iprob.p for the first system and the p field of an ODEProblem constructed with x(t), v(t), and a values for psys. This second adjustment has not yet completed full Optimization and QA validation, so no fix branch was pushed.

Expected behavior

The expression-valued trajectory tests should exercise build_trajectory_function with parameter objects produced by the public problem-construction paths, including all generated parameters, and the full Optimization group should pass on Julia 1 and pre-release Julia.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions