I've had a few requests on this topic, so I thought I would give a simple example of how to write code against Solver Foundation's interior point solver. If you are new to Solver Foundation, be warned that this is something of an "advanced topic". The most complete, powerful Solver Foundation programming interface is Solver Foundation Services. The solverfoundation.com site has links to more information about the SFS, and I have worked through several samples on this blog: production planning, two-way data binding, traveling salesman, parameterized models, LINQ-to-SQL.

The InteriorPointSolver class is capable of solving linear, quadratic, and (in our upcoming 2.0 release) second order conic optimization problems. Let's take as an example the production planning problem I wrote about in a previous post.  It is a simple linear programming problem with two decisions (the production for each refinery) and three constraints (the demand for each refined product). In our SFS sample we simply declared the decisions, goals, and constraints and expressed them algebraically using the SolverContext and Model. The InteriorPointSolver class represents linear models in a slightly different way: using variables and rows. Variables are the analogue of SFS Decisions, whereas rows can represent either goals or constraints. Both variables and rows can have upper and/or lower bounds. In a linear model, both goals and constraints consist of linear combinations of variables, such as "3*x + 4*y + 5*z". Whereas in the SFS we can express these terms very naturally, with the InteriorPointSolver, the terms are expressed one at a time by specifying the coefficient associated with each variable in the row. Here is the C# code:

```  private static void PetrochemLinearModel() {
InteriorPointSolver solver = new InteriorPointSolver();
int sa, vz;
solver.SetBounds(sa, 0, 9000);
solver.SetBounds(vz, 0, 6000);

int goal;
solver.SetCoefficient(goal, sa, 20);
solver.SetCoefficient(goal, vz, 15);

int demand1, demand2, demand3;
solver.SetCoefficient(demand1, sa, 0.3);
solver.SetCoefficient(demand1, vz, 0.4);
solver.SetLowerBound(demand1, 1126);

solver.SetCoefficient(demand2, sa, 0.4);
solver.SetCoefficient(demand2, vz, 0.2);
solver.SetLowerBound(demand2, 1500);