HNHacker News
TopNewBestAskShowJobs

mzl

1,920 karma · joined April 27, 2010

submissionscomments
mzl··on Scott Adams has died
Asking someone to give a sharp dividing line in a multi-dimensional bimodal but not discontinuous distribution is just nonsense.

In particular, being unable to give that strict difference (that does not exist) is not proof of not believing that the general bimodal groups exist, nor acknowledging that existence, nor saying that there is not general differences between the groups. It is not the gotcha that elementary school biology suggests it would be.

mzl··on Mistral releases Devstral2 and Mistral Vibe CLI
A better reason why wine glasses are not filled like that is that wine glasses are designed to capture the aroma of the wine.

Since people look at a glass of wine and judge how much "value" they got based partly on how much wine it looks like, many bars and restaurants choose bad wine-glasses (for the purpose of enjoying wine) that are smalle and thus can be fulled more.

mzl··on Jepsen: NATS 2.12.1
You might not have a school education, but you have educated yourself. It is unfortunately common to hear people complain that the theory one learns in school (or by determined self-study) is useless, which I think is what the geybeard comment you replied to intends to say.
mzl··on Solving Rush Hour, the Puzzle (2018)
Fun article.

The Rush Hour puzzle is quite fun when viewed as a planning problem. In standard PDDL the model becomes very messy. I like the extensions proposed in https://arxiv.org/abs/2412.06312v1 that makes the model intuitive.

mzl··on State of AI: An Empirical 100T Token Study with OpenRouter
While it is possible to self-host small models, it is not easy to host them with high speeds. Many small-model use-cases are for large batches of work (processing large amounts of documents, agentic workflows, ...), and then using a provider that has high tps numbers would be motivated.

Still, I agree that self-hosting is probably a part of the decrease.

mzl··on Mathematics is hard for mathematicians to understand too
Yep, I agree on that. But still, interesting to see that such a "standard" thing can be so different in different dialects of mathematical notation.
mzl··on Mathematics is hard for mathematicians to understand too
I wrote about overlapping intervals a while ago, and used what I thought was the standard math notation for closed and half-open intervals. From comments, I learned that half-open intervals are written differently in french mathematics: https://lobste.rs/s/cireck/how_check_for_overlapping_interva...
mzl··on Solving the Partridge Packing Problem Using MiniZinc
Anything in particular?
mzl··on Solving the Partridge Packing Problem Using MiniZinc
Sometimes, that can be the case, but sometimes it takes a surprising amount of insight to make something that is useful. It is often easy to look at a final model and think that it is obvious.

For this problem, there are really three key insights needed to get a useful model

* Adding the exact fill requirements. With some background in constraint programming, this can be obvious, but it is also easy to try to use cumulative instead, and that is as shown not always useful

* The edge-placement restrictions. This is quite an intricate insight that depends on the combined choices available. Also, the first version I wrote for it was wrong in a surprising way that was hard to detect.

* Symmetry breaking for the boxes. This is a standard thing to solve in constraint programming models, but sometimes it is not obvious how to do it. It takes some experience to know that the `lex_chain_less` can be used for this.

mzl··on DeepSeek-v3.2: Pushing the frontier of open large language models [pdf]
Apart from measuring prices from venture-backed providers which might or might not correlate with cost-effectiveness, I think the measures of intelligence per watt and intelligence per joule from https://arxiv.org/abs/2511.07885 is very interesting.
mzl··on Solving the Partridge square packing problem using MiniZinc
Previous submission: https://news.ycombinator.com/item?id=46057932
mzl··on What happened with the CIA and The Paris Review?
> The classic "fish don't know what water is": what Americans can't see, because they were raised from birth and marinating in it, foreigners can spot more readily by contrast.

Learning that US schoolchildren recite the pledge of allegiance in school baffled my mind when I first realized it was actually true. As an outsider, it sounded like an obvious parody/caricature of nationalism, especially with the religious part.

mzl··on Solving Every Sudoku Puzzle (2006)
According to MDN it is expected to be an actual comparator: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

The specification says that if the comparator is not a consistent comparator, the sort order is implementation defined: https://tc39.es/ecma262/multipage/indexed-collections.html#s... Further along, it is specified that only if the sort order is correct, are you guaranteed to get a permutation of the input as the result. I would not write code expecting this to work.

mzl··on Solving Every Sudoku Puzzle (2006)
While Fisher-Yates or similar algorithms are more efficient, the real reason I wanted to mention it is that in many systems the sorting algorithm might crash or corrupt memory when used with a randomized comparison operator. It is inherently unsafe.
mzl··on Solving Every Sudoku Puzzle (2006)
Btw, note that the line

    const randomNumbers = random ? [1, 2, 3, 4, 5, 6, 7, 8, 9].sort(() => Math.random() - 0.5).sort(() => Math.random() - 0.5) : null
does not really do what you seem to intend. Sort requires a comparison function that is stable, and there are a lot of things that could go wrong if this is not supplied.

