Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jormungandr cart-pole test reports infeasible #275

Closed
Glaycia opened this issue Dec 22, 2023 · 3 comments · Fixed by #371
Closed

Jormungandr cart-pole test reports infeasible #275

Glaycia opened this issue Dec 22, 2023 · 3 comments · Fixed by #371
Labels
bug Something isn't working

Comments

@Glaycia
Copy link
Contributor

Glaycia commented Dec 22, 2023

Copied the file jormungandr/test/optimization/cart_pole_problem_test.py, removed the asserts and then just ran test_direct_transcription() as main.

Threw error error: numpy method __call__, ufunc <ufunc 'matmul'> not implemented for VariableBlock

@calcmogul
Copy link
Member

We may need to apply the VariableMatrix binding change in #263 to VariableBlock as well.

@calcmogul calcmogul added the bug Something isn't working label Dec 22, 2023
@calcmogul calcmogul changed the title Jormungandr Cartpole Test Problem throws error Jormungandr cart-pole test throws error Dec 22, 2023
@calcmogul
Copy link
Member

The original issue has been resolved, but the cart-pole problem solve still fails.

The cost function is quadratic.
The equality constraints are nonlinear.
The inequality constraints are linear.

Number of decision variables: 504
Number of equality constraints: 408
Number of inequality constraints: 402

Error tolerance: 1e-08

iter    time (ms)       error               cost        infeasibility
======================================================================
   0     39.844              nan     -5.342556e+01                nan

Solve time: 46.223 ms
  ↳ 6.369 ms (IPM setup)
  ↳ 39.854 ms (1 IPM iterations; 39.854 ms average)

autodiff  setup (ms)  avg solve (ms)  solves
============================================
   ∇f(x)       0.016           0.006       2
   ∇²ₓₓL       0.758           0.602       2
  ∂cₑ/∂x       0.925           0.565       2
  ∂cᵢ/∂x       0.066               0       0

Exit condition: solved to desired tolerance

@calcmogul calcmogul changed the title Jormungandr cart-pole test throws error Jormungandr cart-pole test gets the wrong answer Dec 23, 2023
@calcmogul calcmogul changed the title Jormungandr cart-pole test gets the wrong answer Jormungandr cart-pole test reports infeasible Jan 22, 2024
@calcmogul
Copy link
Member

calcmogul commented Jan 22, 2024

Now the Python test reports infeasible (see below). Note that the C++ test finds the correct solution in 113 iterations.

The cost function is quadratic.
The equality constraints are nonlinear.
The inequality constraints are linear.

Number of decision variables: 504
Number of equality constraints: 408
Number of inequality constraints: 402

Error tolerance: 1e-08

iter   time (ms)      error          cost       infeasibility
=============================================================
   0       2.352   1.802871e+00   0.000000e+00   4.912584e+00
   1       2.263   1.000948e-01   0.000000e+00   4.141593e+00
   2       2.258   3.098117e-02   0.000000e+00   4.141593e+00
   3       2.219   3.104221e-02   0.000000e+00   4.141593e+00
iter   time (ms)      error          cost       infeasibility
=============================================================
   0r      3.709   1.998022e+01  -1.648905e+06   5.864412e+03
   1r      3.287   1.174917e+01  -9.695537e+05   3.448510e+03
   2r      3.272   3.928488e+00  -3.216111e+05   1.153054e+03
   3r      3.261   4.750322e-01  -3.512783e+04   1.394271e+02
   4r      3.262   1.645289e-01  -9.441205e+03   4.829104e+01
   5r      3.251   5.652256e-02  -5.220497e+02   1.658999e+01
   6r      3.270   9.720567e-03   3.342871e+03   2.853093e+00
   7r      3.268   3.534465e-04   4.112756e+03   1.037404e-01
   8r      3.258   4.086055e-06   4.141262e+03   1.199302e-03
   9r      3.226   6.818949e-09   4.141592e+03   2.001436e-06

Solve time: 100.768 ms
  ↳ 4.097 ms (solver setup)
  ↳ 96.670 ms (4 solver iterations; 24.168 ms average)

autodiff   setup (ms)   avg solve (ms)   solves
===============================================
 ∇f(x)          0.006            0.006        6
 ∇²ₓₓL          0.451            0.332        5
 ∂cₑ/∂x         0.539            0.351        6
 ∂cᵢ/∂x         0.039            0.000        0

Exit condition: problem is locally infeasible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants