Solver Foundation 2.0 Preview: F# ODSL

Lengning Liu has written a great post that highlights another exciting Solver Foundation 2.0 area: a Solver Foundation ODSL in F#.  (F# is a functional programming language for .Net.)  The ODSL provides an intuitive, cool way to express LP and MIP problems.  My favorite addition to the ODSL is units of measure.  Parameters and decisions can be annotated with their units of measure, and the associated consistency checks are enforced by F# at compile time.  This is a great way to provide clarity to models as well as enforce correctness.  Here's an example from Lengning's post: 

let a = 20.0<Dollar/Barrel>

let b = 15.0<Dollar/Barrel>

let sa = var<Barrel/Day>()

let vz = var<_>()

minimise (a * sa + b * vz)

where

[

      0.3 * sa + 0.4 * vz >= 2000.<_>;

      0.4 * sa + 0.2 * vz >= 1500.<_>;

      0.2 * sa + 0.3 * vz >= 500.<_>;

sa <= 9000.<_>;

      vz <= 6000.<_>;

      sa >= 0.<_>;

      vz >= 0.<_>

]