For shuffling, use a shuffle algorithm. Fisher-Yates is the common suggestion on what to use.

mzl··on Solving Every Sudoku Puzzle (2006)
You will most likely need both smarter heuristics and better deductions for larger instances. As mentioned, I've seen well-engineered custom tight C++-solvers with decent heuristics and the normal deductions take >1 hour on some instances. Most cases I've tried can be solved reasonably quickly when using OR-Tools CP-SAT which uses constraint programming style lazy clause generation to a SAT solver and custom MIP relaxations in a portfolio.

For a list of interesting instances to test, see this file: https://github.com/Gecode/gecode/blob/release/6.3.0/examples...

I should probably do some benchmarks on that with the standard MiniZinc solvers.

mzl··on Solving Every Sudoku Puzzle (2006)
That is an interesting post. However, a much more interesting challenge is solving larger Sudoku puzzles, as 9x9 is (as evidenced in the pos) a trivial problem to solve. 16x16 starts to get somewhat interesting, but at 25x25 it gets really interesting. Most solvers are trivially extensible to larger sizes, making it quite easy to benchmark.

In my testing, 25x25 Sudokus are algorithmically challenging. Solving times for a naive but well-tuned algorithm with reasonable heuristics can easily be on the order of an hour for a single puzzle. A smart system with advanced reasoning can be many orders of magnitude faster.

mzl··on Learning from Sudoku Solvers (2007)
Is there any property in particular of dancing links that you think helps in determining this, or is it just that a backtracking search can be used to test all cases?

For pen-and-paper puzzles like Sudoku there is usually the goal that a solution should be findable by a series of deductive steps. For 9x9 Sudoku, most deductive steps used correspond to the effects well-known propagation techniques offer[1]. With a suitable propagation level, if the puzzle is solved search-free, then one knows that both there is only one solution and that there is a deductive path to solve it.

[1]: See "Sudoku as a Constraint Problem", Helmut Simonis, https://ai.dmi.unibas.ch/_files/teaching/fs21/ai/material/ai... for some data on 9x9 Sudoku difficulty and the propagation techniques that are needed for search-free solving.

mzl··on Learning from Sudoku Solvers (2007)
Dancing links is a very cute data-structure for a backtracking search, but there are a lot more aspects of writing a good Sudoku solver than just having a good data-structure for backtracking. Propagation (making deductions), heuristics, learning, parallelism, restarts, no-goods, ...

While 9x9 Sudoku problems are trivial to solve for more or less any program, 25x25 Sudoku instances are quite tricky and a simple and fast but naive search for a solution can easily take hours.

mzl··on Learning from Sudoku Solvers (2007)
That representation of a Sudoku is elegant, but I think it is not the most natural representation. The base constraint programming style will use a variable per square with domain 1-9, and then 27 all_different constraints. This representation is a lot closer to how people talk about the rules of Sudoku, which in my mind makes it more natural.

A full MiniZinc program would look like this

    int: n = 3;
    int: s = n*n;
    set of int: S = 1..s;
    
    array[S, S] of opt S: puzzle;
    
    array[S, S] of var S: board;
    
    % Sudoku constraints
    constraint forall(row in S) ( all_different(board[row, ..]) );
    constraint forall(col in S) ( all_different(board[.., col]) );
    constraint forall(r, c in {1, 4, 7}) (
        all_different(board[r..<r+n, c..<c+n])
    );
    
    % Set up puzzle
    constraint forall (r, c in S where occurs(puzzle[r, c])) (
        board[r, c] = puzzle[r, c]
    );
    
    solve satisfy;

And an instance file looks like this

    puzzle = [|
         9, <>,  8,   1, <>, <>,  <>, <>,  4 |
         1,  2, <>,  <>,  8,  6,  <>,  5, <> |
        <>, <>,  7,  <>, <>, <>,  <>,  1, <> |
    
        <>,  8,  3,  <>, <>, <>,  <>,  6,  9 |
         7, <>,  6,   8, <>,  3,  <>, <>, <> |
        <>, <>, <>,   4,  6, <>,  <>,  8, <> |
    
        <>, <>, <>,  <>, <>,  1,  <>, <>, <> |
        <>, <>, <>,  <>, <>,  4,   5, <>,  1 |
         5,  4,  1,   9,  3,  8,  <>, <>, <>
    |];
mzl··on Rotating Workforce Scheduling in MiniZinc
My process is generally that I want to prototype the model in MiniZinc and use that to run benchmarks. If the problem to solve is large or batch-oriented, I might also use MiniZinc in production (probably via the python wrapper for the toolchain).

If on the other hand the problem is smaller, is more meant as an interactive system, or there is a need for deep integration, then I would re-implement the model in the API for a solver, or I might even write a dedicated solver. As a Gecode developer, I naturally think that Gecode is very useful for the cases where the problem is not a traditional model / instance / solve / done process, but I've used many other solvers as well depending on circumstances and need.

