Files
solver/README.md
forbes-0023 98051ba0c9 feat: add Phase 1 constraint solver addon, move prior content to GNN/
- Move existing OndselSolver, GNN ML layer, and tooling into GNN/
  directory for integration in later phases
- Add Create addon scaffold: package.xml, Init.py
- Add expression DAG with eval, symbolic diff, simplification
- Add parameter table with fixed/free variable tracking
- Add quaternion rotation as polynomial Expr trees
- Add RigidBody entity (7 DOF: position + unit quaternion)
- Add constraint classes: Coincident, DistancePointPoint, Fixed
- Add Newton-Raphson solver with symbolic Jacobian + numpy lstsq
- Add pre-solve passes: substitution + single-equation
- Add DOF counting via Jacobian SVD rank
- Add KindredSolver IKCSolver bridge for kcsolve integration
- Add 82 unit tests covering all modules

Registers as 'kindred' solver via kcsolve.register_solver() when
loaded by Create's addon_loader.
2026-02-20 20:35:47 -06:00

65 lines
2.5 KiB
Markdown

# Kindred Solver
Assembly constraint solver addon for [Kindred Create](https://git.kindred-systems.com/kindred/create). Implements the `IKCSolver` interface via `kcsolve.register_solver()`.
## Components
### Kindred Solver (Phase 1)
Expression-based Newton-Raphson constraint solver. Pure Python, registered as a Create addon.
- Expression DAG with eval, symbolic differentiation, simplification: `kindred_solver/expr.py`
- Parameter table with fixed/free tracking: `kindred_solver/params.py`
- Quaternion rotation as polynomial Expr trees: `kindred_solver/quat.py`
- RigidBody entity (7 params: position + unit quaternion): `kindred_solver/entities.py`
- Constraint residual generators (Coincident, DistancePointPoint, Fixed): `kindred_solver/constraints.py`
- Newton-Raphson solver with symbolic Jacobian: `kindred_solver/newton.py`
- Pre-solve passes (substitution, single-equation): `kindred_solver/prepass.py`
- DOF counting via Jacobian rank: `kindred_solver/dof.py`
- KCSolve IKCSolver bridge: `kindred_solver/solver.py`
### GNN (future phases)
Graph neural network constraint prediction layer. OndselSolver C++ engine and ML training infrastructure. Moved to `GNN/` — will be integrated in later phases.
## Create Addon Integration
This repo is a git submodule at `mods/solver/` in the Create repository. The addon loader discovers `package.xml` and executes `Init.py`, which registers the solver:
```python
import kcsolve
from kindred_solver import KindredSolver
kcsolve.register_solver("kindred", KindredSolver)
```
## Testing
```bash
python3 -m venv .venv && . .venv/bin/activate
pip install pytest numpy
PYTHONPATH=. pytest tests/ -v
```
## Repository Structure
```
├── package.xml # Create addon manifest
├── Init.py # Solver registration entry point
├── kindred_solver/ # Phase 1: expression-based Newton solver
│ ├── expr.py # Expression DAG
│ ├── params.py # Parameter table
│ ├── quat.py # Quaternion math as Expr trees
│ ├── entities.py # RigidBody entity
│ ├── constraints.py # Constraint residual generators
│ ├── newton.py # Newton-Raphson solver
│ ├── prepass.py # Pre-solve passes
│ ├── dof.py # DOF counting
│ └── solver.py # IKCSolver bridge
├── tests/ # Unit tests (82 tests)
└── GNN/ # GNN solver layer (future phases)
```
## License
LGPL-2.1-or-later (see [LICENSE](LICENSE))