Module 7: Constrained Rate Optimisation

Part of: Modern Insurance Pricing with Python and Databricks


The module most courses do not have

Every other module in this course covers something you can find in a textbook or a conference paper. GLM theory, SHAP, credibility - these are established. The literature is rich.

Rate optimisation - the formal problem of finding which factors to move, by how much, to hit a target loss ratio without breaching volume constraints or regulatory rules - is not in any course we have seen. It is done in Excel by most UK pricing teams. The efficient frontier is never traced. Shadow prices on constraints are unknown. Whether a different mix of factor changes could have achieved the same loss ratio with less customer disruption: nobody computes it.

This module is about computing it.


What you will build


Prerequisites

You do not need to know linear programming or optimisation theory. We explain the LP formulation from first principles and why it requires SLSQP rather than a linear solver.


Estimated time

4-5 hours for the tutorial plus exercises. The optimisation itself runs in seconds for a book of 200,000 policies. The frontier trace takes 1-2 minutes. The stochastic variant is marginally slower.


Files

File Purpose
tutorial.md Main written tutorial - read this first
notebook.py Databricks notebook - full end-to-end workflow
exercises.md Four exercises with full worked solutions

Library

uv add rate-optimiser

# With stochastic chance-constrained formulation (requires cvxpy):
uv add "rate-optimiser[stochastic]"

Source: github.com/burningcost/rate-optimiser

The library runs on standard Python. On Databricks, install in your notebook’s first cell:

%pip install rate-optimiser --quiet

What you will be able to do after this module


What this covers that nothing else does

Commercial tools (Radar Optimiser, Earnix, Akur8) have optimisation modules. They have opaque solvers, inflexible constraint specifications, and no Python API. They do not expose shadow prices. They do not give you the full efficient frontier. They cannot be extended without vendor involvement.

The rate-optimiser library is an auditable, extensible alternative built on scipy. You can read every line of the solver. You can add constraints the commercial tools do not support. You can trace the frontier and compute shadow prices without asking anyone for a licence upgrade.


Pricing context

Module 7 sits at the end of the modelling workflow. You have your technical premiums (from Module 2 or Module 4). You have your demand model. The question is: given what the models tell you about expected claims and price elasticity, what rate action should you take? That is an optimisation problem, not a modelling problem. This module is where the two come together.


Part of the MVP bundle

This module is included in the £295 MVP bundle alongside Module 1 (Databricks for Pricing Teams), Module 2 (GLMs in Python), and Module 4 (SHAP Relativities). Individual module: £79.