excel solver
optimization
simulation
excel solver, optimization software

   solver.com

Frontline Systems, Inc.  

quadratic programming, portfolio optimization, quadratic solver 
Developers of Your Spreadsheet's Solver  
robust optimization, stochastic programming, simulation optimization
   

Solver Platform SDK - Language/OS Support


optimization, solver, Excel

 
Home
Register
What's New
Solver Tutorial
Solver Technology
Select a Product
Excel Users
Developers
MATLAB Users
Macintosh Users
Government Users
Academic Users
Press/Analysts
Privacy Policy
 

 

 
The Solver Platform SDK offers both a modern high-level, object oriented API (Application Programming Interface) for C++, C#, Visual Basic, VB.NET and Java, that enables you to define your model using objects such as a Problem, Solver, Model, Variable and Function, and a matching procedural API for C, Fortran, Pascal and similar languages that provides access to the same objects via conventional procedure calls.  Both the object-oriented and procedural APIs are supported for MATLAB.

The Solver Platform SDK is currently available for 64-bit and 32-bit Windows (Windows Vista, Windows XP, Windows Server 2003, and Windows 2000, plus "x64" variants) and for 64-bit and 32-bit Linux (in a variety of distributions).  You may be able to run applications on Windows Me / 98 / 95, but Frontline Systems does not officially support these older operating systems. 

As you can see from the code excerpts below in both object-oriented and procedural languages, the Solver Platform SDK makes it easy to move from one object-oriented language to another, and even from an object-oriented language to a procedural language and vice versa.  The SDK supports both Microsoft .NET 2.0 and .NET 1.1, COM for both 32-bit and 64-bit applications, and most recent versions of Java and MATLAB.

bulletC++
bulletC#
bulletVisual Basic
bulletVB.NET
bulletJava
bulletMATLAB
bulletC (Procedural)

C++

Note how this C++ code uses the Problem, Model, Solver, Variable and Function objects.  When you create an optimization problem, it automatically has one vector of decision variables (VarDecision property), one vector of constraints (FcnConstraint property), and a single-element vector of objectives (FcnObjective property).

CProblem prob(Solver_Type_Maximize, nvars, ncons);

prob.Model.AllLinear[Function_Type_Objective] = 
   CDoubleMatrix(Array_Order_ByCol, 1, nvars, objcoeff);
prob.Model.AllLinear[Function_Type_Constraint] = 
   CDoubleMatrix (Array_Order_ByCol, ncons, nvars, concoeff);

prob.FcnConstraint.UpperBound = rhsvalue;

prob.VarDecision.NonNegative();
prob.VarDecision.IntegerType[0] = 
   prob.VarDecision.IntegerType[1] = Integer_Type_Integer;

prob.Solver.Optimize();
_Optimize_Status status = prob.Solver.OptimizeStatus;

double x1 = prob.VarDecision.FinalValue[0];
double x2 = prob.VarDecision.FinalValue[1];

C#

Note how this C# code excerpt is very similar to the C++ excerpt above.

Problem prob = new Problem(Solver_Type.Maximize, nvars, ncons);

prob.Model.AllLinear[Function_Type.Objective] = 
   new DoubleMatrix(Array_Order.ByCol, 1, nvars, objcoeff);
prob.Model.AllLinear[Function_Type.Constraint] = 
   new DoubleMatrix(Array_Order.ByCol, ncons, nvars, concoeff);

prob.FcnConstraint.UpperBound.Array = rhsvalue;

prob.VarDecision.NonNegative();
prob.VarDecision.IntegerType[0] = Integer_Type.Integer;
prob.VarDecision.IntegerType[1] = Integer_Type.Integer;

prob.Solver.Optimize();
Optimize_Status status = prob.Solver.OptimizeStatus;

double x1 = prob.VarDecision.FinalValue[0];
double x2 = prob.VarDecision.FinalValue[1];

Visual Basic

Dim prob As New SolverPlatform.Problem
prob.Solver.SolverType = Solver_Type_Maximize
prob.VarDecision.Size = nvars
prob.FcnConstraint.Size = ncons

Dim objcoeff As New DoubleMatrix
With objcoeff...
prob.Model.AllLinear(Function_Type_Objective, Variable_Type_Decision) = objcoeff
Dim concoeff As New DoubleMatrix
With concoeff...
prob.Model.AllLinear(Function_Type_Constraint, Variable_Type_Decision) = concoeff

prob.FcnConstraint.UpperBound.Array = rhsvalue

