AutoTuneMPC
v1.0.1Constrained nonlinear MPC and Optuna tuning over HTTPS JSON.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
identify_discrete_plant Identify a discrete plant
Fit a discrete linear A, B, and dt from logged (t, u, y) samples. This tool stays free when payment enforcement is on. It does not call IPOPT. Pass the returned matrices to ``solve_mpc`` as a linear system. Send 4 to 2000 samples. Each ``y`` has length 1..24 and each ``u`` has length 1..12, the same widths on every row, all finite, with strictly increasing timestamps. Anything else is rejected before the fit.
| Parameter | Type | Description |
|---|---|---|
request * | object | Logged (t, u, y) samples for a free discrete linear fit. No X-API-Key and no x402 charge. Pass A, B, and dt to solve_mpc after a free validate_problem. |
validate_problem Validate a problem
Free feasibility check. Call this first, then simulate, before any paid tool. This is POST /v1/validate. It stays free when payment enforcement is on. It does not use X-API-Key and it does not return HTTP 402. A failing check means the plant, bounds, or weights are not feasible. After it passes, call simulate to see closed-loop tracking. Call start_autotune_job at $1.50 only when those weights oscillate or miss the target.
simulate Simulate a closed loop
Free closed-loop tracking check. Call validate_problem first. This is POST /v1/simulate. It stays free. The rollout shows whether the current weights track the reference. Call start_autotune_job at $1.50 when the motion oscillates or misses the target.
solve_mpc Solve MPC
Solve a multi-step constrained MPC problem on the server. Use this when the horizon has soft state bounds, hard input and slew limits, and an offset-free disturbance rejection term. Pass the same ``session_id`` on later calls of one closed loop so the shifted primal and dual warm start is restored. Omit ``session_id`` for a single stateless solve. Do not call this for a one-step linear update you can do locally (a matrix multiply, a threshold, or reading a sensor). Those do not need IPOPT. CasADi and IPOPT return u0 and the predicted trajectory for robotics, energy storage, and process contr…
reset_warm_start Reset warm start
Clear one session's shifted primal and dual. Next ``solve_mpc`` / ``POST /v1/solve`` with this ``session_id`` is cold. The compiled solver stays. Stateless calls omit ``session_id`` and already clear warm-start memory, so they do not use this tool.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session id whose warm-start seed to drop. Required, and at most 128 characters. Free: it does not spend a credit. The compiled solver stays. The next solve_mpc with this id is a cold start. Clearing a… |
start_autotune_job Autotune weights
Paid at $1.50. Call free validate_problem and free simulate first. Call this when manual Q, R, Rd, and Qf oscillate or miss the target. Then poll ``get_autotune_job``. The tuner needs discrete or continuous linear matrices A and B, one of double_integrator, thermal_rc_zone, soil_moisture_cascade, cart_pendulum, unicycle_kinematics, gravity_tank, icr_skid_steer, and ackermann, or a kind expression plant with one allowlisted scalar expression per state row. Expressions outside that allowlist are rejected. Optional h rows and fixed obstacle slots, path-frame residuals, and zone bands are accept…
get_autotune_job Read an autotune job
Read one autotune job started by ``start_autotune_job``. ``status`` is ``running``, ``complete``, or ``failed``. On ``complete``, ``result`` holds the Pareto-best weights, overshoot, settling time, RMSE, and solve time. ``pareto_profiles`` names up to three points already evaluated (tight tracking, balanced, smooth) and ``pareto_points`` is the plot cloud. The top-level ``Q``, ``R``, ``Rd``, and ``Qf`` stay the study winner. Poll again while it is ``running``. When payment enforcement is on, pass the ``job_token`` from the start call or the ``X-Job-Token`` header. A failed job reports ``autot…
| Parameter | Type | Description |
|---|---|---|
job_id * | string | Job id returned by start_autotune_job. |
job_token | Token returned with the job when payment enforcement is on. Omit it when the X-Job-Token header carries the same token. This poll is free and does not spend a credit. |
autotune_root_zone_irrigation Autotune root-zone irrigation
Tune valve weights for the three-layer root-zone irrigation template. Same payment as autotune_template: X-API-Key spends 1 autotune credit, and a missing key or an empty pack is HTTP 402 for x402. The default study is physics-v1. Pass study_version published to run the older scenario.
| Parameter | Type | Description |
|---|---|---|
max_trials | integer | Optuna trials for the root-zone irrigation plant. Default 20. Values below 1 are raised to 1. Paid at $2.00: X-API-Key spends 1 autotune credit, or HTTP 402 is x402 Base USDC. Each call starts a new s… |
study_version | Omit for physics-v1 (start [0.17, 0.22, 0.22], horizon 9). published keeps the older start-on-reference horizon 24 scenario. |
autotune_battery_peak_shaving Autotune battery peak shaving
Tune charge power weights for the battery peak-shaving template. Same payment as autotune_template: X-API-Key spends 1 autotune credit, and a missing key or an empty pack is HTTP 402 for x402.
| Parameter | Type | Description |
|---|---|---|
max_trials | integer | Optuna trials for the battery peak-shaving plant. Default 20. Values below 1 are raised to 1. Paid at $2.00: X-API-Key spends 1 autotune credit, or HTTP 402 is x402 Base USDC. Each call starts a new s… |
autotune_embedded_controller_with_c_codegen Autotune an embedded controller
Tune a linear plant and write a zero-heap C99 bundle. The reply's ``codegen`` object lists ``mpc_bundle.h`` and ``mpc_bundle.c`` plus ``usage_example_c`` and ``controller_kind``. A linear plant is a condensed QP (``linear_qp``). A nonlinear plant, including differential drive, is a linearized iteration (``linearized_rti``): one Jacobian of ``f`` at the current ``(x, u, d)``, then projected-gradient steps. That is not a full nonlinear SQP and not acados SQP-RTI. The exported acados controller is a real SQP; ``SQP_RTI`` is that backend's one-quadratic-program-per-tick mode. Compile with ``gcc -…
| Parameter | Type | Description |
|---|---|---|
max_trials | integer | Optuna trials before the C99 bundle is written. Default 1. Values below 1 are raised to 1. Paid at $2.00: X-API-Key spends 1 autotune credit, or HTTP 402 is x402 Base USDC. Each call starts a new stud… |
autotune_template Autotune a template
Tune differential_drive, battery_peak_shaving, or root_zone_irrigation. This is POST /v1/templates/autotune at $2.00. The name is differential_drive, battery_peak_shaving, or root_zone_irrigation. The reply returns tuned Q, R, Rd, and Qf. Send name and max_trials. Send header X-API-Key when a $15 pack still has autotune credits. One call spends 1 of those credits. With no key, or when the credits are gone, the call is HTTP 402 and an agent pays with x402. The reply returns the tuned weights for that template. Payment uses the same gate as the HTTP route.
| Parameter | Type | Description |
|---|---|---|
request * | object | Paid template tune at $2.00 for differential_drive, battery_peak_shaving, or root_zone_irrigation. Send X-API-Key (spends 1 autotune credit) or pay HTTP 402 with x402 on Base USDC. Validate a custom p… |