Hacker News new | past | comments | ask | show | jobs | submit login

What exactly is "constraint modeling" and what is it used for?



Scheduling is probably the most obvious example of a real problem. You’ve got a space that has many different ways of being bounded and need to efficiently search that space.

Physical design systems (modeling possible boat hulls, say—not the physics itself but the interaction of numerous variables) and resource allocation (drafting a baseball team, say) seem like other likely areas, though I’ve got no idea if constraint tools are the best option or whether they’re even used.

Broadly: if a multivariate problem can’t be modeled, a constraint-based search strategy is the(/one) next-best tool.


I've wanted to do this myself... Tho as both an armchair engineer and an armchair programmer. If I'd gotten through engineering in university, (and studied programming language design) this would be an utterly tempting idea for me to try. I must have come back to thinking about doing this ten times in the last fifteen years or so. Off the top of my head, scientific models also sound like they might fit with constraint modelling, tho I might be far too superficial in my understanding of both subjects there.


Dependency management is a common example; e.g. we want A; A depends on B and C; B depends on D or E; C conflicts with D; etc. These are all constraints, and we can ask a system like MiniZinc to find a set of packages which don't conflict (in that example {A, B, C, E} satisfy the constraints).

I don't think MiniZinc itself is used by any package-management tools, although some use competing tools/libraries. Personally I've used MiniZinc for a related problem: finding a subset of dependencies (of a given size, say 10), which satisfy the most outputs.

Edit: Another constraint modelling problem I've tackled (although I didn't use MiniZinc to solve it) is seating allocation on public transport: if the scheduled vehicle is unavailable, and the replacement has a different seating layout, how can we best assign the reserved seats (taking into account ticket class, seat direction, window/aisle, amenities, etc.)?


Examples from the software domain: Dependency resolution in package managers (packages with version requirements) may use constraint solving. Or type checking may be implemented using constraint solving. Though often if the application is well understood enough, it may jump over generic modelling language like MiniZinc and generate instructions for a boolean satisfaction solver directly.


Solving sudoku and other kinds of logical "puzzles".


Provable properties for cryptographic algorithms is a thing. Provably correct compilers exist. It’s not hard to imagine provably correct kernel modules for example and benefits they’d bring. If they had better ux you could imagine business logic, state machines, asynchronous computation to have provable properties as well. It’s very interesting area but on the edge of usability currently. I’d predict it has great future as ai gets incorporated more and more as it gives solid logic/mathematical proofs over solutions - if it doesn’t make sense to you, think json schema like validated llm output but for any computation.

Sophisticated programming languages dive towards this direction already compared to untyped cousins. Programs are validated against type theory correctness. You can go deeper with dependent types. And those languages go all the way down to prove everything there is to be proven.


Let Me GPT That For You! -> https://gprivate.com/65ubk


My GPT answer was: Imagine you have a big box of colorful building blocks, and you want to create something specific, like a house or a car. But you have some rules or constraints that you need to follow in order to complete your creation. Constraint modeling is like playing with those building blocks, but with rules. It helps you figure out how to build something while following certain restrictions. These restrictions could be things like the size or shape of the blocks you can use, how they can fit together, or even how many blocks you have to use. So, constraint modeling is like a game where you have to solve puzzles using your building blocks, but you have to follow certain rules to complete the puzzle. It helps you think logically and creatively to build something amazing!


I don't get people posting GPT answers. If parent wanted that, surely they would've done that themselves?


Someone else at the time had posted a let me GPT that response to someone's question which for me provided a very unclear response, I was re-prompting to get a more simplified explanation and it gave something that seemed helpful to me, so also to the question raised, no one else at the time had otherwise answered. I don't generally use GPT responses in comments hence why I noted in this case it was a GPT response and not my own.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: