Source Code Examples

The Solver Platform SDK includes a comprehensive set of 35 examples, with complete source code in C++, C#, Visual Basic, VB.NET, Java and MATLAB®, that show you how to define and solve every type of optimization and simulation problem -- from linear / integer programming to efficient portfolios and simulation optimization.  We've even included source code of a high-performance Sudoku solver!
 

Standard Examples

You can build and run the examples in each of the supported languages -- using Visual Studio 2005, Visual Studio .NET 2003, Visual C++ 6, Visual Basic 6, your favorite Java IDE, or MATLAB. 

When you run the "standard examples" application in each language, you can select an example from a dropdown list, see the results generated when you run the example, and simultaneously view the source code that produces those results.  Below is a simple linear / integer programming example in C#:

SDK Example 2 - Integer Linear Programming

 

Below is a list of choices offered by the "standard examples" application:

  • Linear Programming Example 1 [Dense Matrix]
  • Integer Linear Programming Example 2 [Dense Matrix]
  • Linear Programming Example 3 [Sparse Matrix]
  • Markowitz Optimization with QP Solver
  • Markowitz Optimization using Hessians
  • Non-Linear Programming with GRG
  • Non-Linear Programming with GRG using Gradients
  • Non-Linear Programming with Evolutionary Solver
  • Markowitz Optimization with SOCP Solver
  • Quadratically Constrained Programming with SOCP Solver
  • Second Order Cone Programming Example
  • Exception Handling Example
  • Reading an MPS or OSiL File
  • Linear Programming Infeasibility Diagnosis
  • Integer Programming Alloc2 [Accessing Multiple Solutions]
  • Integer Programming with All-Different Constraint
  • Sudoku Example, using All-Different Constraint
  • Creating a Problem [Variable, Function Blocks]
  • Creating a Problem [Adding Variable, Function Blocks]
  • Using a Problem Object Array
  • Traveling Salesman Problem 1 [All-Different Constraints]
  • Traveling Salesman Problem 2 [All-Different Constraints]
  • Simulation Example 1
  • Simulation Example 2
  • Simulation Example 3, with Distribution Fitting
  • Simulation Statistical Functions Example
  • Multiple Simulations Example
  • Simulation Rank Correlations Example
  • PSD Correlation Matrix Example
  • Optimization within Simulation Example
  • Simulation within Optimization Example
  • Simulation Optimization and SIP/SLURPs

Portfolio Optimization

A Markowitz portfolio optimization example included with the SDK shows you how simple it is to compute a series of points on the efficient frontier, and display them in different ways using a standard Microsoft chart component. 

Here's an example of one of the chart displays:

SDK Example - Portfolio Optimization

Cutting Stock Model

A Gilmore-Gomory cutting stock example included with the SDK shows you how easy it is to define and solve "master" and "slave" problems, and use the results from one problem as inputs to the other problem, finding an optimal solution through an iterative process often called "column generation." 

Here's an example of one solution displayed by this application:

SDK Example - Cutting Stock

Traveling Salesman Problem

The classic Traveling Salesman Problem (TSP) is easy to solve using the "alldifferent" constraint supported by all Solver Engines in the Solver Platform SDK. 

Here's the display produced by the TSP example in Visual Basic 6.  The same example in VB.NET, C#, C++, and Java uses a larger, higher resolution map of the United States.

   

< Back to Solver Platform SDK Product Overview