Skip to content
Reproduced code practitioner

orhof, our open-source library of decision algorithms

A Clojure library for optimisation and decision algorithms, with no dependencies and 187 tests. We reuse its parts when we model a client's decision, so a conversation about your problem becomes working code in days.

Jiri Knesl · Internal reviewer: Flexiana Decision Lab · 30 July 2026
Read Limitations Reproduce Operations researchClojure & data-oriented systemsDecision under uncertainty

Operations research is usually taught as hundreds of named recipes: gradient descent, value iteration, the Hungarian method, particle filters, temporal-logic monitors. orhof, Operations Research in Higher-Order Functions, is a zero-dependency Clojure library built to demonstrate a different claim: most of these are compositions of a small set of higher-order-function patterns.

The shape of the idea

One generic descent framework, parameterised by a direction function and a step rule, yields gradient descent, conjugate gradient and Adam. The Bellman operator is expressed as a function transformer mdp → (V → V′), so value iteration, policy iteration and their variants share one core. Temporal-logic operators — always, eventually, until — become higher-order functions with continuous robustness semantics, which turns falsification into an optimisation problem.

What is in it

  • 251 public functions across 30 namespaces, zero third-party dependencies.
  • Three domains: continuous and discrete optimisation; Markov decision processes and reinforcement learning; temporal-logic validation.
  • 187 deterministic tests under a seeded RNG fixture, so every result reproduces.

It is the executable companion to the book Applied Higher Order Functions; every listing in the book runs against it, and Rainbow uses the same catalogue as its proving curriculum.

Why it matters commercially

When we model a client’s decision, we are not starting from a blank solver. The composition patterns here are the parts we assemble. So a modelling conversation becomes running, testable code in days rather than weeks. That is a claim about our delivery, tested on our own work. A client engagement is where it gets measured against a baseline.

Where this doesn't apply

The library reimplements known algorithms to demonstrate a structural thesis; it is not a claim of new mathematics, and it is not tuned to compete with specialised industrial solvers on large instances. Its 187 tests are deterministic under a seeded RNG, which fixes reproducibility but not real-world numerical edge cases.

What it means for a business

The same composition patterns are the building blocks we reuse when modelling a client's decision, which shortens the path from a whiteboard objective to running code.

Reproduce

Cite this

Jiri Knesl (2026). orhof, our open-source library of decision algorithms. Flexiana Research. https://flexiana.com/research/orhof-operations-research-as-higher-order-functions

Make this decision every week? Let's talk

If your business makes this decision again and again, talk to Jiri or Ivo. The first call costs nothing.