sci-solver 0.1.0__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.
Files changed (51) hide show
  1. sci_solver-0.1.0/CITATION.cff +11 -0
  2. sci_solver-0.1.0/LICENSE +202 -0
  3. sci_solver-0.1.0/MANIFEST.in +7 -0
  4. sci_solver-0.1.0/NOTICE +10 -0
  5. sci_solver-0.1.0/PKG-INFO +141 -0
  6. sci_solver-0.1.0/README.md +113 -0
  7. sci_solver-0.1.0/UPSTREAM.json +62 -0
  8. sci_solver-0.1.0/docs/api.md +62 -0
  9. sci_solver-0.1.0/docs/migration.md +49 -0
  10. sci_solver-0.1.0/docs/release-notes.md +14 -0
  11. sci_solver-0.1.0/docs/releasing.md +50 -0
  12. sci_solver-0.1.0/examples/config.json +12 -0
  13. sci_solver-0.1.0/examples/fleet.py +37 -0
  14. sci_solver-0.1.0/examples/two_robots.py +37 -0
  15. sci_solver-0.1.0/pyproject.toml +56 -0
  16. sci_solver-0.1.0/setup.cfg +4 -0
  17. sci_solver-0.1.0/setup.py +20 -0
  18. sci_solver-0.1.0/src/sci_solver/__init__.py +9 -0
  19. sci_solver-0.1.0/src/sci_solver/api.py +76 -0
  20. sci_solver-0.1.0/src/sci_solver/cli/__init__.py +1 -0
  21. sci_solver-0.1.0/src/sci_solver/cli/vector_sci.py +142 -0
  22. sci_solver-0.1.0/src/sci_solver/config.py +138 -0
  23. sci_solver-0.1.0/src/sci_solver/evaluation.py +22 -0
  24. sci_solver-0.1.0/src/sci_solver/solvers/__init__.py +4 -0
  25. sci_solver-0.1.0/src/sci_solver/solvers/_cubic_minima.c +177 -0
  26. sci_solver-0.1.0/src/sci_solver/solvers/base.py +95 -0
  27. sci_solver-0.1.0/src/sci_solver/solvers/collision_search.py +66 -0
  28. sci_solver-0.1.0/src/sci_solver/solvers/contact_solver.py +583 -0
  29. sci_solver-0.1.0/src/sci_solver/solvers/cubic_utils.py +128 -0
  30. sci_solver-0.1.0/src/sci_solver/solvers/matching_numerics.py +170 -0
  31. sci_solver-0.1.0/src/sci_solver/solvers/reaction_matching.py +127 -0
  32. sci_solver-0.1.0/src/sci_solver/solvers/vector_matching.py +214 -0
  33. sci_solver-0.1.0/src/sci_solver.egg-info/PKG-INFO +141 -0
  34. sci_solver-0.1.0/src/sci_solver.egg-info/SOURCES.txt +49 -0
  35. sci_solver-0.1.0/src/sci_solver.egg-info/dependency_links.txt +1 -0
  36. sci_solver-0.1.0/src/sci_solver.egg-info/entry_points.txt +2 -0
  37. sci_solver-0.1.0/src/sci_solver.egg-info/requires.txt +9 -0
  38. sci_solver-0.1.0/src/sci_solver.egg-info/top_level.txt +1 -0
  39. sci_solver-0.1.0/tests/data/fleet20_seed15.npz +0 -0
  40. sci_solver-0.1.0/tests/data/fleet20_seed2.npz +0 -0
  41. sci_solver-0.1.0/tests/data/fleet20_seed35.npz +0 -0
  42. sci_solver-0.1.0/tests/data/fleet20_seed47.npz +0 -0
  43. sci_solver-0.1.0/tests/data/fleet20_seed9.npz +0 -0
  44. sci_solver-0.1.0/tests/test_api.py +65 -0
  45. sci_solver-0.1.0/tests/test_collision_search.py +77 -0
  46. sci_solver-0.1.0/tests/test_cubic_separation.py +71 -0
  47. sci_solver-0.1.0/tests/test_provenance.py +16 -0
  48. sci_solver-0.1.0/tests/test_vector_solver.py +579 -0
  49. sci_solver-0.1.0/tools/compare_upstream.py +142 -0
  50. sci_solver-0.1.0/validation/local-validation.json +50 -0
  51. sci_solver-0.1.0/validation/upstream-comparison.json +1572 -0
