#constraint-solver #zoo #system #studio #design #2d #kcl #benchmark

kcl-ezpz

A constraint solver for KCL and Zoo Design Studio

4 releases

Uses new Rust 2024

new 0.1.5 Nov 6, 2025
0.1.4 Oct 24, 2025
0.1.3 Oct 22, 2025
0.1.0 Oct 3, 2025

#2 in #studio

Download history 237/week @ 2025-10-02 662/week @ 2025-10-09 3843/week @ 2025-10-16 1814/week @ 2025-10-23 2457/week @ 2025-10-30

8,820 downloads per month
Used in 2 crates (via kcl-lib)

MIT license

155KB
3.5K SLoC

EZPZ

Constraint solver for use in Zoo Design Studio, or wherever you want to use it.

Overview

This project has 3 Rust crates:

  • kcl-ezpz: The core constraint solver library
  • ezpz-cli: A CLI tool that lets you easily solve, analyze and benchmark constraint systems using kcl-ezpz.
  • ezpz-wasm: A WebAssembly library that wraps kcl-ezpz and exposes a few core functions. Intended for the ezpz maintainers to check if kcl-ezpz compiles and works in WebAssembly, and to benchmark its performance vs. native code.
  • Users probably won't need to use this library yourself, it's really intended as a sample application for the maintainers to test with.
  • Users should probably integrate kcl-ezpz into your web projects directly.

Development

New developers should read CONTRIBUTING.md

Using the CLI

The CLI lets you pass a constraint problem file (described below) and analyze it, solve it, visualize the solution and benchmark how long it took.

Here's a quick video demo:

https://github.com/user-attachments/assets/62a2d4ab-490f-48e5-aa0a-7a2b192fc938

First, install it. From this repo's root, run:

cargo install --path ezpz-cli

Then you can use it like this, by passing it a constraint problem file:

$ ezpz --filepath myconstraints.txt
Problem size: 2000 rows, 2000 vars
Iterations needed: 2
Solved in 2943μs (mean over 100 iterations)
i.e. 339 solves per second

You can also add the --gnuplot option to visualize the resulting points in a gnuplot window, or --gnuplot-png-path points.png to write the visualization to a PNG at the given path instead. If you'd rather print the final points to stdout and process them in your own tool, use --show-points instead.

Constraint problem files

ezpz defines a text format for writing out constraint problems. You don't have to use this format -- you can use the Rust library directly -- but it's a very convenient format. It looks like this:

# constraints
point p
point q
p.x = 0
p.y = 0
q.y = 0
vertical(p, q)

# guesses
p roughly (3, 4)
q roughly (5, 6)

There's two sections, Constraints and Guesses. You define each point (like p and q) and once defined, you can write constraints that use them. For example, you can fix a point's X or Y component (p.x = 0). Or you can relate two points, e.g. vertical(p, q).

For more examples, see the test_cases/ directory.

Dependencies

~15MB
~322K SLoC