In Solver Foundation CTP release, we shipped an optimization domain specific language (ODSL) in F#, which embedded Solver Foundation simplex solver for solving linear programming models. In the upcoming version 2 release, we will ship an enhanced version of this ODSL. Here are some of the highlights:

·         Units of measure: in F# numerical quantities can be annotated by a unit such as kilogram, dollar per day. These annotations not only provide additional and explicit documentation on the nature of the quantities involved, but also allow F# to statically check that no mistake is made in the use of these quantities: adding Watt and Newton is incorrect for example.

Units of measures in F# are declared as follows:

 [] type Dollar [] type Barrel [] type Day [] type ProductionRate = Barrel/Day

The syntax for annotating a numerical value with its measure is shown below:

 let dailyOutput = 9000.0 let price = 140.0 let dailyCost = dailyOutput * price

In our new ODSL, units of measures can be used in modeling a problem, which help modelers to catch errors in the model where incompatible quantities are used in the constraints or goal functions. Here is a simple example of the Petrochem problem.

 let a = 20.0 let b = 15.0 let sa = var() 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.<_>  ]

Note that if quantities such as a were defined to have a measure other than Dollar/Barrel, F# would have caught the error in the goal function where b*vz had the measure Dollar/Day while a*sa did not.

·         Solver Foundation wrapper in F#: this wrapper directly wraps Solver Foundation APIs and does not use F# quotations. With this wrapper, we also enabled units of measure in models that are written against Solver Foundation APIs. Here is the model of the same Petrochem problem written in this wrapper: