Network maximum flow in F#
Mathias Brandewinder Blog
by Mathias Brandewinder
1M ago
An old math problem I had not seen since my university days resurfaced the other day, the Maximum Flow problem. It came up in the context of analyzing some industrial process. For illustration purposes, let’s say we are producing sausages, following these steps: we grind some meat, add some seasoning, then stuff and tie the sausage casings, and split them into delicious sausage links. We could represent this process as a graph, like so: ``` mermaid graph TD; grind_meat --> season_meat; season_meat --> stuff_casing; stuff_casing --> cut_links; Now the question is, how m ..read more
Visit website
Study notes: constraints in Quipu Nelder-Mead solver
Mathias Brandewinder Blog
by Mathias Brandewinder
5M ago
In my previous post, I went over the recent changes I made to my F# Nelder-Mead solver, Quipu. In this post, I want to explore how I could go about handling constraints in Quipu. First, what do I mean by constraints? In its basic form, the solver takes a function, and attempts to find the set of inputs that minimizes that function. Lifting the example from the previous post, you may want to know what values of $(x,y)$ produce the smallest value for $f(x,y)=(x-10)^2+(y+5)^2$. The solution happens to be $(10,-5)$, and Quipu solves that without issues: #r "nuget: Quipu, 0.2.0" open Quipu.Nelder ..read more
Visit website
Version 0.2 of the Quipu Nelder-Mead solver
Mathias Brandewinder Blog
by Mathias Brandewinder
5M ago
Back in April ‘23, I needed a simple solver for function minimization, and published a basic F# Nelder-Mead solver implementation on NuGet. I won’t go over the algorithm itself, if you are curious I wrote a post breaking down how the Nelder-Mead algorithm works a while back. In a nutshell, the algorithm takes a function, and finds the set of inputs that produces the smallest output for that function. The algorithm is not foolproof, but it is very useful, and has the benefit of being fairly simple. After dog-fooding my library for a bit, I found some rough spots, and decided it was time to make ..read more
Visit website
Data Science in F# 2023: an Ode to Linear Programming
Mathias Brandewinder Blog
by Mathias Brandewinder
6M ago
In September, I had the great pleasure of attending the Data Science in F# conference in Berlin. I gave a talk and a workshop on Linear Programming, and figured I would make the corresponding material available, in case anybody is interested: Presentation: An Ode to Linear Programming Workshop: 4 levels of Linear Programming Linear Programming is perhaps an unusual topic for a data science conference. It is certainly a departure from my usual focus on Machine Learning with F#! I wanted to talk about Linear Programming, and its extension, Mixed Integer Linear Programming, because in my view ..read more
Visit website
Game of Life in Avalonia, MVU / Elmish style, take 2
Mathias Brandewinder Blog
by Mathias Brandewinder
10M ago
This is a follow-up to my recent post trying to implement the classic Conway Game of Life in an MVU style with Avalonia.FuncUI. While I managed to get a version going pretty easily, the performance was not great. The visualization ran OK until around 100 x 100 cells, but started to degrade severely beyond that. After a bit of work, I am pleased to present an updated version, which runs through a 200 x 200 cells visualization pretty smoothly: As a side note, I wanted to point out that the size change is significative. Increasing the grid size from 100 to 200 means that for every frame, the nu ..read more
Visit website
WIP: Game of Life in Avalonia, MVU / Elmish style
Mathias Brandewinder Blog
by Mathias Brandewinder
10M ago
A couple of days ago, I came across a toot from Khalid Abuhakmeh, showcasing a C# + MVVM implementation of the Game of Life on Avalonia. I have been experimenting with Avalonia funcUI recently, and thought a conversion would be both a fun week-end exercise, and an interesting way to take a look at performance. Long story short, I took a look at his repository as a starting point, and proceeded to rewrite it in an Elmish style, shamelessly lifting the core from his code. The good news is, it did not take a lot of time to get it running, the less good news is, my version has clear performance is ..read more
Visit website
First look at Avalonia with Elmish: wrapping OxyPlot charts
Mathias Brandewinder Blog
by Mathias Brandewinder
11M ago
In the recent weeks, I came across a use case which sounded like a good fit for a desktop application, which got me curious about the state of affairs for .NET desktop clients these days. And, as I was looking into this, I quickly came across Avalonia, and specifically Avalonia.FuncUI. Cross platform XAML apps, using F# and the Elmish loop? My curiosity was piqued, and I figured it was worth giving it a try. In this post, I will go over my first steps trying the library out. My ambitions are limited: first, how hard is it to get something running? Then, how hard is it to take an existing Avalo ..read more
Visit website
Quipu, a simple Nelder Mead solver in F#
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
Some time back, I wrote a small post digging into the mechanics behind the Nelder Mead solver. As it turns out, I had a use for it recently, and after copy-pasting my own code a few times, I figured it would make my life easier to turn that into a NuGet package, Quipu. So what does it do, and why might you care? A code example might be the quickest explanation here. Suppose that, for whatever reason, you were interested in the function f(x) = x ^ 2, and wanted to know for what value of x this function reaches its minimum. That is easy to solve with the Quipu Nelder-Mead solver: open Quipu op ..read more
Visit website
Simulating the Wrapinator 5000
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
It is that time of the year again! The holidays are approaching, and the F# Advent calendar is in full swing. My contribution this year might not be for the broadest audience, sorry about that :) But if you are into F#, probability theory, and numeric optimization, this post is for you - hope you enjoy it! And big shout out to Sergey Tihon for making this happen once again. You can find the full code for this post here on GitHub. With the Holidays approaching, Santa Claus, CEO of the Santa Corp, was worried. In preparation for the season’s spike in activity, Santa had invested in the top-o ..read more
Visit website
The Elves Factory
Mathias Brandewinder Blog
by Mathias Brandewinder
1y ago
It is that time of the year again! The holidays are approaching, and the F# Advent calendar is in full swing. My contribution this year might not be for the broadest audience, sorry about that :) But if you are into F#, probability theory, and numeric optimization, this post is for you - hope you enjoy it! And big shout out to Sergey Tihon for making this happen once again. You can find the full code for this post here on GitHub. With the Holidays approaching, Santa Claus, CEO of the Santa Corp, was worried. In preparation for the season’s spike in activity, Santa had invested in the top-o ..read more
Visit website

Follow Mathias Brandewinder Blog on FeedSpot

Continue with Google
Continue with Apple
OR