@@ -0,0 +1,11 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use SCI Solver, please cite this software and the accompanying paper when available."
3
+ type: software
4
+ title: "SCI: Sequential Contact Insertion"
5
+ authors:
6
+ - family-names: Kamm
7
+ given-names: Jan
8
+ version: 0.1.0
9
+ license: Apache-2.0
10
+ repository-code: "https://github.com/jankammeth/sci"
11
+ abstract: "Continuous-time robot fleet planning with sequential contact insertion."
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ include LICENSE NOTICE CITATION.cff UPSTREAM.json
2
+ recursive-include docs *.md
3
+ recursive-include examples *.py *.json
4
+ recursive-include tests *.py *.npz
5
+ recursive-include tools *.py
6
+ recursive-include validation *.json
7
+ include src/sci_solver/solvers/_cubic_minima.c
@@ -0,0 +1,10 @@
1
+ SCI — Sequential Contact Insertion
2
+ Copyright 2026 Jan Kamm
3
+
4
+ This distribution derives from https://github.com/jankammeth/contact-solver,
5
+ commit 641a2341a6a59938e285b8ff872bd484713e0605, whose package metadata declares
6
+ Apache-2.0. UPSTREAM.json identifies the unchanged numerical source files.
7
+
8
+ Packaging, configuration, and convenience API changes are recorded in this
9
+ repository. Historical experiments remain in the source repository and the
10
+ associated paper repository.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: sci-solver
3
+ Version: 0.1.0
4
+ Summary: Sequential Contact Insertion for continuous-time robot fleet planning.
5
+ Author: Jan Kamm
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/jankammeth/sci
8
+ Project-URL: Repository, https://github.com/jankammeth/sci
9
+ Project-URL: Documentation, https://github.com/jankammeth/sci/tree/main/docs
10
+ Project-URL: Issues, https://github.com/jankammeth/sci/issues
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: C
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ License-File: NOTICE
20
+ Requires-Dist: numpy>=1.23
21
+ Requires-Dist: scipy>=1.10
22
+ Provides-Extra: plot
23
+ Requires-Dist: matplotlib>=3.7; extra == "plot"
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=8; extra == "dev"
26
+ Requires-Dist: ruff>=0.6; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # SCI — Sequential Contact Insertion
30
+
31
+ Continuous-time motion planning for robot fleets, using analytic cubic trajectories
32
+ and a progressively constructed set of contacts.
33
+
34
+ SCI plans for at least two robots in two or more spatial dimensions with prescribed
35
+ endpoint positions and velocities, a fixed horizon, and a shared minimum pairwise
36
+ distance. It minimizes squared acceleration through local contact matching and
37
+ checks separation over the entire trajectory.
38
+
39
+ ## Installation
40
+
41
+ Python 3.10 or newer is required. After the first PyPI release:
42
+
43
+ ```sh
44
+ pip install sci-solver
45
+ ```
46
+
47
+ To install directly from GitHub now:
48
+
49
+ ```sh
50
+ python -m pip install git+https://github.com/jankammeth/sci.git
51
+ ```
52
+
53
+ Or install a local checkout:
54
+
55
+ ```sh
56
+ python -m pip install .
57
+ ```
58
+
59
+ NumPy and SciPy are the only runtime dependencies. Supported binary wheels include
60
+ the C collision checker. A source installation builds it when a C compiler is
61
+ available; otherwise it uses the slower Python checker and emits a warning on use.
62
+ The chosen backend is reported in `solution.metrics["collision_backend"]`.
63
+
64
+ ## Quick start
65
+
66
+ ```python
67
+ import numpy as np
68
+ from sci_solver import SolverConfig, solve
69
+
70
+ solution = solve(
71
+ initial_positions=[[-2, -0.2], [2, 0.2]],
72
+ final_positions=[[2, -0.2], [-2, 0.2]],
73
+ time_horizon=5.0,
74
+ min_distance=1.0,
75
+ options=SolverConfig(sci_detection_tol=1e-6),
76
+ )
77
+ if not solution.success:
78
+ raise RuntimeError(solution.metrics["convergence_reason"])
79
+
80
+ times = np.linspace(0, 5, 201)
81
+ positions = solution.sample(times) # (2 robots, 201 times, 2 dimensions)
82
+ velocities = solution.sample(times, derivative=1)
83
+ print(solution.acceleration_cost)
84
+ print(solution.metrics["min_distance"])
85
+ ```
86
+
87
+ Omitted endpoint velocities are zero. Sampling is postprocessing and does not
88
+ determine whether a trajectory passes separation checks. `solution.contacts`
89
+ contains the solved contact states, and `solution.trajectory` exposes the cubic
90
+ coefficients and knot times.
91
+
92
+ ## Examples
93
+
94
+ ```sh
95
+ python -m pip install '.[plot]'
96
+ python examples/two_robots.py --output outputs/two-robots.png
97
+ python examples/fleet.py --output outputs/fleet.png
98
+ sci-solve --smoke --output outputs/smoke.json
99
+ ```
100
+
101
+ The plotting dependency is optional. Both examples also run without plotting when
102
+ `--output` is omitted. The CLI accepts saved NPZ endpoint states and a JSON config;
103
+ see [the API guide](docs/api.md).
104
+
105
+ ## Numerical scope
106
+
107
+ The solver uses the current contact insertion, contact removal, banded Newton,
108
+ sparse fallback, and condensed reaction recovery implementation. It is a local
109
+ numerical method: convergence and global optimality are not guaranteed. The
110
+ continuous collision checks use floating-point polynomial calculations, rather
111
+ than interval-arithmetic certificates. Obstacles and finite position, velocity,
112
+ acceleration, or jerk bounds are outside this release's scope.
113
+
114
+ Always inspect `solution.success`. An unsuccessful solve retains its last iterate
115
+ and diagnostics; it is not a usable collision-free plan. Tolerances are absolute
116
+ and should be chosen for the physical scale of the problem. The reference default
117
+ separation allowance is zero; the examples explicitly use `1e-6`.
118
+
119
+ ## Development and provenance
120
+
121
+ ```sh
122
+ python -m pip install -e '.[dev,plot]'
123
+ python -m pytest
124
+ ruff check .
125
+ ```
126
+
127
+ The numerical implementation is preserved from
128
+ [`contact-solver` at `641a234`](https://github.com/jankammeth/contact-solver/tree/641a2341a6a59938e285b8ff872bd484713e0605).
129
+ [UPSTREAM.json](UPSTREAM.json) records source paths, SHA-256 hashes, and every
130
+ extraction edit. Six core files are byte-identical. The collision wrapper changes
131
+ only the package name in its fallback warning; the C kernel adds equivalent
132
+ stack workspace allocation for Microsoft's C compiler. Numerical formulas and
133
+ control flow are unchanged.
134
+ [The migration guide](docs/migration.md) describes the extraction and comparison
135
+ procedure. The paper and historical experiment infrastructure remain separate.
136
+
137
+ This software accompanies *Contact-based motion planning for robot fleets*.
138
+ Software citation metadata is in [CITATION.cff](CITATION.cff). Publication metadata
139
+ for the manuscript will be added when available.
140
+
141
+ Licensed under Apache-2.0; see [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,113 @@
1
+ # SCI — Sequential Contact Insertion
2
+
3
+ Continuous-time motion planning for robot fleets, using analytic cubic trajectories
4
+ and a progressively constructed set of contacts.
5
+
6
+ SCI plans for at least two robots in two or more spatial dimensions with prescribed
7
+ endpoint positions and velocities, a fixed horizon, and a shared minimum pairwise
8
+ distance. It minimizes squared acceleration through local contact matching and
9
+ checks separation over the entire trajectory.
10
+
11
+ ## Installation
12
+
13
+ Python 3.10 or newer is required. After the first PyPI release:
14
+
15
+ ```sh
16
+ pip install sci-solver
17
+ ```
18
+
19
+ To install directly from GitHub now:
20
+
21
+ ```sh
22
+ python -m pip install git+https://github.com/jankammeth/sci.git
23
+ ```
24
+
25
+ Or install a local checkout:
26
+
27
+ ```sh
28
+ python -m pip install .
29
+ ```
30
+
31
+ NumPy and SciPy are the only runtime dependencies. Supported binary wheels include
32
+ the C collision checker. A source installation builds it when a C compiler is
33
+ available; otherwise it uses the slower Python checker and emits a warning on use.
34
+ The chosen backend is reported in `solution.metrics["collision_backend"]`.
35
+
36
+ ## Quick start
37
+
38
+ ```python
39
+ import numpy as np
40
+ from sci_solver import SolverConfig, solve
41
+
42
+ solution = solve(
43
+ initial_positions=[[-2, -0.2], [2, 0.2]],
44
+ final_positions=[[2, -0.2], [-2, 0.2]],
45
+ time_horizon=5.0,
46
+ min_distance=1.0,
47
+ options=SolverConfig(sci_detection_tol=1e-6),
48
+ )
49
+ if not solution.success:
50
+ raise RuntimeError(solution.metrics["convergence_reason"])
51
+
52
+ times = np.linspace(0, 5, 201)
53
+ positions = solution.sample(times) # (2 robots, 201 times, 2 dimensions)
54
+ velocities = solution.sample(times, derivative=1)
55
+ print(solution.acceleration_cost)
56
+ print(solution.metrics["min_distance"])
57
+ ```
58
+
59
+ Omitted endpoint velocities are zero. Sampling is postprocessing and does not
60
+ determine whether a trajectory passes separation checks. `solution.contacts`
61
+ contains the solved contact states, and `solution.trajectory` exposes the cubic
62
+ coefficients and knot times.
63
+
64
+ ## Examples
65
+
66
+ ```sh
67
+ python -m pip install '.[plot]'
68
+ python examples/two_robots.py --output outputs/two-robots.png
69
+ python examples/fleet.py --output outputs/fleet.png
70
+ sci-solve --smoke --output outputs/smoke.json
71
+ ```
72
+
73
+ The plotting dependency is optional. Both examples also run without plotting when
74
+ `--output` is omitted. The CLI accepts saved NPZ endpoint states and a JSON config;
75
+ see [the API guide](docs/api.md).
76
+
77
+ ## Numerical scope
78
+
79
+ The solver uses the current contact insertion, contact removal, banded Newton,
80
+ sparse fallback, and condensed reaction recovery implementation. It is a local
81
+ numerical method: convergence and global optimality are not guaranteed. The
82
+ continuous collision checks use floating-point polynomial calculations, rather
83
+ than interval-arithmetic certificates. Obstacles and finite position, velocity,
84
+ acceleration, or jerk bounds are outside this release's scope.
85
+
86
+ Always inspect `solution.success`. An unsuccessful solve retains its last iterate
87
+ and diagnostics; it is not a usable collision-free plan. Tolerances are absolute
88
+ and should be chosen for the physical scale of the problem. The reference default
89
+ separation allowance is zero; the examples explicitly use `1e-6`.
90
+
91
+ ## Development and provenance
92
+
93
+ ```sh
94
+ python -m pip install -e '.[dev,plot]'
95
+ python -m pytest
96
+ ruff check .
97
+ ```
98
+
99
+ The numerical implementation is preserved from
100
+ [`contact-solver` at `641a234`](https://github.com/jankammeth/contact-solver/tree/641a2341a6a59938e285b8ff872bd484713e0605).
101
+ [UPSTREAM.json](UPSTREAM.json) records source paths, SHA-256 hashes, and every
102
+ extraction edit. Six core files are byte-identical. The collision wrapper changes
103
+ only the package name in its fallback warning; the C kernel adds equivalent
104
+ stack workspace allocation for Microsoft's C compiler. Numerical formulas and
105
+ control flow are unchanged.
106
+ [The migration guide](docs/migration.md) describes the extraction and comparison
107
+ procedure. The paper and historical experiment infrastructure remain separate.
108
+
109
+ This software accompanies *Contact-based motion planning for robot fleets*.
110
+ Software citation metadata is in [CITATION.cff](CITATION.cff). Publication metadata
111
+ for the manuscript will be added when available.
112
+
113
+ Licensed under Apache-2.0; see [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,62 @@
1
+ {
2
+ "upstream_repository": "https://github.com/jankammeth/contact-solver",
3
+ "upstream_commit": "641a2341a6a59938e285b8ff872bd484713e0605",
4
+ "core_files": {
5
+ "src/sci_solver/solvers/base.py": {
6
+ "upstream_path": "src/contact_solver/solvers/base.py",
7
+ "sha256": "a3d1e66c04f57d69eb7fb9eb0416d77ce60c9360e9448c22b3c4da3ff7080a30",
8
+ "extracted_sha256": "a3d1e66c04f57d69eb7fb9eb0416d77ce60c9360e9448c22b3c4da3ff7080a30"
9
+ },
10
+ "src/sci_solver/solvers/contact_solver.py": {
11
+ "upstream_path": "src/contact_solver/solvers/contact_solver.py",
12
+ "sha256": "9ae40bc11838b8fc0ca76f439f21af878d27669f3d3440bfd8519196e624b7a1",
13
+ "extracted_sha256": "9ae40bc11838b8fc0ca76f439f21af878d27669f3d3440bfd8519196e624b7a1"
14
+ },
15
+ "src/sci_solver/solvers/collision_search.py": {
16
+ "upstream_path": "src/contact_solver/solvers/collision_search.py",
17
+ "sha256": "d02cf8b7a045a7b8edf964072d52a42f23e590e1bb50453f02b1ca230ce855f3",
18
+ "extracted_sha256": "9667839d4a5a724591de4540ffaa7eb607f88c6803aff7981ea46a702ee34c3c",
19
+ "text_replacements": [
20
+ {
21
+ "old": "Reinstall contact-solver",
22
+ "new": "Reinstall sci-solver"
23
+ }
24
+ ]
25
+ },
26
+ "src/sci_solver/solvers/cubic_utils.py": {
27
+ "upstream_path": "src/contact_solver/solvers/cubic_utils.py",
28
+ "sha256": "198ed08248d1648f0c196ed346a3a0a3e139662d728e98ef42f1701d40971a18",
29
+ "extracted_sha256": "198ed08248d1648f0c196ed346a3a0a3e139662d728e98ef42f1701d40971a18"
30
+ },
31
+ "src/sci_solver/solvers/matching_numerics.py": {
32
+ "upstream_path": "src/contact_solver/solvers/matching_numerics.py",
33
+ "sha256": "e10f5dbf0747163754355cdffd62b9067b2dea82a31d72222e368f67f7a8cd66",
34
+ "extracted_sha256": "e10f5dbf0747163754355cdffd62b9067b2dea82a31d72222e368f67f7a8cd66"
35
+ },
36
+ "src/sci_solver/solvers/reaction_matching.py": {
37
+ "upstream_path": "src/contact_solver/solvers/reaction_matching.py",
38
+ "sha256": "6efdce28648e49c9418f1a42da3d93cb4636112c561e9da3f9c29a64fc3b7b70",
39
+ "extracted_sha256": "6efdce28648e49c9418f1a42da3d93cb4636112c561e9da3f9c29a64fc3b7b70"
40
+ },
41
+ "src/sci_solver/solvers/vector_matching.py": {
42
+ "upstream_path": "src/contact_solver/solvers/vector_matching.py",
43
+ "sha256": "326ffe29e94e4f5e080d4224fd7ab4fb4d38a14789ab9345d5985232c3b9d358",
44
+ "extracted_sha256": "326ffe29e94e4f5e080d4224fd7ab4fb4d38a14789ab9345d5985232c3b9d358"
45
+ },
46
+ "src/sci_solver/solvers/_cubic_minima.c": {
47
+ "upstream_path": "src/contact_solver/solvers/_cubic_minima.c",
48
+ "sha256": "02cd37c047bc0df602ff8da1a64c1a80ca926b3519bf584fd8d8879f7dacba9e",
49
+ "extracted_sha256": "7b2730c03652ae121191a81ef22e31a9283bc3f779f3e6a5465d14d947e32a97",
50
+ "text_replacements": [
51
+ {
52
+ "old": "#include <stdlib.h>\n",
53
+ "new": "#include <stdlib.h>\n#ifdef _MSC_VER\n#include <malloc.h>\n#endif\n"
54
+ },
55
+ {
56
+ "old": " double controls[4*d],direction[d],delta[d],sq=0,dot=0,magnitude=0;\n",
57
+ "new": "#ifdef _MSC_VER\n /* MSVC has no C variable-length arrays; retain the same stack workspace. */\n double *controls=_alloca((size_t)4*d*sizeof(double));\n double *direction=_alloca((size_t)d*sizeof(double));\n double *delta=_alloca((size_t)d*sizeof(double));\n double sq=0,dot=0,magnitude=0;\n#else\n double controls[4*d],direction[d],delta[d],sq=0,dot=0,magnitude=0;\n#endif\n"
58
+ }
59
+ ]
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,62 @@
1
+ # API and numerical options
2
+
3
+ `solve(initial_positions, final_positions, *, time_horizon, min_distance,
4
+ initial_velocities=None, final_velocities=None, options=None)` returns a `Solution`.
5
+ Endpoint arrays have shape `(N, d)` with `N >= 2` and `d >= 2`.
6
+
7
+ ## Results
8
+
9
+ | Member | Meaning |
10
+ | --- | --- |
11
+ | `success` | Matching checks and continuous separation both passed. |
12
+ | `sample(times, derivative=0)` | Array with shape `(N, len(times), d)`; derivative orders 0–3. |
13
+ | `trajectory` | Knot times, relative cubic coefficients, and barycenter coefficients. |
14
+ | `contacts` | Pair indices, times, normals, relative velocities, and reaction masses. |
15
+ | `acceleration_cost` | Integrated sum of squared robot accelerations. |
16
+ | `metrics` | Status, reason, residuals, separation, backend, timing, and recovery details. |
17
+
18
+ Times may be unordered but must be finite and inside the horizon. At a contact,
19
+ the third derivative uses the segment to its right; the final endpoint uses the
20
+ last segment. Orders 0–2 are continuous up to the matching tolerance.
21
+
22
+ ## Options
23
+
24
+ Pass `SolverConfig(...)` through `options`. Defaults match the reference implementation.
25
+
26
+ | Option | Default | Meaning |
27
+ | --- | --- | --- |
28
+ | `sci_detection_tol` | `0.0` | Allowed absolute separation deficit. |
29
+ | `sci_residual_tol` | `1e-7` | Matching and endpoint residual tolerance. |
30
+ | `sci_mass_tol` | `1e-9` | Allowed negative reaction mass within tolerance. |
31
+ | `sci_min_contact_gap` | `0.0` | Minimum knot gap; zero still requires strict ordering. |
32
+ | `sci_root_max_iterations` | `100` | Newton iterations per matching solve. |
33
+ | `sci_reaction_recovery` | `True` | Enable condensed recovery when matching fails. |
34
+ | `timeout` | `300.0` | Cooperative solve deadline in seconds. |
35
+ | `use_analytical_jacobian` | `True` | Use the analytical matching Jacobian. |
36
+
37
+ Statuses are `success`, `unresolved`, `root_failure`, and `invalid_solution`.
38
+ `metrics["convergence_reason"]` supplies details. Unsuccessful iterates remain
39
+ available for diagnosis. The deadline is checked between numerical operations;
40
+ it does not interrupt an in-progress linear solve.
41
+
42
+ For direct control, use `Config`, `ProblemConfig`, and `ContactSolver`, followed by
43
+ `set_initial_states`, `set_final_states`, and `generate_trajectories`. This retains
44
+ the reference interface. Its `ProblemConfig.timestep` is a legacy configuration
45
+ field used by automatic horizon selection when the horizon is omitted; it does
46
+ not discretize contact matching or collision checking. The convenience `solve`
47
+ function requires an explicit horizon.
48
+
49
+ ## Saved problems
50
+
51
+ ```sh
52
+ sci-solve --states endpoints.npz --config examples/config.json \
53
+ --output outputs/metrics.json --trajectories outputs/trajectories.npz
54
+ ```
55
+
56
+ Input NPZ keys are `initial_positions`, `final_positions`, and optionally
57
+ `initial_velocities`, `final_velocities`. JSON configuration uses `problem` and
58
+ `solver` objects; unknown fields are rejected. `Config.to_json` and
59
+ `Config.from_json` support roundtrips without a YAML dependency.
60
+
61
+ The CLI exits zero only for a successful solve. Sampled output includes times,
62
+ positions, velocities, accelerations, contact states, and contact pairs.
@@ -0,0 +1,49 @@
1
+ # Extraction from contact-solver
2
+
3
+ Reference: `https://github.com/jankammeth/contact-solver`, commit
4
+ `641a2341a6a59938e285b8ff872bd484713e0605`.
5
+
6
+ Six of the eight files listed in `UPSTREAM.json` are byte-identical to the
7
+ reference. The collision wrapper changes only `contact-solver` to `sci-solver`
8
+ in the reinstall warning. The C kernel uses `_alloca` for the same three stack
9
+ arrays under MSVC, which does not support C variable-length arrays. Other
10
+ compilers retain the original declarations. Numerical formulas and control flow
11
+ are unchanged; `UPSTREAM.json` records both edits as explicit text replacements.
12
+ They contain the joint solver, cubic representation, matching equations,
13
+ derivatives, nonlinear solve safeguards, recovery, and collision kernels.
14
+ The test suite retains independent polynomial, derivative, endpoint, reaction,
15
+ contact-removal, and larger-fleet checks from that implementation.
16
+
17
+ The package boundary changes from `contact_solver` to `sci_solver`; distribution
18
+ metadata changes to `sci-solver`. The new root import exposes only the joint solver
19
+ and its configuration/API. It does not import plotting, baselines, or scenario
20
+ generation. Configuration uses standard dataclasses and JSON. Original YAML
21
+ experiment configuration remains in the historical repository.
22
+
23
+ `solve` and `Solution` wrap the reference class. The CLI retains its saved-state
24
+ interface and deterministic smoke problems, with JSON replacing YAML and OSQP
25
+ removed from the environment report. Plotting is an optional example dependency.
26
+
27
+ ## Numerical comparison
28
+
29
+ `tools/compare_upstream.py` compares the installed package against a checkout of
30
+ the reference commit. Install the reference package in a separate environment,
31
+ then pass its interpreter and checkout paths. The reference environment needs
32
+ the original package's declared dependencies.
33
+
34
+ ```sh
35
+ python tools/compare_upstream.py \
36
+ --upstream /path/to/contact-solver \
37
+ --upstream-python /path/to/reference-venv/bin/python \
38
+ --output validation/upstream-comparison.json
39
+ ```
40
+
41
+ The comparison checks source hashes, statuses, contacts, removal/recovery events,
42
+ continuous separation, matching residuals, cost, and sampled derivatives. Timing
43
+ is recorded as environment-dependent evidence, not required to match. It includes
44
+ nonzero velocities, multidimensional cases, five saved 20-robot regressions, and
45
+ unsuccessful solves. Original and extracted solvers run in separate processes.
46
+
47
+ The existing `contact-solver` repository and the paper's pinned historical submodule
48
+ remain available for reproducibility. New joint-solver development belongs here;
49
+ the paper integration should select a recorded SCI commit explicitly.