The Index Subscript Object

Collections contained by the IndexSubscript Object

IndexSet

Returns the IndexSet collection collection of the subscript.

Properties for the IndexSubscript Object

Count

The number of elements in the subscript index. (Integer Property - Read Only)

Declaration

The declaration of the subscript index. (String Property - Read Only)

DimNr

The dimension number of the index subscript. (Integer Property - Read Only)

DomainCount

The number of domain subscripts in the subscript index. (Integer Property - Read Only)

ElementNr

The current element number of the index subscript. (Integer Property - Read Only)

IndexNr

The index element number of the current subscript. (Integer Property - Read Only)

Name

The name of the subscript index. (String Property - Read Only)

ParentNr

The index number of the parent index. (Integer Property - Read Only)

Value

The current value of the index subscript. (Integer Property - Read Only)

ValueStr

The current string value of the subscript. (String Property - Read Only)

CSharp Example:


     OptiMax MPL;
     Solver cpxSolver;
     Model dietModel;
     VariableVector varVect;
     VectorSubscript varSub;
     ResultType result;

     MPL = new OptiMax();

     cpxSolver = MPL.Solvers.Add("CPLEX");
     dietModel = MPL.Models.Add("Diet");

     string WorkingDirectory = "c:\\mplwin4";
     string modFilePath = WorkingDirectory + "\\" + "Diet.mpl";

     result = planModel.ReadModel(modFilePath);
     result = planModel.Solve(cpxSolver);

     varVect = planModel.VariableVectors["x"];
     varSub = varVect.Subscripts[1];

     foreach(Variable var in varVect.NonzeroVariables)
        Console.WriteLine("x[" + varSub.Value + "] = " + var.Activity);

        

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