Live data from Hacker News

MiniZinc

minizinc.org

41–50 of 76 posts

Re: MiniZinc

#41
I used Minizinc to come up with tiling patterns for a patio. I had m 2x2 tiles and n 3x2 tiles and wrote a model to generate patterns that had:

* a certain aspect ratio,

* rotational symmetry,

* no spots where four corners touch,

and a few other ad-hoc constraints that I can't remember exactly, to exclude certain sub-patterns.

Re: MiniZinc

#42
post #7

As a not professional programmer, but mathematically inclined I can say I found modelling in MiniZinc crazily hard. I tried the Coursera class, put in the hours and failed. It took me back to some classes where everything I tried failed and the proper result felt so near what I was trying that it was hard to digest a better strategy the next time. It did give me a new feeling for complexity and model space reduction.…

Can LLM help in this task?

I'm not an expert on MiniZinc, but tried applying it and GPT-4 to a toy problem: https://buttondown.email/aostiles/archive/flight-optimizatio...

Re: MiniZinc

#43
post #7

As a not professional programmer, but mathematically inclined I can say I found modelling in MiniZinc crazily hard. I tried the Coursera class, put in the hours and failed. It took me back to some classes where everything I tried failed and the proper result felt so near what I was trying that it was hard to digest a better strategy the next time. It did give me a new feeling for complexity and model space reduction.…

Can LLM help in this task?

Seems like no? I mean, they are great in getting some text that looks correct but is an hallucination. LLM can help in getting something roughly ok, that a human can fix. This doesn't seem to be the case here.

Re: MiniZinc

#44

My goodness, a HN topic I can speak on with some level of expertise! I developed and deployed a rail yard scheduling application based on MiniZinc which is being used daily in production at several sites by one of the largest rail network operators in Australia. Like others here I had started out with the free coursera courses a couple of years prior and was really taken by the declarative nature of the language. Whe…

How can you be sure that your constraint model is correct? When the models are so complex that seems like a real challenge! In your case was it possible to take a proposed solution and verify that it does not have any issues? Are there many other safeguards in place to prevent train collisions or invalid schedules?

Re: MiniZinc

#45

My goodness, a HN topic I can speak on with some level of expertise! I developed and deployed a rail yard scheduling application based on MiniZinc which is being used daily in production at several sites by one of the largest rail network operators in Australia. Like others here I had started out with the free coursera courses a couple of years prior and was really taken by the declarative nature of the language. Whe…

Thanks for sharing this fascinating tale!

Re: MiniZinc

#46

My goodness, a HN topic I can speak on with some level of expertise! I developed and deployed a rail yard scheduling application based on MiniZinc which is being used daily in production at several sites by one of the largest rail network operators in Australia. Like others here I had started out with the free coursera courses a couple of years prior and was really taken by the declarative nature of the language. Whe…

How can you be sure that your constraint model is correct? When the models are so complex that seems like a real challenge! In your case was it possible to take a proposed solution and verify that it does not have any issues? Are there many other safeguards in place to prevent train collisions or invalid schedules?

Fortunately the colleague who proposed this project was a former train controller with encyclopaedic knowledge of the particular yard and its operations. You find that all of these experienced train controllers can just look at a schedule and instantly tell you if it's viable or not. This was a really important part of development because I had rapid feedback and could prioritise the features that were really important to the people on the ground.

The model was in user-acceptance testing phase for almost a year until it was feature complete, had acceptable performance, was verified by the controllers etc.

I should clarify that the model was not in charge of actually telling trains where to go. Train Controllers are solely responsible for that and do so using a Train Control System which has rigorous safety measures in place to ensure collisions do not happen.

The model was a decision support system for the controllers. It showed them how they could best run the yard given the current state of play and expected arrivals. Controllers were absolutely free to disregard the advice which certainly happened earlier on but as the model got better and better this became less of an issue.

I should say the main reason I could 'speak the same language' with the end users in this case is due to the vega-lite schedule visualisation. Every single part of the constraint model (trains, tracks, tasks, track failures, even the objective function) had an analagous visual representation on the diagram which meant controllers both confident the model did what I said it did, and they could also easily point out errors by referring to the diagram.

A big feature of this model was that there was essentially 0 abstraction over what was happening in the real world. The model took inputs from all of the exact same systems that train controllers used, and produced results that tied directly back to the track circuits of the train control system. This meant that we could view historical yard performance, current yard state, and future optimised schedule all on the same diagram which was so great for debugging and verification.

Re: MiniZinc

#47
post #11

Im sure this is useful but these languages (proof langs, constraints, etc) are always so difficult to parse or read Adoption for these systems might be higher if they had a more readable syntax (and bonus if they could transpile down to source code you can tweak) Also maybe I missed it on mobile, but I would love examples of the syntax and examples of application usage on the first page. Maybe this is useful to me! W…

I’ve played with minizinc in the past though we use scipopt now instead. The minizinc code looks pretty reasonable to me though. Specify your variables as ranges. Specify your constraints as math equations. Tell it what you’re looking to maximise / minimise. https://www.minizinc.org/doc-2.7.6/en/modelling.html#ex-cake...

Judging from this particular example, it doesn't look a lot different than more established optimization software like CVXPY, no?

https://www.cvxpy.org/examples/basic/linear_program.html

Re: MiniZinc

#48
post #7

As a not professional programmer, but mathematically inclined I can say I found modelling in MiniZinc crazily hard. I tried the Coursera class, put in the hours and failed. It took me back to some classes where everything I tried failed and the proper result felt so near what I was trying that it was hard to digest a better strategy the next time. It did give me a new feeling for complexity and model space reduction.…

I took a class in grad school where MiniZinc was our go-to to solve many different problems and I had the same issue. I found that the handbook[1] was pretty helpful in modeling tricks and understanding the logic where I was used to CPLEX modeling style and Python OR-Tools.

[1] https://www.minizinc.org/doc-2.5.5/en/index.html

Re: MiniZinc

#49

I used Minizinc to come up with tiling patterns for a patio. I had m 2x2 tiles and n 3x2 tiles and wrote a model to generate patterns that had: * a certain aspect ratio, * rotational symmetry, * no spots where four corners touch, and a few other ad-hoc constraints that I can't remember exactly, to exclude certain sub-patterns.

do you have a pic of the result?

Re: MiniZinc

#50

I used Minizinc to come up with tiling patterns for a patio. I had m 2x2 tiles and n 3x2 tiles and wrote a model to generate patterns that had: * a certain aspect ratio, * rotational symmetry, * no spots where four corners touch, and a few other ad-hoc constraints that I can't remember exactly, to exclude certain sub-patterns.

That sounds super cool!

I'm at the very early planning (read: daydreaming ;) stage for a tiling project of my own, (where my "constraints" are "has to be nerdy-awesome"). Like find a specific conway's game of life still life, or perhaps use the newly discovered aperiodic "hat" tileing.

Any chance you would be willing to dump your notes somewhere I can see?

Post reply on HN