SimplexSolver.GetReport Method (LinearSolverReportType)

Solver Foundation 3.0

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets a sensitivity report associated with a solve attempt.

Namespace:  Microsoft.SolverFoundation.Solvers
Assembly:  Microsoft.Solver.Foundation (in Microsoft.Solver.Foundation.dll)

public virtual ILinearSolverReport GetReport(
	LinearSolverReportType reportType
)

Parameters

reportType
Type: Microsoft.SolverFoundation.Services.LinearSolverReportType
The report type.

Return Value

Type: Microsoft.SolverFoundation.Services.ILinearSolverReport
A linear solver report.

Implements

ILinearSolver.GetReport(LinearSolverReportType)

The following code examples show how to create a model, add constraints and goals, solve the model, and get a short report. For more information, see How to: Use Linear Programming using the Solver Foundation Solver APIs.


using Microsoft.SolverFoundation.Common;
using Microsoft.SolverFoundation.Solvers;



SimplexSolver solver = new SimplexSolver();

int savid, vzvid;
solver.AddVariable("Saudi Arabia", out savid);
solver.SetBounds(savid, 0, 9000);
solver.AddVariable("Venezuela", out vzvid);
solver.SetBounds(vzvid, 0, 6000);

int gasoline, jetfuel, machinelubricant, cost;
solver.AddRow("gasoline", out gasoline);
solver.AddRow("jetfuel", out jetfuel);
solver.AddRow("machinelubricant", out machinelubricant);
solver.AddRow("cost", out cost);

solver.SetCoefficient(gasoline, savid, 0.3);
solver.SetCoefficient(gasoline, vzvid, 0.4);
solver.SetBounds(gasoline, 2000, Rational.PositiveInfinity);
solver.SetCoefficient(jetfuel, savid, 0.4);
solver.SetCoefficient(jetfuel, vzvid, 0.2);
solver.SetBounds(jetfuel, 1500, Rational.PositiveInfinity);
solver.SetCoefficient(machinelubricant, savid, 0.2);
solver.SetCoefficient(machinelubricant, vzvid, 0.3);
solver.SetBounds(machinelubricant, 500, Rational.PositiveInfinity);

solver.SetCoefficient(cost, savid, 20);
solver.SetCoefficient(cost, vzvid, 15);
solver.AddGoal(cost, 1, true);

solver.Solve(new SimplexSolverParams());

Console.WriteLine("SA {0}, VZ {1}, Gasoline {2}, Jet Fuel {3}, Machine Lubricant {4}, Cost {5}",
    solver.GetValue(savid).ToDouble(),
    solver.GetValue(vzvid).ToDouble(),
    solver.GetValue(gasoline).ToDouble(),
    solver.GetValue(jetfuel).ToDouble(),
    solver.GetValue(machinelubricant).ToDouble(),
    solver.GetValue(cost).ToDouble());
Console.ReadLine();


Show: