Skip to content

pockit

Pockit is a Python toolkit for continuous-time optimal control and trajectory optimization. Define dynamics, costs, and constraints with SymPy expressions; Pockit transcribes them with Radau or Lobatto collocation and supplies sparse derivatives to Ipopt or SciPy.

Start with a working solve

Install the package with the Ipopt backend:

pip install "pockit-optimal-control[ipopt]"

The distribution name is pockit-optimal-control; the Python import remains pockit. The minimum-time double-integrator tutorial walks through a complete build, initial guess, solve, dense validation, and plot. If native Ipopt installation is unavailable, use the SciPy backend.

Goal Go to
Install the recommended solver stack Install with Ipopt
Build and verify a first model Solve your first problem
Decide between Ipopt and SciPy Optimizer selection
Define dynamics, bounds, and objectives Problem setup
Connect phases through events Multi-phase modeling
Diagnose an inaccurate transcription Error checks and mesh refinement

One workflow across domains

Maintained examples use the same composable structure:

system, phase = build_problem()
guess = initial_guess(phase)
solution = solve_problem(system, guess)
figure = plot_solution(solution)

Each example page states the continuous-time model, units, boundary and path constraints, discretization, and independent numerical checks. Reported results are reconstructed on dense physical-time grids rather than accepted solely from collocation nodes.

Examples by discipline

The maintained suite contains 33 runnable examples covering 23 conservatively grouped application areas. The navigation consolidates them into 12 broader groups, while the table below preserves the 23-area scope. Each linked page includes the background, equations, units, constraints, assumptions, limitations, and numerical checks.

Discipline Maintained examples Main modeling idea
Mathematics and variational problems Brachistochrone Nonlinear mechanics checked against an analytical cycloid
Control theory and numerical benchmarks Double integrator, LQR, hyper-sensitive problem Free time, Riccati verification, bang-bang control, and boundary layers
Robotics Robot arm, free-flying robot, humanoid OSC/WBC, humanoid retargeting, planar quadrotor, 6-DoF drone Coupled motion, task hierarchy, contacts, and nonredundant attitude coordinates
Aerospace engineering and astrodynamics Earth-to-Venus transfer, two-stage rocket, Mars powered descent Orbital elements, staging events, and constrained landing guidance
Planetary science and small-body operations Bennu soft landing Rotating-frame proximity dynamics, surface approach, and low-thrust guidance
Astronomy and precision pointing Flexible telescope slew Input shaping and residual-mode suppression
Physical oceanography Ocean inertial current Coriolis dynamics and a controllability-Gramian forcing benchmark
Structural engineering Structural vibration control Active damping of a flexible mode
Chemistry and reaction engineering Batch reactor, reaction selectivity Operating-regime changes and competing reaction pathways
Transportation engineering Electric-vehicle eco-driving Road phases, speed limits, and energy-time trade-offs
Epidemiology and public health SIR intervention Nonlinear transmission dynamics and a health-care capacity limit
Biomedical engineering and neuroscience Neural stimulation Minimum-effort excitation of nonlinear membrane dynamics
Building science HVAC demand management Thermal storage, comfort bounds, and time-of-use prices
Energy systems and electric power Battery arbitrage Conversion efficiency, terminal inventory, and cycling cost
Pharmacology PK infusion Multi-phase loading, effect-site delay, and steady maintenance
Quantum physics Two-level state transfer Bloch-sphere control with an analytical fluence bound
Macroeconomics Ramsey growth Intertemporal consumption and investment allocation
Quantitative finance Optimal trade execution Inventory risk and temporary market impact
Water-resources engineering Reservoir flood control Storage routing and constrained downstream release
Agricultural water management Irrigation scheduling Root-zone balance, rainfall, drainage, and crop stress
Ecology and resource economics Bioeconomic fishery Renewable stock dynamics and sustainable harvest
Communications engineering Wireless transmission Deadline-constrained water-filling power allocation
Scientific machine learning Neural ODE XOR Continuous-depth training with an analytical classifier check

Representative verified results

Core modeling capabilities

  • Radau and Lobatto direct collocation with polynomial state and control interpolation
  • Single- and multi-phase systems with phase-local dynamics and shared static parameters
  • Fixed or free phase times, endpoint conditions, path constraints, event equations, and integral terms
  • Symbolic sparse first- and second-order derivatives with reusable compiled functions
  • Ipopt for large sparse nonlinear programs and SciPy trust-constr for a pure-Python backend
  • Continuous-time reconstruction, dense feasibility checks, and optional mesh updates when a first discretization is insufficient

Known singular-arc limitation

Pockit does not currently provide a reliable, validated workflow for true singular arcs. Solver convergence alone is not certification. Read Singular Arcs: Identification and Current Limitations before modeling a control-affine problem with a suspected singular interval.

Continue with installation, or open the first complete solve.