openscvx 2.dev5__tar.gz → 2.dev6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openscvx-2.dev5/openscvx.egg-info → openscvx-2.dev6}/PKG-INFO +1 -1
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/__init__.py +2 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/_version.py +3 -3
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/algorithms/__init__.py +13 -4
- openscvx-2.dev6/openscvx/algorithms/autotuner/__init__.py +17 -0
- openscvx-2.dev6/openscvx/algorithms/autotuner/adaptive_proximal_weight.py +190 -0
- {openscvx-2.dev5/openscvx/algorithms → openscvx-2.dev6/openscvx/algorithms/autotuner}/augmented_lagrangian.py +9 -5
- {openscvx-2.dev5/openscvx/algorithms → openscvx-2.dev6/openscvx/algorithms/autotuner}/constant_proximal_weight.py +3 -3
- {openscvx-2.dev5/openscvx/algorithms → openscvx-2.dev6/openscvx/algorithms/autotuner}/ramp_proximal_weight.py +3 -3
- openscvx-2.dev6/openscvx/algorithms/scvx/__init__.py +5 -0
- {openscvx-2.dev5/openscvx/algorithms → openscvx-2.dev6/openscvx/algorithms/scvx}/penalized_trust_region.py +6 -6
- {openscvx-2.dev5 → openscvx-2.dev6/openscvx.egg-info}/PKG-INFO +1 -1
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx.egg-info/SOURCES.txt +7 -4
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_autotuning.py +196 -4
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_brachistochrone.py +3 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/assets/logo.svg +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/release-drafter.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/_docs.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/branch-name.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/docs.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/lint.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/nightly.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/release-drafter.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/release.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/tests-integration.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.github/workflows/tests-unit.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.gitignore +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/.gitmodules +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/CONTRIBUTING.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/LICENSE +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/README.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/Foundations/constraint_reformulation.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/Foundations/control_parameterization.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/Foundations/discretization.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/Foundations/ocp.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/Foundations/scvx.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/Foundations/time_dilation.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UnderTheHood/lowering_architecture.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UnderTheHood/vectorization_and_vmapping.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/00_introduction.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/01_hello_world_brachistochrone.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/02_drone_racing_constraints.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/03_obstacle_avoidance_vmap.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/04_viewpoint_constraints.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/05_visualization.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/06_logic.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/07_lie.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/UsersGuide/08_mpcc.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/favicon.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/images/ct-scvx_dark.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/images/ct-scvx_light.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/images/ctcs_dark.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/images/ctcs_light.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/images/problem_class_dark.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/images/problem_class_light.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/logo.svg +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/openscvx_logo_square.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/viser-client/index.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/viser-recordings/drone_racing.viser +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/assets/viser-recordings/franka_fr3v2_pick_place.viser +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/citation.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/examples.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/index.md +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/javascripts/mathjax.js +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/docs/versions.json +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/_viser_embed_export.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/abstract/brachistochrone.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/abstract/hypersensitive.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/abstract/impulsive.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/abstract/stl_integer_variable.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/abstract/stl_or.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/7_dof_arm.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/_camera.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/_render.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/_sensor_view.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/dr_vp_polytope.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/franka_fr3v2_pick_place.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/logo.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/animations/obstacle_avoidance_vmap.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/arm/3_dof_arm.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/arm/7_dof_arm.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/arm/7_dof_arm_collision.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/arm/7_dof_arm_vp.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/arm/franka_fr3v2_pick_place.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/arm/franka_fr3v2_viewplanning.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/car/dubins_car.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/car/dubins_car_disjoint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/car/dubins_car_obstacle_conditional.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/car/dubins_car_obstacle_stl.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/car/dubins_car_stl_or.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/car/dubins_car_waypoint_stl.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/cinema_vp.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/dr_double_integrator.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/dr_vp.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/dr_vp_nodal.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/dr_vp_polytope.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/drone_racing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/logo.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/logo_utils/acl_logo.svg +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/logo_utils/svg_path_utils.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/obstacle_avoidance.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/obstacle_avoidance_nodal.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/drone/obstacle_avoidance_vmap.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mjx/cartpole_mjx.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mjx/double_cartpole_mjx.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mjx/skydio_x2_mjx.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mjx/triple_cartpole_3d_mjx.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mjx/triple_cartpole_game.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mjx/triple_cartpole_mjx.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mpc/double_integrator_discrete.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mpc/double_integrator_drone_racing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mpc/dubins_car_circle_analytical.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mpc/dubins_car_circle_discrete.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/mpc/realtime_double_integrator_drone_racing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/plotting.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/plotting_viser.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/3DoF_pdg_realtime.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/6DoF_pdg_realtime.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/base_problems/3DoF_pdg_realtime_base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/base_problems/6DoF_pdg_realtime_base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/base_problems/cinema_vp_realtime_base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/base_problems/drone_racing_realtime_base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/base_problems/dubins_car_realtime_base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/base_problems/obstacle_avoidance_realtime_base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/cinema_vp_realtime.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/drone_racing_realtime.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/dubins_car_realtime.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/realtime/obstacle_avoidance_realtime.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/rocket/3DoF_pdg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/rocket/6DoF_pdg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/spacecraft/halo_orbit.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/spacecraft/hohmann_transfer.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/spacecraft/let_transfer.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/examples/spacecraft/proxops_cw.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/ctlos_cine.gif +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/ctlos_dr.gif +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/dtlos_cine.gif +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/dtlos_dr.gif +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/openscvx_logo.svg +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/openscvx_logo_square.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/oscvx_structure_full_dark.svg +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/figures/video_preview.png +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/assets/stylesheets/custom.css +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/assets/stylesheets/home-dropin.css +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/assets/stylesheets/home-hero.css +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/assets/stylesheets/home-viser.css +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/home.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/main.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/partials/home-diagram.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/partials/home-dropin-banner.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/partials/home-hero.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/partials/home-pipeline.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/material/overrides/partials/home-viser-strip.html +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/mkdocs.yml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/__main__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/algorithms/base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/algorithms/optimization_results.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/algorithms/weights.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/config.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/discretize_linearize.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/linearize_discretize.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/linearize_discretize_sparse.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/sparse_utils/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/sparse_utils/bcoo_helpers.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/discretization/sparse_utils/sparse_jacobian.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/expert/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/expert/byof.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/expert/lowering.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/expert/validation.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/init/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/init/interpolation.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/init/inverse_kinematics.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/integrations/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/integrations/base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/integrations/menagerie.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/integrations/mjx.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/integrators/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/integrators/diffrax.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/integrators/runge_kutta.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/loader.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/cvxpy_constraints.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/cvxpy_variables.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/dynamics.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/jax_constraints.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/parameters.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/problem.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/lowered/unified.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/plotting.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/scp_iteration.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/viser/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/viser/animated.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/viser/orbits.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/viser/plotly_integration.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/viser/primitives.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/viser/scp.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/plotting/viser/server.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/problem.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/propagation/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/propagation/post_processing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/propagation/propagation.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/solvers/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/solvers/base.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/solvers/ptr_solver.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/augmentation.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/builder.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/constraint_set.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/arithmetic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/array.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/constraint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/control.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/expr.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/lie/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/lie/adjoint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/lie/se3.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/lie/so3.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/linalg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/logic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/math.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/parameter.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/spatial.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/state.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/stl.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/stljax.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/time.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/variable.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/expr/vmap.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/hashing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lower.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/_lowerer.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/_registry.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/arithmetic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/array.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/constraint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/control.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/expr.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/linalg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/logic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/math.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/cvxpy/state.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/_lowerer.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/_registry.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/arithmetic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/array.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/constraint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/control.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/expr.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/lie.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/linalg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/logic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/math.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/spatial.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/state.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/stl.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/stljax.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/lowerers/jax/vmap.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/_registry.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/array.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/constraint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/lie.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/linalg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/logic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/math.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/parser.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/spatial.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/stl.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/stljax.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/parser/tokenizer.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/preprocessing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/problem.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/sparsity.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/symbolic/unified.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/utils/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/utils/cache.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/utils/caching.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/utils/printing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/utils/profiling.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx/utils/utils.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx.egg-info/dependency_links.txt +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx.egg-info/entry_points.txt +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx.egg-info/requires.txt +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/openscvx.egg-info/top_level.txt +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/pyproject.toml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/scripts/gen_example_pages.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/scripts/gen_ref_pages.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/scripts/mkdocs_copy_viser_client_hook.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/setup.cfg +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/brachistochrone_analytical.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/expr/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/expr/test_gmsr.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/fixtures/brachistochrone.json +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/fixtures/brachistochrone.yaml +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/hohmann_analytical.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/integrations/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/integrations/test_mjx.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/integrations/test_mjx_dynamics.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_arithmetic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_array.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_constraint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_expr.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_lie.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_linalg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_logic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_math.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_node_reference.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_parameters.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_scaling.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_spatial.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_stl.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_variable.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/expr/test_vmap.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/__init__.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_array.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_constraint.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_lie.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_linalg.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_load.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_logic.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_math.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_parser.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_spatial.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_stl.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_tokenizer.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/parser/test_vmap.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/test_augmentation.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/test_hashing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/test_lower_cvxpy.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/test_lower_jax.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/test_preprocessing.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/test_sparsity.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/symbolic/test_unified.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_cvxpygen_optional.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_discretization.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_examples.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_expert.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_impulsive.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_init.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_integrators.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_loader.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_optimization_results.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_plotting.py +0 -0
- {openscvx-2.dev5 → openscvx-2.dev6}/tests/test_propagation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openscvx
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.dev6
|
|
4
4
|
Summary: A general Python-based successive convexification implementation which uses a JAX backend.
|
|
5
5
|
Author-email: Chris Hayner and Griffin Norris <haynec@uw.edu>
|
|
6
6
|
License: Apache Software License
|
|
@@ -12,6 +12,7 @@ import openscvx.symbolic.expr.spatial as spatial
|
|
|
12
12
|
import openscvx.symbolic.expr.stl as stl
|
|
13
13
|
import openscvx.symbolic.expr.stljax as stljax
|
|
14
14
|
from openscvx.algorithms import (
|
|
15
|
+
AdaptiveProximalWeight,
|
|
15
16
|
AugmentedLagrangian,
|
|
16
17
|
ConstantProximalWeight,
|
|
17
18
|
PenalizedTrustRegion,
|
|
@@ -190,6 +191,7 @@ __all__ = [
|
|
|
190
191
|
# Algorithm & Autotuning
|
|
191
192
|
"PenalizedTrustRegion",
|
|
192
193
|
"AugmentedLagrangian",
|
|
194
|
+
"AdaptiveProximalWeight",
|
|
193
195
|
"ConstantProximalWeight",
|
|
194
196
|
"RampProximalWeight",
|
|
195
197
|
]
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, '
|
|
21
|
+
__version__ = version = '2.dev6'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 'dev6')
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'gcabefce07'
|
|
@@ -82,12 +82,19 @@ from typing import Annotated, Any, Dict, List, Optional, Union
|
|
|
82
82
|
|
|
83
83
|
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
84
84
|
|
|
85
|
-
from .
|
|
85
|
+
from .autotuner import (
|
|
86
|
+
AdaptiveProximalWeight,
|
|
87
|
+
AdaptiveProximalWeightSpec,
|
|
88
|
+
AugmentedLagrangian,
|
|
89
|
+
AugmentedLagrangianSpec,
|
|
90
|
+
ConstantProximalWeight,
|
|
91
|
+
ConstantProximalWeightSpec,
|
|
92
|
+
RampProximalWeight,
|
|
93
|
+
RampProximalWeightSpec,
|
|
94
|
+
)
|
|
86
95
|
from .base import Algorithm, AlgorithmState, AutotuningBase, DiscretizationResult
|
|
87
|
-
from .constant_proximal_weight import ConstantProximalWeight, ConstantProximalWeightSpec
|
|
88
96
|
from .optimization_results import OptimizationResults
|
|
89
|
-
from .
|
|
90
|
-
from .ramp_proximal_weight import RampProximalWeight, RampProximalWeightSpec
|
|
97
|
+
from .scvx import PenalizedTrustRegion
|
|
91
98
|
from .weights import Weights
|
|
92
99
|
|
|
93
100
|
# ---------------------------------------------------------------------------
|
|
@@ -97,6 +104,7 @@ from .weights import Weights
|
|
|
97
104
|
AutotunerConfig = Annotated[
|
|
98
105
|
Union[
|
|
99
106
|
AugmentedLagrangianSpec,
|
|
107
|
+
AdaptiveProximalWeightSpec,
|
|
100
108
|
RampProximalWeightSpec,
|
|
101
109
|
ConstantProximalWeightSpec,
|
|
102
110
|
],
|
|
@@ -173,6 +181,7 @@ __all__ = [
|
|
|
173
181
|
"PenalizedTrustRegion",
|
|
174
182
|
"AutotuningBase",
|
|
175
183
|
"AugmentedLagrangian",
|
|
184
|
+
"AdaptiveProximalWeight",
|
|
176
185
|
"ConstantProximalWeight",
|
|
177
186
|
"RampProximalWeight",
|
|
178
187
|
# Config models
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""SCP weight autotuning strategies."""
|
|
2
|
+
|
|
3
|
+
from .adaptive_proximal_weight import AdaptiveProximalWeight, AdaptiveProximalWeightSpec
|
|
4
|
+
from .augmented_lagrangian import AugmentedLagrangian, AugmentedLagrangianSpec
|
|
5
|
+
from .constant_proximal_weight import ConstantProximalWeight, ConstantProximalWeightSpec
|
|
6
|
+
from .ramp_proximal_weight import RampProximalWeight, RampProximalWeightSpec
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"AdaptiveProximalWeight",
|
|
10
|
+
"AdaptiveProximalWeightSpec",
|
|
11
|
+
"AugmentedLagrangian",
|
|
12
|
+
"AugmentedLagrangianSpec",
|
|
13
|
+
"ConstantProximalWeight",
|
|
14
|
+
"ConstantProximalWeightSpec",
|
|
15
|
+
"RampProximalWeight",
|
|
16
|
+
"RampProximalWeightSpec",
|
|
17
|
+
]
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"""Autotuning functions for SCP (Successive Convex Programming) parameters."""
|
|
2
|
+
|
|
3
|
+
from copy import deepcopy
|
|
4
|
+
from typing import TYPE_CHECKING, Literal
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
from pydantic import BaseModel, ConfigDict
|
|
8
|
+
|
|
9
|
+
from openscvx.config import Config
|
|
10
|
+
|
|
11
|
+
from ..base import AutotuningBase
|
|
12
|
+
from .augmented_lagrangian import AugmentedLagrangian
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from openscvx.lowered import LoweredJaxConstraints
|
|
16
|
+
|
|
17
|
+
from ..base import AlgorithmState, CandidateIterate
|
|
18
|
+
from ..weights import Weights
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AdaptiveProximalWeight(AutotuningBase):
|
|
22
|
+
"""PTR-style proximal adaptation with fixed virtual penalty weights.
|
|
23
|
+
|
|
24
|
+
Same acceptance-ratio logic as :class:`AugmentedLagrangian` for ``lam_prox``,
|
|
25
|
+
but ``lam_vc`` and ``lam_vb_*`` are held constant at their current state values.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
COLUMNS = AugmentedLagrangian.COLUMNS
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
gamma_1: float = 2.0,
|
|
33
|
+
gamma_2: float = 0.5,
|
|
34
|
+
eta_0: float = 1e-2,
|
|
35
|
+
eta_1: float = 1e-1,
|
|
36
|
+
eta_2: float = 0.8,
|
|
37
|
+
lam_prox_min: float = 1e-3,
|
|
38
|
+
lam_prox_max: float = 1e4,
|
|
39
|
+
lam_cost_drop: int = -1,
|
|
40
|
+
lam_cost_relax: float = 1.0,
|
|
41
|
+
):
|
|
42
|
+
self.gamma_1 = gamma_1
|
|
43
|
+
self.gamma_2 = gamma_2
|
|
44
|
+
self.eta_0 = eta_0
|
|
45
|
+
self.eta_1 = eta_1
|
|
46
|
+
self.eta_2 = eta_2
|
|
47
|
+
self.lam_prox_min = lam_prox_min
|
|
48
|
+
self.lam_prox_max = lam_prox_max
|
|
49
|
+
self.lam_cost_drop = lam_cost_drop
|
|
50
|
+
self.lam_cost_relax = lam_cost_relax
|
|
51
|
+
|
|
52
|
+
@staticmethod
|
|
53
|
+
def _copy_virtual_weights(
|
|
54
|
+
candidate: "CandidateIterate",
|
|
55
|
+
state: "AlgorithmState",
|
|
56
|
+
) -> None:
|
|
57
|
+
candidate.lam_vc = state.lam_vc
|
|
58
|
+
candidate.lam_vb_nodal = state.lam_vb_nodal
|
|
59
|
+
candidate.lam_vb_cross = state.lam_vb_cross
|
|
60
|
+
|
|
61
|
+
def update_weights(
|
|
62
|
+
self,
|
|
63
|
+
state: "AlgorithmState",
|
|
64
|
+
candidate: "CandidateIterate",
|
|
65
|
+
nodal_constraints: "LoweredJaxConstraints",
|
|
66
|
+
settings: Config,
|
|
67
|
+
params: dict,
|
|
68
|
+
weights: "Weights",
|
|
69
|
+
) -> str:
|
|
70
|
+
"""Update SCP proximal weight based on acceptance ratio; keep VC/VB fixed."""
|
|
71
|
+
candidate_x_prop = (
|
|
72
|
+
candidate.x_prop_plus[1:] if candidate.x_prop_plus is not None else candidate.x_prop
|
|
73
|
+
)
|
|
74
|
+
(
|
|
75
|
+
nonlinear_cost,
|
|
76
|
+
nonlinear_penalty,
|
|
77
|
+
nodal_penalty,
|
|
78
|
+
) = self.calculate_nonlinear_penalty(
|
|
79
|
+
candidate_x_prop,
|
|
80
|
+
candidate.x,
|
|
81
|
+
candidate.u,
|
|
82
|
+
state.lam_vc,
|
|
83
|
+
state.lam_vb_nodal,
|
|
84
|
+
state.lam_vb_cross,
|
|
85
|
+
state.lam_cost,
|
|
86
|
+
nodal_constraints,
|
|
87
|
+
params,
|
|
88
|
+
settings,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
candidate.J_nonlin = nonlinear_cost + nonlinear_penalty + nodal_penalty
|
|
92
|
+
|
|
93
|
+
if state.k > self.lam_cost_drop:
|
|
94
|
+
candidate.lam_cost = state.lam_cost * self.lam_cost_relax
|
|
95
|
+
else:
|
|
96
|
+
candidate.lam_cost = weights.lam_cost
|
|
97
|
+
|
|
98
|
+
lam_prox_k = deepcopy(state.lam_prox)
|
|
99
|
+
|
|
100
|
+
if state.k > 1:
|
|
101
|
+
state_x_prop_plus = state.x_prop_plus()
|
|
102
|
+
state_x_prop = (
|
|
103
|
+
state_x_prop_plus[1:] if state_x_prop_plus is not None else state.x_prop()
|
|
104
|
+
)
|
|
105
|
+
(
|
|
106
|
+
prev_nonlinear_cost,
|
|
107
|
+
prev_nonlinear_penalty,
|
|
108
|
+
prev_nodal_penalty,
|
|
109
|
+
) = self.calculate_nonlinear_penalty(
|
|
110
|
+
state_x_prop,
|
|
111
|
+
state.x,
|
|
112
|
+
state.u,
|
|
113
|
+
state.lam_vc,
|
|
114
|
+
state.lam_vb_nodal,
|
|
115
|
+
state.lam_vb_cross,
|
|
116
|
+
state.lam_cost,
|
|
117
|
+
nodal_constraints,
|
|
118
|
+
params,
|
|
119
|
+
settings,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
J_nonlin_prev = prev_nonlinear_cost + prev_nonlinear_penalty + prev_nodal_penalty
|
|
123
|
+
|
|
124
|
+
actual_reduction = J_nonlin_prev - candidate.J_nonlin
|
|
125
|
+
predicted_reduction = J_nonlin_prev - candidate.J_lin
|
|
126
|
+
|
|
127
|
+
if predicted_reduction == 0:
|
|
128
|
+
raise ValueError("Predicted reduction is 0.")
|
|
129
|
+
|
|
130
|
+
rho = actual_reduction / predicted_reduction
|
|
131
|
+
|
|
132
|
+
state.pred_reduction_history.append(predicted_reduction)
|
|
133
|
+
state.actual_reduction_history.append(actual_reduction)
|
|
134
|
+
state.acceptance_ratio_history.append(rho)
|
|
135
|
+
|
|
136
|
+
if rho < self.eta_0:
|
|
137
|
+
lam_prox_k1 = np.minimum(self.lam_prox_max, self.gamma_1 * lam_prox_k)
|
|
138
|
+
candidate.lam_prox = lam_prox_k1
|
|
139
|
+
state.reject_solution(candidate)
|
|
140
|
+
adaptive_state = "Reject Higher"
|
|
141
|
+
elif rho >= self.eta_0 and rho < self.eta_1:
|
|
142
|
+
lam_prox_k1 = np.minimum(self.lam_prox_max, self.gamma_1 * lam_prox_k)
|
|
143
|
+
candidate.lam_prox = lam_prox_k1
|
|
144
|
+
self._copy_virtual_weights(candidate, state)
|
|
145
|
+
state.accept_solution(candidate)
|
|
146
|
+
adaptive_state = "Accept Higher"
|
|
147
|
+
elif rho >= self.eta_1 and rho < self.eta_2:
|
|
148
|
+
candidate.lam_prox = lam_prox_k
|
|
149
|
+
self._copy_virtual_weights(candidate, state)
|
|
150
|
+
state.accept_solution(candidate)
|
|
151
|
+
adaptive_state = "Accept Constant"
|
|
152
|
+
else:
|
|
153
|
+
lam_prox_k1 = np.maximum(self.lam_prox_min, self.gamma_2 * lam_prox_k)
|
|
154
|
+
candidate.lam_prox = lam_prox_k1
|
|
155
|
+
self._copy_virtual_weights(candidate, state)
|
|
156
|
+
state.accept_solution(candidate)
|
|
157
|
+
adaptive_state = "Accept Lower"
|
|
158
|
+
|
|
159
|
+
else:
|
|
160
|
+
candidate.lam_prox = lam_prox_k
|
|
161
|
+
self._copy_virtual_weights(candidate, state)
|
|
162
|
+
state.accept_solution(candidate)
|
|
163
|
+
adaptive_state = "Initial"
|
|
164
|
+
|
|
165
|
+
return adaptive_state
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# =============================================================================
|
|
169
|
+
# Pydantic spec for dict / YAML validation
|
|
170
|
+
# =============================================================================
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class AdaptiveProximalWeightSpec(BaseModel):
|
|
174
|
+
"""Validates AdaptiveProximalWeight configuration from dict/YAML input."""
|
|
175
|
+
|
|
176
|
+
type: Literal["AdaptiveProximalWeight"] = "AdaptiveProximalWeight"
|
|
177
|
+
gamma_1: float = 2.0
|
|
178
|
+
gamma_2: float = 0.5
|
|
179
|
+
eta_0: float = 1e-2
|
|
180
|
+
eta_1: float = 1e-1
|
|
181
|
+
eta_2: float = 0.8
|
|
182
|
+
lam_prox_min: float = 1e-3
|
|
183
|
+
lam_prox_max: float = 1e4
|
|
184
|
+
lam_cost_drop: int = -1
|
|
185
|
+
lam_cost_relax: float = 1.0
|
|
186
|
+
|
|
187
|
+
model_config = ConfigDict(extra="forbid")
|
|
188
|
+
|
|
189
|
+
def build(self) -> AdaptiveProximalWeight:
|
|
190
|
+
return AdaptiveProximalWeight(**self.model_dump(exclude={"type"}, exclude_unset=True))
|
|
@@ -14,13 +14,13 @@ from openscvx.utils.printing import (
|
|
|
14
14
|
color_adaptive_state,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
from
|
|
17
|
+
from ..base import AutotuningBase
|
|
18
18
|
|
|
19
19
|
if TYPE_CHECKING:
|
|
20
20
|
from openscvx.lowered import LoweredJaxConstraints
|
|
21
21
|
|
|
22
|
-
from
|
|
23
|
-
from
|
|
22
|
+
from ..base import AlgorithmState, CandidateIterate
|
|
23
|
+
from ..weights import Weights
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class AugmentedLagrangian(AutotuningBase):
|
|
@@ -86,8 +86,12 @@ class AugmentedLagrangian(AutotuningBase):
|
|
|
86
86
|
eta_2: Threshold above which solution is accepted with lower weight.
|
|
87
87
|
Defaults to 0.8.
|
|
88
88
|
ep: Threshold for virtual control weight update (nu > ep vs nu <= ep).
|
|
89
|
-
Defaults to 0.
|
|
90
|
-
|
|
89
|
+
Must lie in (0, 1). Defaults to 0.99; when tuning, try 1e-1 if needed.
|
|
90
|
+
Typically tuned together with ``eta_lambda`` (often the first
|
|
91
|
+
parameters adjusted).
|
|
92
|
+
eta_lambda: Step size for virtual control weight update. Defaults to 1e1.
|
|
93
|
+
Typically tuned together with ``ep`` (often the first parameters
|
|
94
|
+
adjusted).
|
|
91
95
|
lam_vc_max: Maximum virtual control penalty weight. Defaults to 1e5.
|
|
92
96
|
lam_prox_min: Minimum trust region (proximal) weight. Defaults to 1e-3.
|
|
93
97
|
lam_prox_max: Maximum trust region (proximal) weight. Defaults to 2e5.
|
|
@@ -6,13 +6,13 @@ from pydantic import BaseModel, ConfigDict
|
|
|
6
6
|
|
|
7
7
|
from openscvx.config import Config
|
|
8
8
|
|
|
9
|
-
from
|
|
9
|
+
from ..base import AutotuningBase
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from openscvx.lowered import LoweredJaxConstraints
|
|
13
13
|
|
|
14
|
-
from
|
|
15
|
-
from
|
|
14
|
+
from ..base import AlgorithmState, CandidateIterate
|
|
15
|
+
from ..weights import Weights
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class ConstantProximalWeight(AutotuningBase):
|
|
@@ -7,13 +7,13 @@ from pydantic import BaseModel, ConfigDict
|
|
|
7
7
|
|
|
8
8
|
from openscvx.config import Config
|
|
9
9
|
|
|
10
|
-
from
|
|
10
|
+
from ..base import AutotuningBase
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
13
13
|
from openscvx.lowered import LoweredJaxConstraints
|
|
14
14
|
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from ..base import AlgorithmState, CandidateIterate
|
|
16
|
+
from ..weights import Weights
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class RampProximalWeight(AutotuningBase):
|
|
@@ -22,11 +22,11 @@ from openscvx.utils.printing import (
|
|
|
22
22
|
color_prob_stat,
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
from .augmented_lagrangian import AugmentedLagrangian
|
|
26
|
-
from .
|
|
27
|
-
from .
|
|
28
|
-
from
|
|
29
|
-
from
|
|
25
|
+
from ..autotuner.augmented_lagrangian import AugmentedLagrangian
|
|
26
|
+
from ..autotuner.constant_proximal_weight import ConstantProximalWeight
|
|
27
|
+
from ..autotuner.ramp_proximal_weight import RampProximalWeight
|
|
28
|
+
from ..base import Algorithm, AlgorithmState, CandidateIterate
|
|
29
|
+
from ..weights import Weights
|
|
30
30
|
|
|
31
31
|
if TYPE_CHECKING:
|
|
32
32
|
from openscvx.lowered import LoweredJaxConstraints
|
|
@@ -34,7 +34,7 @@ if TYPE_CHECKING:
|
|
|
34
34
|
from openscvx.symbolic.expr.control import Control
|
|
35
35
|
from openscvx.symbolic.expr.state import State
|
|
36
36
|
|
|
37
|
-
from
|
|
37
|
+
from ..base import AutotuningBase
|
|
38
38
|
|
|
39
39
|
warnings.filterwarnings("ignore")
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openscvx
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.dev6
|
|
4
4
|
Summary: A general Python-based successive convexification implementation which uses a JAX backend.
|
|
5
5
|
Author-email: Chris Hayner and Griffin Norris <haynec@uw.edu>
|
|
6
6
|
License: Apache Software License
|
|
@@ -152,13 +152,16 @@ openscvx.egg-info/entry_points.txt
|
|
|
152
152
|
openscvx.egg-info/requires.txt
|
|
153
153
|
openscvx.egg-info/top_level.txt
|
|
154
154
|
openscvx/algorithms/__init__.py
|
|
155
|
-
openscvx/algorithms/augmented_lagrangian.py
|
|
156
155
|
openscvx/algorithms/base.py
|
|
157
|
-
openscvx/algorithms/constant_proximal_weight.py
|
|
158
156
|
openscvx/algorithms/optimization_results.py
|
|
159
|
-
openscvx/algorithms/penalized_trust_region.py
|
|
160
|
-
openscvx/algorithms/ramp_proximal_weight.py
|
|
161
157
|
openscvx/algorithms/weights.py
|
|
158
|
+
openscvx/algorithms/autotuner/__init__.py
|
|
159
|
+
openscvx/algorithms/autotuner/adaptive_proximal_weight.py
|
|
160
|
+
openscvx/algorithms/autotuner/augmented_lagrangian.py
|
|
161
|
+
openscvx/algorithms/autotuner/constant_proximal_weight.py
|
|
162
|
+
openscvx/algorithms/autotuner/ramp_proximal_weight.py
|
|
163
|
+
openscvx/algorithms/scvx/__init__.py
|
|
164
|
+
openscvx/algorithms/scvx/penalized_trust_region.py
|
|
162
165
|
openscvx/discretization/__init__.py
|
|
163
166
|
openscvx/discretization/base.py
|
|
164
167
|
openscvx/discretization/discretize_linearize.py
|
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
|
-
from openscvx.algorithms
|
|
6
|
+
from openscvx.algorithms import (
|
|
7
|
+
AdaptiveProximalWeight,
|
|
8
|
+
AugmentedLagrangian,
|
|
9
|
+
ConstantProximalWeight,
|
|
10
|
+
PenalizedTrustRegion,
|
|
11
|
+
PenalizedTrustRegionConfig,
|
|
12
|
+
RampProximalWeight,
|
|
13
|
+
)
|
|
7
14
|
from openscvx.algorithms.base import (
|
|
8
15
|
AlgorithmState,
|
|
9
16
|
AutotuningBase,
|
|
10
17
|
CandidateIterate,
|
|
11
18
|
DiscretizationResult,
|
|
12
19
|
)
|
|
13
|
-
from openscvx.algorithms.constant_proximal_weight import ConstantProximalWeight
|
|
14
|
-
from openscvx.algorithms.penalized_trust_region import PenalizedTrustRegion
|
|
15
|
-
from openscvx.algorithms.ramp_proximal_weight import RampProximalWeight
|
|
16
20
|
from openscvx.algorithms.weights import Weights
|
|
17
21
|
from openscvx.config import (
|
|
18
22
|
Config,
|
|
@@ -1434,6 +1438,194 @@ def test_augmented_lagrangian_exported():
|
|
|
1434
1438
|
assert auto_tuner.lam_prox_max == 1e6
|
|
1435
1439
|
|
|
1436
1440
|
|
|
1441
|
+
# --- Tests for AdaptiveProximalWeight --------------------------------------------
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
def test_adaptive_proximal_weight_initial_iteration(
|
|
1445
|
+
settings, algorithm_state, empty_nodal_constraints, weights
|
|
1446
|
+
):
|
|
1447
|
+
"""AdaptiveProximalWeight on k=1 copies VC/VB from state and accepts."""
|
|
1448
|
+
autotuner = AdaptiveProximalWeight()
|
|
1449
|
+
algorithm_state.k = 1
|
|
1450
|
+
candidate = CandidateIterate()
|
|
1451
|
+
candidate.x = np.array([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]])
|
|
1452
|
+
candidate.x_prop = np.array([[0.5, 0.5], [1.5, 1.5]])
|
|
1453
|
+
candidate.u = np.array([[0.0], [0.5], [1.0]])
|
|
1454
|
+
candidate.J_lin = 10.0
|
|
1455
|
+
|
|
1456
|
+
params = {}
|
|
1457
|
+
initial_x_len = len(algorithm_state.X)
|
|
1458
|
+
lam_vc_prev = algorithm_state.lam_vc
|
|
1459
|
+
lam_vb_nodal_prev = algorithm_state.lam_vb_nodal
|
|
1460
|
+
|
|
1461
|
+
adaptive_state = autotuner.update_weights(
|
|
1462
|
+
algorithm_state, candidate, empty_nodal_constraints, settings, params, weights
|
|
1463
|
+
)
|
|
1464
|
+
|
|
1465
|
+
assert adaptive_state == "Initial"
|
|
1466
|
+
assert len(algorithm_state.X) == initial_x_len + 1
|
|
1467
|
+
np.testing.assert_allclose(candidate.lam_vc, lam_vc_prev)
|
|
1468
|
+
np.testing.assert_allclose(candidate.lam_vb_nodal, lam_vb_nodal_prev)
|
|
1469
|
+
assert len(algorithm_state.lam_vc_history) == 2
|
|
1470
|
+
np.testing.assert_allclose(algorithm_state.lam_vc_history[-1], lam_vc_prev)
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
def test_adaptive_proximal_weight_accept_lower_fixed_vc_vb(
|
|
1474
|
+
settings, algorithm_state, nodal_constraints_with_violations, weights
|
|
1475
|
+
):
|
|
1476
|
+
"""Accept Lower decreases lam_prox but leaves lam_vc / lam_vb unchanged."""
|
|
1477
|
+
autotuner = AdaptiveProximalWeight()
|
|
1478
|
+
algorithm_state.k = 2
|
|
1479
|
+
algorithm_state.lam_prox_history = [np.full((3, 3), 1.0)]
|
|
1480
|
+
algorithm_state.lam_vc_history = [np.array([1.0, 1.0])]
|
|
1481
|
+
algorithm_state.lam_vb_nodal_history = [np.full((3, 1), 1.0)]
|
|
1482
|
+
algorithm_state.lam_vb_cross_history = [np.full(0, 1.0)]
|
|
1483
|
+
|
|
1484
|
+
algorithm_state.X.append(np.array([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]]))
|
|
1485
|
+
algorithm_state.U.append(np.array([[0.0], [0.5], [1.0]]))
|
|
1486
|
+
|
|
1487
|
+
i4 = 2 + 4 + 4
|
|
1488
|
+
flattened_size = (3 - 1) * i4
|
|
1489
|
+
V_dummy = np.zeros((flattened_size, 5))
|
|
1490
|
+
V_final = V_dummy[:, -1].reshape(-1, i4)
|
|
1491
|
+
V_final[:, :2] = np.array([[0.0, 0.0], [1.0, 1.0]])
|
|
1492
|
+
V_dummy[:, -1] = V_final.flatten()
|
|
1493
|
+
algorithm_state.discretizations.append(
|
|
1494
|
+
DiscretizationResult.from_V(
|
|
1495
|
+
V_dummy, n_x=algorithm_state.n_x, n_u=algorithm_state.n_u, N=algorithm_state.N
|
|
1496
|
+
)
|
|
1497
|
+
)
|
|
1498
|
+
|
|
1499
|
+
candidate = CandidateIterate()
|
|
1500
|
+
candidate.x = np.array([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]])
|
|
1501
|
+
candidate.x_prop = np.array([[0.5, 0.5], [1.5, 1.5]])
|
|
1502
|
+
candidate.u = np.array([[0.0], [0.5], [1.0]])
|
|
1503
|
+
params = {}
|
|
1504
|
+
|
|
1505
|
+
state_x_prop = algorithm_state.x_prop()
|
|
1506
|
+
lam_vc_prev = algorithm_state.lam_vc
|
|
1507
|
+
lam_vb_nodal_prev = algorithm_state.lam_vb_nodal
|
|
1508
|
+
lam_vb_cross_prev = algorithm_state.lam_vb_cross
|
|
1509
|
+
lam_cost_prev = algorithm_state.lam_cost
|
|
1510
|
+
|
|
1511
|
+
prev_cost, prev_penalty, prev_nodal = AutotuningBase.calculate_nonlinear_penalty(
|
|
1512
|
+
state_x_prop,
|
|
1513
|
+
algorithm_state.x,
|
|
1514
|
+
algorithm_state.u,
|
|
1515
|
+
lam_vc_prev,
|
|
1516
|
+
lam_vb_nodal_prev,
|
|
1517
|
+
lam_vb_cross_prev,
|
|
1518
|
+
lam_cost_prev,
|
|
1519
|
+
nodal_constraints_with_violations,
|
|
1520
|
+
params,
|
|
1521
|
+
settings,
|
|
1522
|
+
)
|
|
1523
|
+
J_nonlin_prev = prev_cost + prev_penalty + prev_nodal
|
|
1524
|
+
|
|
1525
|
+
cand_cost, cand_penalty, cand_nodal = AutotuningBase.calculate_nonlinear_penalty(
|
|
1526
|
+
candidate.x_prop,
|
|
1527
|
+
candidate.x,
|
|
1528
|
+
candidate.u,
|
|
1529
|
+
lam_vc_prev,
|
|
1530
|
+
lam_vb_nodal_prev,
|
|
1531
|
+
lam_vb_cross_prev,
|
|
1532
|
+
lam_cost_prev,
|
|
1533
|
+
nodal_constraints_with_violations,
|
|
1534
|
+
params,
|
|
1535
|
+
settings,
|
|
1536
|
+
)
|
|
1537
|
+
J_nonlin_cand = cand_cost + cand_penalty + cand_nodal
|
|
1538
|
+
|
|
1539
|
+
actual_reduction = J_nonlin_prev - J_nonlin_cand
|
|
1540
|
+
rho_target = autotuner.eta_2 + 0.1 * (1.0 - autotuner.eta_2)
|
|
1541
|
+
predicted_reduction = actual_reduction / rho_target
|
|
1542
|
+
candidate.J_lin = J_nonlin_prev - predicted_reduction
|
|
1543
|
+
|
|
1544
|
+
lam_prox_prev = algorithm_state.lam_prox
|
|
1545
|
+
|
|
1546
|
+
adaptive_state = autotuner.update_weights(
|
|
1547
|
+
algorithm_state,
|
|
1548
|
+
candidate,
|
|
1549
|
+
nodal_constraints_with_violations,
|
|
1550
|
+
settings,
|
|
1551
|
+
params,
|
|
1552
|
+
weights,
|
|
1553
|
+
)
|
|
1554
|
+
|
|
1555
|
+
assert adaptive_state == "Accept Lower"
|
|
1556
|
+
expected_prox = np.maximum(autotuner.lam_prox_min, autotuner.gamma_2 * lam_prox_prev)
|
|
1557
|
+
np.testing.assert_allclose(algorithm_state.lam_prox_history[1], expected_prox)
|
|
1558
|
+
np.testing.assert_allclose(candidate.lam_vc, lam_vc_prev)
|
|
1559
|
+
np.testing.assert_allclose(candidate.lam_vb_nodal, lam_vb_nodal_prev)
|
|
1560
|
+
np.testing.assert_allclose(candidate.lam_vb_cross, lam_vb_cross_prev)
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
def test_adaptive_proximal_weight_reject_increase(
|
|
1564
|
+
settings, algorithm_state, empty_nodal_constraints, weights
|
|
1565
|
+
):
|
|
1566
|
+
"""Reject branch increases lam_prox and does not update lam_vc history."""
|
|
1567
|
+
autotuner = AdaptiveProximalWeight()
|
|
1568
|
+
algorithm_state.k = 2
|
|
1569
|
+
algorithm_state.lam_prox_history = [np.full((3, 3), 1.0)]
|
|
1570
|
+
algorithm_state.lam_vc_history = [np.array([1.0, 1.0])]
|
|
1571
|
+
|
|
1572
|
+
algorithm_state.X.append(np.array([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]]))
|
|
1573
|
+
algorithm_state.U.append(np.array([[0.0], [0.5], [1.0]]))
|
|
1574
|
+
|
|
1575
|
+
i4 = 2 + 4 + 4
|
|
1576
|
+
flattened_size = (3 - 1) * i4
|
|
1577
|
+
V_dummy = np.zeros((flattened_size, 5))
|
|
1578
|
+
V_final = V_dummy[:, -1].reshape(-1, i4)
|
|
1579
|
+
V_final[:, :2] = np.array([[0.0, 0.0], [1.0, 1.0]])
|
|
1580
|
+
V_dummy[:, -1] = V_final.flatten()
|
|
1581
|
+
algorithm_state.discretizations.append(
|
|
1582
|
+
DiscretizationResult.from_V(
|
|
1583
|
+
V_dummy, n_x=algorithm_state.n_x, n_u=algorithm_state.n_u, N=algorithm_state.N
|
|
1584
|
+
)
|
|
1585
|
+
)
|
|
1586
|
+
|
|
1587
|
+
candidate = CandidateIterate()
|
|
1588
|
+
candidate.x = np.array([[0.0, 0.0], [1.0, 1.0], [2.0, 2.0]])
|
|
1589
|
+
candidate.x_prop = np.array([[0.0, 0.0], [1.0, 1.0]])
|
|
1590
|
+
candidate.u = np.array([[0.0], [0.5], [1.0]])
|
|
1591
|
+
candidate.J_lin = 10.0
|
|
1592
|
+
|
|
1593
|
+
params = {}
|
|
1594
|
+
lam_prox_prev = algorithm_state.lam_prox
|
|
1595
|
+
lam_vc_prev = algorithm_state.lam_vc
|
|
1596
|
+
|
|
1597
|
+
adaptive_state = autotuner.update_weights(
|
|
1598
|
+
algorithm_state, candidate, empty_nodal_constraints, settings, params, weights
|
|
1599
|
+
)
|
|
1600
|
+
|
|
1601
|
+
assert adaptive_state == "Reject Higher"
|
|
1602
|
+
assert candidate.lam_vc is None
|
|
1603
|
+
np.testing.assert_allclose(
|
|
1604
|
+
algorithm_state.lam_prox_history[1], autotuner.gamma_1 * lam_prox_prev
|
|
1605
|
+
)
|
|
1606
|
+
assert len(algorithm_state.lam_vc_history) == 1
|
|
1607
|
+
assert np.allclose(algorithm_state.lam_vc_history[0], lam_vc_prev)
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
def test_penalized_trust_region_config_adaptive_proximal_weight():
|
|
1611
|
+
"""Dict/YAML autotuner config builds AdaptiveProximalWeight."""
|
|
1612
|
+
cfg = PenalizedTrustRegionConfig(
|
|
1613
|
+
autotuner={"type": "AdaptiveProximalWeight", "gamma_1": 3.0},
|
|
1614
|
+
)
|
|
1615
|
+
algorithm = cfg.to_algorithm()
|
|
1616
|
+
assert isinstance(algorithm.autotuner, AdaptiveProximalWeight)
|
|
1617
|
+
assert algorithm.autotuner.gamma_1 == 3.0
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
def test_adaptive_proximal_weight_exported():
|
|
1621
|
+
"""AdaptiveProximalWeight is exported from the top-level openscvx namespace."""
|
|
1622
|
+
import openscvx as ox
|
|
1623
|
+
|
|
1624
|
+
autotuner = ox.AdaptiveProximalWeight()
|
|
1625
|
+
assert isinstance(autotuner, AdaptiveProximalWeight)
|
|
1626
|
+
assert autotuner.gamma_1 == 2.0
|
|
1627
|
+
|
|
1628
|
+
|
|
1437
1629
|
# --- Tests for ConstantProximalWeight ---------------------------------------------
|
|
1438
1630
|
|
|
1439
1631
|
|
|
@@ -367,6 +367,7 @@ def test_constraint_types(constraint_type):
|
|
|
367
367
|
"autotuner_spec",
|
|
368
368
|
[
|
|
369
369
|
"augmented_lagrangian",
|
|
370
|
+
"adaptive_proximal",
|
|
370
371
|
"constant_proximal",
|
|
371
372
|
"ramp_proximal",
|
|
372
373
|
"string_augmented_lagrangian",
|
|
@@ -445,6 +446,8 @@ def test_autotuning(autotuner_spec):
|
|
|
445
446
|
|
|
446
447
|
if autotuner_spec == "augmented_lagrangian":
|
|
447
448
|
autotuner = ox.AugmentedLagrangian()
|
|
449
|
+
elif autotuner_spec == "adaptive_proximal":
|
|
450
|
+
autotuner = ox.AdaptiveProximalWeight()
|
|
448
451
|
elif autotuner_spec == "constant_proximal":
|
|
449
452
|
autotuner = ox.ConstantProximalWeight()
|
|
450
453
|
elif autotuner_spec == "ramp_proximal":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|