@@ -15,6 +15,56 @@ Refer to [examples](examples/):
1515- ` examples/afti16_example.py ` (linear AFTI-16 aircraft model)
1616- ` examples/unicycle_nmpc_example.py ` (nonlinear unicycle with time-varying linearization)
1717
18+ Create a model, configure with ` Modelsetup() ` , and solve with ` Model.solve() ` .
19+
20+ ``` python
21+ model = Model()
22+ model.setup(A, B, Np, kwargs... )
23+ results = model.solve(x0, u0, yref, uref, w, verbose = False )
24+ ```
25+
26+ ** Required Arguments:**
27+ - ` A ` : State matrix
28+ - ` B ` : Input matrix
29+ - ` Np ` : Prediction horizon
30+
31+ ** Optional Problem Arguments:**
32+ - ` C ` : Output matrix (default: I, meaning y = x)
33+ - ` e ` : Affine term in dynamics (default: zeros)
34+ - ` Wy ` : Output weight matrix (default: I)
35+ - ` Wu ` : Input weight matrix (default: I)
36+ - ` Wdu ` : Input increment weight matrix (default: I)
37+ - ` Wf ` : Terminal cost weight matrix (default: Wy)
38+ - ` xmin, xmax ` : State constraints (default: ±Inf)
39+ - ` umin, umax ` : Input constraints (default: ±Inf)
40+ - ` dumin, dumax ` : Input increment constraints (default: ±Inf)
41+
42+ ** Solver Settings:**
43+ - ` rho ` : ADMM penalty parameter (default: 1.0)
44+ - ` tol ` : Convergence tolerance (default: 1e-4)
45+ - ` eta ` : Acceleration restart factor (default: 0.999)
46+ - ` maxiter ` : Maximum iterations (default: 100)
47+ - ` precond ` : Use preconditioning (default: false)
48+ - ` accel ` : Use Nesterov acceleration (default: false)
49+ - ` device ` : Compute device, ` cpu ` or ` gpu ` (default: cpu)
50+
51+ ** System Model:**
52+ ```
53+ x_{k+1} = A * x_k + B * u_k + e + w
54+ y_k = C * x_k
55+ ```
56+
57+ where:
58+ - ` e ` : Constant affine term (defined in ` setup! ` )
59+ - ` w ` : Known/measured disturbance (provided at solve time)
60+
61+ ** Arguments:**
62+ - ` x0 ` : Current state (nx)
63+ - ` u0 ` : Previous input (nu)
64+ - ` yref ` : Output reference (ny)
65+ - ` uref ` : Input reference (nu)
66+ - ` w ` : Known disturbance (nx), use ` zeros(nx) ` if none
67+
1868![ ] ( assets/example_afti16.png )
1969
2070![ ] ( assets/example_unicycle.png )
0 commit comments