prob.VarDecision.NonNegative
prob.VarDecision.IntegerType(0) = Integer_Type_Integer
prob.VarDecision.IntegerType(1) = Integer_Type_Integer

prob.Solver.Optimize

Dim status As Optimize_Status
status = prob.Solver.OptimizeStatus

Dim varvalue() As Double
varvalue = prob.VarDecision.FinalValue.Array

VB.NET

Note how this VB.NET code excerpt is nearly identical to the Visual Basic excerpt above.

Dim prob As New SolverPlatform.Problem
prob.Solver.SolverType = Solver_Type_Maximize
prob.VarDecision.Size = nvars
prob.FcnConstraint.Size = ncons

Dim objcoeff As New DoubleMatrix
With objcoeff...
prob.Model.AllLinear(Function_Type_Objective, Variable_Type_Decision) = objcoeff
Dim concoeff As New DoubleMatrix
With concoeff...
prob.Model.AllLinear(Function_Type_Constraint, Variable_Type_Decision) = concoeff

prob.FcnConstraint.UpperBound.Array = rhsvalue

prob.VarDecision.NonNegative
prob.VarDecision.IntegerType(0) = Integer_Type_Integer
prob.VarDecision.IntegerType(1) = Integer_Type_Integer

prob.Solver.Optimize

Dim status As Optimize_Status
status = prob.Solver.OptimizeStatus

Dim varvalue() As Double
varvalue = prob.VarDecision.FinalValue.Array

Java

The Java language does not have properties, but the code excerpt below is still quite similar to the C# and C++ code excerpts above. 

prob = new Problem(Solver_Type.Maximize, nvars, ncons);

prob.Model().AllLinear(Function_Type.Objective,
   new DoubleMatrix(Array_Order.ByCol, 1, nvars, objcoeff));
prob.Model().AllLinear(Function_Type.Constraint, 
   new DoubleMatrix(Array_Order.ByCol, ncons, nvars, concoeff));

prob.FcnConstraint().UpperBound (rhsvalue);

prob.VarDecision().NonNegative();
prob.VarDecision().IntegerType( new int [] { Integer_Type.Integer, Integer_Type.Integer } );

prob.Solver().Optimize();

int nOptStatus = prob.Solver().OptimizeStatus();

double [] varvalue = prob.VarDecision().FinalValue();

MATLAB

This code excerpt using the SDK's object-oriented API in MATLAB closely resembles the C++ and C# code excerpts above.  You can also use the SDK's procedural API in MATLAB, yielding code that is similar to the C language excerpt below.

prob = Problem('Maximize', nvars, ncons);

prob.Model.AllLinear('Objective') = objcoeff;
prob.Model.AllLinear('Constraint') = concoeff;

prob.FcnConstraint.UpperBound = rhsvalue;

NonNegative(prob.VarDecision);
prob.VarDecision.IntegerType(0) = 'Integer';
prob.VarDecision.IntegerType(1) = 'Integer';

Optimize(prob.Solver);

varvalue = prob.VarDecision.FinalValue;

C (Procedural)

The procedural API provides access to each of the SDK's primary objects through a conventional calling interface.  All procedural calls start with Solver... and the name or abbreviation of the SDK object, for example Prob, Mod, Var and Fcn.

_Integer_Type inttype[] = {Integer_Type_Integer, Integer_Type_Integer};
double objval, x[nvars];

SolverProblem(&prob);
SolverProbTypeSet(prob, Solver_Type_Maximize, Problem_Type_NA);
SolverVariableAdd(prob, L"MyVars", Variable_Type_Decision, nvars);
SolverFunctionAdd(prob, L"MyCons", Function_Type_Constraint, ncons);
SolverFunctionAdd(prob, L"MyObj", Function_Type_Objective, 1);

SolverModArrayOrder(prob, Array_Order_ByCol);
SolverModAllLinearSet(prob, Function_Type_Objective, Variable_Type_All , objcoeff);
SolverModAllLinearSet(prob, Function_Type_Constraint, Variable_Type_All, concoeff);

SolverFcnUpperBoundSet(prob, L"MyCons", rhsvalue);

SolverVarNonNegative(prob, L"MyVars");
SolverVarIntegerTypeSet(prob, L"MyVars", inttype);

SolverOptimize(prob, &status, &objval);

SolverVarFinalValue(prob, L"MyVars", x);

SolverProbFree(&prob);

Back to Solver Platform SDK Product Overview

   
spreadsheet solver
scarce resources