We did a bunch of projects that used constraints a few years back. One of them is called
Inkling (here's the
silly website I made for it). It used a relaxation-based solver called
uncmin, which AFAIK is a port of a java port of some old fortran thing. But, it works really damn well. For Inkling, Alex Warth wrote a little
constraint system around the solver. Our use case was focused on constraining geometric objects in space, so we cared about things like the difference between solving in polar coords (good) vs cartesian (bad). But ultimately it's all just "here are a bunch of variables, and here are some limits on how they're allowed to change" and then you crank the solver over and over and it wiggles the variables until they converge on good values (ideally), or it blows up :)
Guillermo Webster made a little graphics library called
g9 that includes a
reworked version of uncmin, but it didn't work as well for us.
Another keyword you might want to explore is "gradient descent".
Good luck! Feel free to ask me any questions and I'll help if I can.