openscvx 0.3.2.dev170__py3-none-any.whl
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.
Potentially problematic release.
This version of openscvx might be problematic. Click here for more details.
- openscvx/__init__.py +123 -0
- openscvx/_version.py +34 -0
- openscvx/algorithms/__init__.py +92 -0
- openscvx/algorithms/autotuning.py +24 -0
- openscvx/algorithms/base.py +351 -0
- openscvx/algorithms/optimization_results.py +215 -0
- openscvx/algorithms/penalized_trust_region.py +384 -0
- openscvx/config.py +437 -0
- openscvx/discretization/__init__.py +47 -0
- openscvx/discretization/discretization.py +236 -0
- openscvx/expert/__init__.py +23 -0
- openscvx/expert/byof.py +326 -0
- openscvx/expert/lowering.py +419 -0
- openscvx/expert/validation.py +357 -0
- openscvx/integrators/__init__.py +48 -0
- openscvx/integrators/runge_kutta.py +281 -0
- openscvx/lowered/__init__.py +30 -0
- openscvx/lowered/cvxpy_constraints.py +23 -0
- openscvx/lowered/cvxpy_variables.py +124 -0
- openscvx/lowered/dynamics.py +34 -0
- openscvx/lowered/jax_constraints.py +133 -0
- openscvx/lowered/parameters.py +54 -0
- openscvx/lowered/problem.py +70 -0
- openscvx/lowered/unified.py +718 -0
- openscvx/plotting/__init__.py +63 -0
- openscvx/plotting/plotting.py +756 -0
- openscvx/plotting/scp_iteration.py +299 -0
- openscvx/plotting/viser/__init__.py +126 -0
- openscvx/plotting/viser/animated.py +605 -0
- openscvx/plotting/viser/plotly_integration.py +333 -0
- openscvx/plotting/viser/primitives.py +355 -0
- openscvx/plotting/viser/scp.py +459 -0
- openscvx/plotting/viser/server.py +112 -0
- openscvx/problem.py +734 -0
- openscvx/propagation/__init__.py +60 -0
- openscvx/propagation/post_processing.py +104 -0
- openscvx/propagation/propagation.py +248 -0
- openscvx/solvers/__init__.py +51 -0
- openscvx/solvers/cvxpy.py +226 -0
- openscvx/symbolic/__init__.py +9 -0
- openscvx/symbolic/augmentation.py +630 -0
- openscvx/symbolic/builder.py +492 -0
- openscvx/symbolic/constraint_set.py +92 -0
- openscvx/symbolic/expr/__init__.py +222 -0
- openscvx/symbolic/expr/arithmetic.py +517 -0
- openscvx/symbolic/expr/array.py +632 -0
- openscvx/symbolic/expr/constraint.py +796 -0
- openscvx/symbolic/expr/control.py +135 -0
- openscvx/symbolic/expr/expr.py +720 -0
- openscvx/symbolic/expr/lie/__init__.py +87 -0
- openscvx/symbolic/expr/lie/adjoint.py +357 -0
- openscvx/symbolic/expr/lie/se3.py +172 -0
- openscvx/symbolic/expr/lie/so3.py +138 -0
- openscvx/symbolic/expr/linalg.py +279 -0
- openscvx/symbolic/expr/math.py +699 -0
- openscvx/symbolic/expr/spatial.py +209 -0
- openscvx/symbolic/expr/state.py +607 -0
- openscvx/symbolic/expr/stl.py +136 -0
- openscvx/symbolic/expr/variable.py +321 -0
- openscvx/symbolic/hashing.py +112 -0
- openscvx/symbolic/lower.py +760 -0
- openscvx/symbolic/lowerers/__init__.py +106 -0
- openscvx/symbolic/lowerers/cvxpy.py +1302 -0
- openscvx/symbolic/lowerers/jax.py +1382 -0
- openscvx/symbolic/preprocessing.py +757 -0
- openscvx/symbolic/problem.py +110 -0
- openscvx/symbolic/time.py +116 -0
- openscvx/symbolic/unified.py +420 -0
- openscvx/utils/__init__.py +20 -0
- openscvx/utils/cache.py +131 -0
- openscvx/utils/caching.py +210 -0
- openscvx/utils/printing.py +301 -0
- openscvx/utils/profiling.py +37 -0
- openscvx/utils/utils.py +100 -0
- openscvx-0.3.2.dev170.dist-info/METADATA +350 -0
- openscvx-0.3.2.dev170.dist-info/RECORD +79 -0
- openscvx-0.3.2.dev170.dist-info/WHEEL +5 -0
- openscvx-0.3.2.dev170.dist-info/licenses/LICENSE +201 -0
- openscvx-0.3.2.dev170.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"""Symbolic expression package for trajectory optimization.
|
|
2
|
+
|
|
3
|
+
This package provides a comprehensive symbolic expression system for building
|
|
4
|
+
optimization problems in openscvx. It implements an Abstract Syntax Tree (AST)
|
|
5
|
+
framework that allows you to write optimization problems using natural mathematical
|
|
6
|
+
notation.
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
Import the package through the main openscvx module::
|
|
10
|
+
|
|
11
|
+
import openscvx as ox
|
|
12
|
+
|
|
13
|
+
# Create symbolic variables
|
|
14
|
+
x = ox.Variable("x", shape=(3,))
|
|
15
|
+
u = ox.Control("u", shape=(2,))
|
|
16
|
+
|
|
17
|
+
# Build expressions
|
|
18
|
+
cost = ox.Norm(x - [1, 2, 3])**2 + 0.1 * ox.Norm(u)**2
|
|
19
|
+
constraint = x[0] <= 5.0
|
|
20
|
+
|
|
21
|
+
Module Organization:
|
|
22
|
+
The package is organized into the following modules:
|
|
23
|
+
|
|
24
|
+
Core Expressions (expr.py):
|
|
25
|
+
Base classes and utilities including `Expr`, `Leaf`, `Parameter`, `Constant`,
|
|
26
|
+
and helper functions `to_expr` and `traverse`.
|
|
27
|
+
|
|
28
|
+
Arithmetic Operations (arithmetic.py):
|
|
29
|
+
Fundamental arithmetic operations including `Add`, `Sub`, `Mul`, `Div`,
|
|
30
|
+
`MatMul`, `Neg`, and `Power`.
|
|
31
|
+
|
|
32
|
+
Array Operations (array.py):
|
|
33
|
+
Array manipulation operations including `Index`, `Concat`, `Stack`, `Hstack`,
|
|
34
|
+
and `Vstack` for indexing, slicing, and combining arrays.
|
|
35
|
+
|
|
36
|
+
Constraints (constraint.py):
|
|
37
|
+
Constraint types including `Constraint`, `Equality`, `Inequality`,
|
|
38
|
+
`NodalConstraint`, and `CTCS` (Continuous-Time Constraint Satisfaction).
|
|
39
|
+
|
|
40
|
+
Optimization Variables (variable.py, state.py, control.py):
|
|
41
|
+
`Variable` for general optimization variables, `State` for time-varying state
|
|
42
|
+
in trajectory problems, and `Control` for control inputs.
|
|
43
|
+
|
|
44
|
+
Mathematical Functions (math.py):
|
|
45
|
+
Trigonometric functions (`Sin`, `Cos`), exponential functions (`Exp`, `Log`,
|
|
46
|
+
`Sqrt`, `Square`), and nonlinear functions (`PositivePart`, `Huber`,
|
|
47
|
+
`SmoothReLU`, `Max`).
|
|
48
|
+
|
|
49
|
+
Linear Algebra (linalg.py):
|
|
50
|
+
Matrix operations (`Transpose`, `Diag`) and reductions (`Sum`, `Norm`).
|
|
51
|
+
|
|
52
|
+
Spatial Operations (spatial.py):
|
|
53
|
+
6-DOF operations for aerospace and robotics including `QDCM` (Quaternion to
|
|
54
|
+
Direction Cosine Matrix), `SSMP` (4×4 skew-symmetric matrix for quaternion
|
|
55
|
+
dynamics), and `SSM` (3×3 skew-symmetric matrix for cross products).
|
|
56
|
+
|
|
57
|
+
Lie Algebra Operations (lie.py):
|
|
58
|
+
Lie algebra operations for rigid body dynamics. Built-in operators include
|
|
59
|
+
`AdjointDual` (coadjoint for Coriolis/centrifugal forces) and `Adjoint`
|
|
60
|
+
(Lie bracket). jaxlie-backed operators (requires `pip install openscvx[lie]`)
|
|
61
|
+
include `SO3Exp`, `SO3Log`, `SE3Exp`, and `SE3Log` for exponential and
|
|
62
|
+
logarithm maps on rotation and rigid transformation groups.
|
|
63
|
+
|
|
64
|
+
Constraint Specifications (constraint.py):
|
|
65
|
+
`NodalConstraint` for enforcing constraints at discrete nodes and `CTCS` for
|
|
66
|
+
continuous-time constraint satisfaction.
|
|
67
|
+
|
|
68
|
+
Signal Temporal Logic (stl.py):
|
|
69
|
+
`Or` for logical disjunction in task specifications.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
# Arithmetic operations
|
|
73
|
+
from .arithmetic import Add, Div, MatMul, Mul, Neg, Power, Sub
|
|
74
|
+
|
|
75
|
+
# Array operations
|
|
76
|
+
from .array import Block, Concat, Hstack, Index, Stack, Vstack
|
|
77
|
+
|
|
78
|
+
# Specialized constraints
|
|
79
|
+
from .constraint import (
|
|
80
|
+
CTCS,
|
|
81
|
+
Constraint,
|
|
82
|
+
CrossNodeConstraint,
|
|
83
|
+
Equality,
|
|
84
|
+
Inequality,
|
|
85
|
+
NodalConstraint,
|
|
86
|
+
ctcs,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Control
|
|
90
|
+
from .control import Control
|
|
91
|
+
|
|
92
|
+
# Core base classes and fundamental operations
|
|
93
|
+
from .expr import (
|
|
94
|
+
Constant,
|
|
95
|
+
Expr,
|
|
96
|
+
Leaf,
|
|
97
|
+
NodeReference,
|
|
98
|
+
Parameter,
|
|
99
|
+
to_expr,
|
|
100
|
+
traverse,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# Lie algebra operations
|
|
104
|
+
from .lie import (
|
|
105
|
+
Adjoint,
|
|
106
|
+
AdjointDual,
|
|
107
|
+
SE3Adjoint,
|
|
108
|
+
SE3AdjointDual,
|
|
109
|
+
SE3Exp,
|
|
110
|
+
SE3Log,
|
|
111
|
+
SO3Exp,
|
|
112
|
+
SO3Log,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Linear algebra operations
|
|
116
|
+
from .linalg import Diag, Norm, Sum, Transpose
|
|
117
|
+
|
|
118
|
+
# Mathematical functions
|
|
119
|
+
from .math import (
|
|
120
|
+
Abs,
|
|
121
|
+
Cos,
|
|
122
|
+
Exp,
|
|
123
|
+
Huber,
|
|
124
|
+
Log,
|
|
125
|
+
LogSumExp,
|
|
126
|
+
Max,
|
|
127
|
+
PositivePart,
|
|
128
|
+
Sin,
|
|
129
|
+
SmoothReLU,
|
|
130
|
+
Sqrt,
|
|
131
|
+
Square,
|
|
132
|
+
Tan,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Spatial/3D operations
|
|
136
|
+
from .spatial import QDCM, SSM, SSMP
|
|
137
|
+
|
|
138
|
+
# State
|
|
139
|
+
from .state import BoundaryType, Fixed, Free, Maximize, Minimize, State
|
|
140
|
+
|
|
141
|
+
# STL operations
|
|
142
|
+
from .stl import Or
|
|
143
|
+
|
|
144
|
+
# Variable
|
|
145
|
+
from .variable import Variable
|
|
146
|
+
|
|
147
|
+
__all__ = [
|
|
148
|
+
# Core base classes and fundamental operations
|
|
149
|
+
"Expr",
|
|
150
|
+
"Leaf",
|
|
151
|
+
"NodeReference",
|
|
152
|
+
"Parameter",
|
|
153
|
+
"to_expr",
|
|
154
|
+
"traverse",
|
|
155
|
+
"Add",
|
|
156
|
+
"Sub",
|
|
157
|
+
"Mul",
|
|
158
|
+
"Div",
|
|
159
|
+
"MatMul",
|
|
160
|
+
"Neg",
|
|
161
|
+
"Power",
|
|
162
|
+
"Sum",
|
|
163
|
+
"Index",
|
|
164
|
+
"Concat",
|
|
165
|
+
"Constant",
|
|
166
|
+
"Constraint",
|
|
167
|
+
"Equality",
|
|
168
|
+
"Inequality",
|
|
169
|
+
# Variable
|
|
170
|
+
"Variable",
|
|
171
|
+
# State
|
|
172
|
+
"State",
|
|
173
|
+
"BoundaryType",
|
|
174
|
+
"Free",
|
|
175
|
+
"Fixed",
|
|
176
|
+
"Minimize",
|
|
177
|
+
"Maximize",
|
|
178
|
+
# Control
|
|
179
|
+
"Control",
|
|
180
|
+
# Mathematical functions
|
|
181
|
+
"Sin",
|
|
182
|
+
"Cos",
|
|
183
|
+
"Tan",
|
|
184
|
+
"Sqrt",
|
|
185
|
+
"Abs",
|
|
186
|
+
"PositivePart",
|
|
187
|
+
"Square",
|
|
188
|
+
"Huber",
|
|
189
|
+
"SmoothReLU",
|
|
190
|
+
"Exp",
|
|
191
|
+
"Log",
|
|
192
|
+
"LogSumExp",
|
|
193
|
+
"Max",
|
|
194
|
+
# Linear algebra operations
|
|
195
|
+
"Transpose",
|
|
196
|
+
"Stack",
|
|
197
|
+
"Hstack",
|
|
198
|
+
"Vstack",
|
|
199
|
+
"Block",
|
|
200
|
+
"Norm",
|
|
201
|
+
"Diag",
|
|
202
|
+
# Spatial/3D operations
|
|
203
|
+
"QDCM",
|
|
204
|
+
"SSMP",
|
|
205
|
+
"SSM",
|
|
206
|
+
# Lie algebra operations
|
|
207
|
+
"AdjointDual",
|
|
208
|
+
"Adjoint",
|
|
209
|
+
"SE3Adjoint",
|
|
210
|
+
"SE3AdjointDual",
|
|
211
|
+
"SO3Exp",
|
|
212
|
+
"SO3Log",
|
|
213
|
+
"SE3Exp",
|
|
214
|
+
"SE3Log",
|
|
215
|
+
# Specialized constraints
|
|
216
|
+
"NodalConstraint",
|
|
217
|
+
"CrossNodeConstraint",
|
|
218
|
+
"CTCS",
|
|
219
|
+
"ctcs",
|
|
220
|
+
# STL operations
|
|
221
|
+
"Or",
|
|
222
|
+
]
|