[ prog / sol / mona ]

prog


Interactive constraint satisfaction

1 2024-01-12 20:15

At times, I need to make a list with several items and ensure that the contents of the list follow some arbitrary rules. Typically, a few items will be non-negotiable (so to speak) but the others can be arbitrary, and I can invent alternatives on the fly.

As an example, suppose I'm working with a list of colors. Two are decided by some outside context. I need to come up with four more within the same perceptual brightness range, and no pair of colors can be too similar in hue.

For each item in the list, I want to be able to store alternatives, even if they currently conflict with something else in the list. I also want to be able to quickly switch from the currently chosen alternative to any of the others, and see live updates as new conflicts appear.

My intuition is that there's already some way to do all this with an Emacs mode, maybe org-mode. If not, I could implement it as a GUI tool of some kind, but if it can already be done through Emacs, I'd rather use Emacs.

2 2024-01-12 22:33

This reads like my project to update emacs in 4D

3 2024-01-15 10:23

How "interactive" does this have to be? Play with MiniZinc for a few days, their "IDE" (text editor + syntax coloring + some Solve / Select Solver etc. buttons) is OK enough for iterating something like this. Formulating the problem precisely and correctly into their language would be the more challenging/learning part here. Way more programmer-friendly than the usual solver-system syntaxes out there tho, imo.

This is assuming it isn't something you need your own program / project / code-base to be able to do, but some sort of you-specific local scenario (one-off or repeated). But if the former, you could also check out what solver libs out there are bindable to your lang / stack and seem usable. Maybe G's "OR-Tools", maybe something else.

4 2024-01-16 03:00

>>3
My highest priority is interactivity. I don't necessarily know every rule I might encode when I begin exploring alternatives. Some of these rules are highly special case and effectively a matter of taste.

I will probably end up writing a GUI tool for this. In some cases I may want support for images.

5 2024-01-16 10:40

Maybe Sussman's work on propogators would help you? I don't remember how it would behave if manipulated interactively.

6 2024-01-26 18:04

>>2

emacs in 4D

A man can dream.

7


VIP:

do not edit these