I've never really felt that Optaplanner / Timefold has been that useful of effective. In the cases I might have used it, I've instead written a custom local search system or constraint programming like system, and I think that has been a more effective approach. Do you have an example of what kind of problem you used it for?

mzl··on Rotating Workforce Scheduling in MiniZinc
That is more the area of workforce management systems, and they are really big business.

I’ve previously tried starting a scheduling company, and even when one has a product that in testing shows that it would save the potential customers lots of money, it is really hard to gain traction.

mzl··on Show HN: I modeled the puzzle game Railbound with Constraint Programming
Chuffed has very low overhead while still being a very fast LCG solver, so it is not surprising that it works best for small problems.

You might find it interesting to install and try both Huub (https://github.com/huub-solver/huub) and Pumpkin (https://github.com/consol-lab/pumpkin) as well. I have both in https://zayenz.se/blog/post/benchmarking-linkedin-queens/ with good results for the small problems I tested there. Both also did very well in the MiniZinc Challenge this year.

One thing that might be interesting (and might be useful for some solvers) is to change from checking if there is a solution and requiring each part to be used in the solution, to find solutions and minimize the number of unused parts.

One additional constraint that you could add that I don't think I've seen is distance to goal. In essence, for each grid position (without considering any tracks) there is a shortest time it would take from that position to get to the final position. If a train is in (a, b) and would take at least time t to get to the exit, there is no way to solve the problem if it is in (a, b) at time MAX_TIME-t. Might be useful for some solvers, worth testing.

Finally, adding some simple heuristic might help some solvers (I'm thinking of Gecode in particular here). My initial guess would be to add an interleaving over time steps of the train_row, train_col, and train dir for each train and search in order. That would as a basic heuristic represent a search from the start snaking out. Value choice is trickier to specify in MiniZinc of course.

mzl··on Show HN: I modeled the puzzle game Railbound with Constraint Programming
Very nice project. Do you have some statistics for how long it takes to solve the harder instances for different solvers? One thing to note for that, is that I saw the default parallelism of 4 in the run file. OR-Tools CP-SAT works best if it is given at least 8 threads to work with.

Have you considered using records for some of the data definitions? For example, a record `(row: int, col: int, piece: Piece)` for pre-placed pieces to avoid having .1, .2 and so on in the models. If you are concerned with the size of the data files, one way to handle that is to have the data as a list of tuples that are mapped via a function from a tulle to the record.

mzl··on A dumb introduction to z3
When using minizinc or other constraint programming tools to solve puzzles that require a single solution, I typically run them asking for 2 solutions. If I get 1 solution only, I know the puzzle is well formed, if I get more than one solution I know the puzzle is mal-formed.

For example, in https://zayenz.se/blog/post/benchmarking-linkedin-queens/#te... I took a large number of LinkedIn Queens puzzles, and I filtered out the ones that were not well-formed so that they wouldn't mess up the benchmarking and statistics.

mzl··on A dumb introduction to z3
Any tool that can solver hard problems will also have non-trivial runtime behavior. That is an unfortunate fact. But you are also correct in that combinatorial optimizaton solvers (CP, SAT, SMT, MIP, ...) often have quite sharp edges that are non-intuitive.

For the iOS AutoLayout, what kind of issues have you seen, and how complex were the problems?

mzl··on A dumb introduction to z3
I would say that for the specific use-case of a modeling layer for something like constraint programming, SMT, or MIP, full operator overloading is superior. I've written such layers in many languages and used them in even more languages, and it really does help a _lot_ to have the standard mathematical expressions. All the other alternatives become way to cumbersome to write effective models with in my experience.

Is it worth having operator overloading in a language or not? That is a different question. People do bad things with every feature, including operator overloading. I'm slightly in favor of it, but I'm not a fan of using it for anything other than either immediate arithmetic or creating expressions trees representing arithmetic.

mzl··on A dumb introduction to z3
If you want to work in Python, I would either use OR-Tools which has a Python library or CPMpy which is a solver agnostic Python library using numpy style for modeling combinatorial optimization problems.

There is a Python package for MiniZinc, but it is aimed at structuring calls to MiniZinc, not as a modeling layer for MiniZinc.

Personally, I think it is better to start with constraint programming style modeling as it is more flexible, and then move to SMT style models like Z3 if or when it is needed. One of the reasons I think CP is a better initial choice is the focus on higher-level concepts and global constraints.

mzl··on A dumb introduction to z3
One missing thing in Rust is that the comparison operators are hard-coded to return bool values, which means that it is not possible to build up full expression trees form normal code using operator overloading. Thus the need for functions like `eq`.

In general, for modeling layers embedded in programming languages, having operator overloading makes the code so much better to work with. Modeling layers where one has to use functions or strings that are evaluated are much harder to work with.

mzl··on A dumb introduction to z3
Has there been any published example of where this solver outperforms a classical solver?
← PreviousPage 2 of 14Next →