The Solution Object

The Solution object is a property of the parent Model object and contains all the information stored about the solution for the model. The Solution object properties are only available after the model has been solved.

Collections contained by the Solution Object

Constraints

Returns the Constraints collection for the solution.

Variables

Returns the Variables collection for the solution.

Properties for the Solution Object

ConCount

The number of constraints in the solution. (Integer Property - Read Only)

DataImportTime

How long time in seconds it took to import data for the model. (Double Property - Read Only)

ExportSolTime

How long time in seconds it took to export the solution. (Double Property - Read Only)

IsAvailable

Specifies if the solution values are available for retrieval. (Boolean Property - Read/Write)

IsRangesAvailable

Specifies if the solution ranges are available for retrieval. (Boolean Property - Read/Write)

IterationCount

The iteration count of the solver run. (Integer Property - Read Only)

MipBestBound

The best bound of the MIP objective value. (Double Property - Read Only)

MipNodeCount

The MIP node count of the solver run. (Integer Proprety - Read Only)

MipImproveCount

The MIP improve node count of the solver run. (Integer Property - Read Only)

MipImproveTime

How long time in seconds it took to search for improved MIP solutions. (Double Property - Read Only)

ObjectValue

The value of the objective function for the solution. (Double Property - Read/Only)

ParserTime

How long time in seconds it took MPL to parse in the model. (Double Property - Read Only)

ResultCode

The native solver result code of the solver run. (Integer Property - Read Only)

ResultString

The result of the solver run. (String Property - Read Only)

SolverTime

How long time in seconds it took to solve the model. (Double Property - Read Only)

TotalTime

How long total time in seconds it took to run the model. (Double Property - Read Only)

VarCount

The number of variables in the solution. (Integer Property - Read Only)

CSharp Example:


     OptiMax MPL;
     Solver cpxSolver;
     Model planModel;
     Solution planSol;
     ResultType result;

     MPL = new OptiMax();

     cpxSolver = MPL.Solvers.Add("CPLEX");
     planModel = MPL.Models.Add("Planning");

     string WorkingDirectory = "c:\\mplwin4";
     string modFilePath = WorkingDirectory + "\\" + "Planning.mpl";
     planSol = planModel.Solution;

     result = planModel.ReadModel(modFilePath);
     result = planModel.Solve(cpxSolver);
     Console.WriteLine("ResultString     = " + planSol.ResultString);
     Console.WriteLine("ObjectValue      = " + planSol.ObjectValue);
     Console.WriteLine("IsAvailable      = " + planSol.IsAvailable);
     Console.WriteLine("IsRangesAvail    = " + planSol.IsRangesAvailable);
     Console.WriteLine("Variable Count   = " + planSol.VarCount);
     Console.WriteLine("Constraint Count = " + planSol.ConCount);
     Console.WriteLine("Iteration Count  = " + planSol.IterationCount);
     Console.WriteLine("Node Count       = " + planSol.MipNodeCount);
     Console.WriteLine("Solver Time      = " + planSol.SolverTime);

        

Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page