frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Linear Programming for Fun and Profit

https://modal.com/blog/resource-solver
62•hmac1282•1y ago

Comments

ayhanfuat•1y ago
> X = [x1, ..., Xn]: instances of each type to launch

Is this a continuous variable? Seems discrete to me. I am surprised it is solved by simplex.

Frummy•1y ago
It's the answer, a vector of integers
ayhanfuat•1y ago
Simplex cannot give a vector of integers though, unless the constraint matrix is unimodular. Maybe the integrality constraint was relaxed.
cweld510•1y ago
You're right -- we do relax the integrality constraint, gaining performance at the expense of some precision, and we're generally able to paper over the difference at scheduling time. We've investigated integer linear programming for some use cases, but for solves to run quickly, we have to constrain the inputs significantly.
ayhanfuat•1y ago
Thanks for the clarification. I guess it wouldn’t matter much if the numbers are large. Initially I thought they were mostly ones and zeros.
stncls•1y ago
If this is business critical for you, you may want to switch to a faster solver. Glop is very nice, but it would be reasonable to expect a commercial solver (Gurobi, XPress, COpt) to be 60x faster [1]. By the same measure, the best open source solvers (CLP, HiGHS) are 2-3x faster than Glop.

Actually, the commercial solvers are so fast that I would not be surprised if they solved the IP problem as fast as Glop solves the LP. (Yes, the theory says it is impossible, but in practice it happens.) The cost of a commercial solver is 10k to 50k per license.

[1] ... this 60x number has very high variance depending on the type of problem, but it is not taken out of nowhere, it comes from the Mittelmann LP benchmarks https://plato.asu.edu/ftp/lpopt.html There are also benchmarks for other types of problems, including IP, see the whole list here: https://plato.asu.edu/bench.html

petters•1y ago
If you are able to paper over the fractional numbers and get a usable solution, an integer solver should also be able to find a feasible solution easily. Perhaps not optimal, but better than just solving the LP and rounding
hustwindmaple1•1y ago
You are basically doing a heurstic. Your solutions are not guaranteed to be optimal. Integer programming is the way to do.
cweld510•1y ago
Great to see this post here -- really enjoyed writing it! I think it's really cool how an algorithm from an operational research context can play a critical role in a high-availability large-scale cloud service.
sumtechguy•1y ago
LP is a shockingly good way to optimize a system. If you can put inputs/outputs into the correct form. Had an econ prof that loved these things for doing supply/demand maxima and minimum finding. He didnt outright say it but I think it was his current line of study when I was taking classes from him the 90s. I thought that, as he managed to bring it up in every class he taught.
Onavo•1y ago
Well, kantorovich did win the Nobel for inventing that.
underanalyzer•1y ago
Neat article. I do wish it mentioned that there are polynomial time algorithms to solve linear programming problems. According to the Google ortools docs it has the option to use those as well (but not with the GLOP solver). Might be good for when simplex is struggling (https://developers.google.com/optimization/lp/lp_advanced)
stncls•1y ago
You're right, but it's very subtle and complicated.

In theory, the simplex method is not known to be polynomial-time, and it is likely that indeed it is not. Some variants of the simplex method have been proven to take exponential time in some worst cases (Klee-Minty cubes). What solvers implement could be said to be one such variant ("steepest-edge pricing"), but because solvers have tons of heuristics and engineering, and also because they work in floating-point arithmetic... it's difficult to tell for sure.

In practice, the main alternative is interior-point (aka. barrier) methods which, contrary to the simplex method, are polynomial-time in theory. They are usually (but not always) faster, and their advantage tends to increase for larger instances. The problem is that they are converging numerical algorithms, and with floating-point arithmetic they never quite 100% converge. By contrast, the simplex method is a combinatorial algorithm, and the numerical errors it faces should not accumulate. As a result, good solvers perform "crossover" after interior-point methods, to get a numerically clean optimal solution. Crossover is a combinatorial algorithm, like the simplex method. Unlike the simplex method though, crossover is polynomial-time in theory (strongly so, even). However, here, theory and practice diverge a bit, and crossover implementations are essentially simplified simplex methods. As a result, in my opinion, calling iterior-point + crossover polynomial-time would be a stretch.

Still, for large problems, we can expect iterior-point + crossover to be faster than the simplex method, by a factor 2x to 10x.

There is also first-order methods, which are getting much attention lately. However, in my experience, you should only use that if you are willing to tolerate huge constraint violations in the solution, and wildly suboptimal solutions. Their main use case is when other solvers need too much RAM to solve your instance.

Onavo•1y ago
The most interesting question is how you scrape the prices. The cloudprovider really need to provide an API.
underanalyzer•1y ago
Very interesting! Thanks for the reply. I wonder if they tried these other solvers and decided they were either too slow b/c their problems were too small or the answers were too inaccurate

Escape IntelliJ: Scala and Kotlin LSPs on Emacs Eglot

https://jointhefreeworld.org/blog/articles/emacs/emacs-eglot-scala-kotlin/index.html
67•jjba23•2d ago•27 comments

Terence Tao's ChatGPT conversation about the Jacobian Conjecture counterexample

https://chatgpt.com/share/6a5fdc7a-d6f8-83e8-bbea-8deb42cfed56
891•gmays•16h ago•517 comments

Cruller: Bun's Zig Runtime, Continued on Zig 0.16

https://ziggit.dev/t/cruller-buns-zig-runtime-continued-on-zig-0-16/16734
60•Erenay09•4h ago•27 comments

Quality non-fiction books are the antithesis of AI slop

https://resobscura.substack.com/p/quality-non-fiction-books-are-the
367•benbreen•20h ago•125 comments

git's –end-of-options Flag

https://nesbitt.io/2026/07/21/end-of-options.html
149•Erenay09•1d ago•73 comments

ANSI escape injection in MCP servers: Hidden from humans, visible to AI

https://brightsec.com/research/detecting-ansi-escape-sequence-injection-in-mcp-servers-with-dast/
17•xgpyc2qp•2d ago•6 comments

GigaToken: ~1000x faster Language model tokenization

https://github.com/marcelroed/gigatoken/
513•syrusakbary•17h ago•107 comments

Show HN: Bento - An entire PowerPoint in one HTML file (edit+view+data+collab)

https://bento.page/slides/
849•starfallg•19h ago•190 comments

Everyone should know SIMD

https://mitchellh.com/writing/everyone-should-know-simd
438•WadeGrimridge•16h ago•159 comments

Are AI labs pelicanmaxxing?

https://dylancastillo.co/posts/pelicanmaxxing.html
547•dcastm•17h ago•211 comments

Amiga 1000: Ten years ahead of its time

https://dfarq.homeip.net/amiga-1000-ten-years-ahead-of-its-time/
85•giuliomagnifico•4h ago•56 comments

So Reddit has decided that plain HTML is unsafe

https://www.cole-k.com/2026/07/21/reddit/
476•montroser•21h ago•480 comments

Show HN: Cactus Hybrid: We taught Gemma 4 to know when it's wrong

https://github.com/cactus-compute/cactus-hybrid
140•HenryNdubuaku•16h ago•26 comments

Making

https://beej.us/blog/data/ai-making/
365•erikschoster•18h ago•143 comments

The startup's Postgres survival guide

https://hatchet.run/blog/postgres-survival-guide
415•abelanger•21h ago•192 comments

Making ASCII Art in Vim

https://alexyang.dev/vim-ascii-art/
66•evakhoury•2d ago•6 comments

Why malloc always does more than I asked for?

https://ssenthilnathan3.github.io/blog/malloc/
38•nathaah3•2d ago•26 comments

Protecting our FLOSS commons from LLMs

https://blog.codeberg.org/protecting-our-floss-commons-from-llms.html
64•acmnrs•9h ago•14 comments

Medici family mystery may be solved after more than 400 years

https://www.cnn.com/2026/07/15/science/medici-family-mystery-dna-malaria
125•effects•12h ago•35 comments

John C. Dvorak has died

https://twitter.com/na_announce/status/2079952538040672302
755•coleca•14h ago•250 comments

Frequently Asked Questions on Expertise

https://jtpeterson.substack.com/p/faq-on-expertise
5•surprisetalk•2d ago•0 comments

Malleable Computing, Emacs, and You

http://yummymelon.com/devnull/malleable-computing-emacs-and-you.html
112•kickingvegas•13h ago•31 comments

Businesses with ugly AI menu redesigns

https://blog.fiddery.com/businesses-with-ugly-ai-menu-redesigns/
305•speckx•21h ago•207 comments

Fairphone 6 wide camera experimental Linux support

https://nondescriptpointer.com/articles/fairphone-6-wide-camera-linux/
125•helonaut•14h ago•33 comments

Computing Camera Rays

https://momentsingraphics.de/CameraRays.html
5•ibobev•1w ago•0 comments

Nobody knows what a used GPU cluster is worth

https://ciphertalk.substack.com/p/nobody-knows-what-a-used-gpu-cluster
234•rbanffy•1w ago•212 comments

ascdraw: Editor for ASCII/UTF-8 diagrams (in 144FPS)

https://github.com/exlee/ascdraw
45•xlii•2d ago•8 comments

Restructuring GitHub's bug bounty program

https://github.blog/security/next-chapter-restructuring-githubs-bug-bounty-program/
46•soheilpro•7h ago•21 comments

Back to Kagi

https://blog.melashri.net/micro/back-to-kagi/
275•speckx•21h ago•202 comments

Ghost Cut – Or why Cut and Paste is broken everywhere

https://ishmael.textualize.io/blog/ghost-cut/
171•willm•19h ago•117 comments