Changeset 495


Ignore:
Timestamp:
Sep 20, 2013 4:07:49 AM (4 years ago)
Author:
bjarni
Message:

Cleaning up variable definitions in the Csharp sample file SolverProblem?.cs for stable 1.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/1.7/CoinMP/examples/csharp/SolveProblem.cs

    r378 r495  
    4949        public void GetAndCheckSolution(double optimalValue, IntPtr hProb)
    5050        {
    51             int solutionStatus;
    52             String solutionText;
    53             double objectValue;
    54             int i;
    55             int colCount;
    56             double[] xValues;
    57             int result;
    58             int length;
    59             String colName;
    60             String problemName;
    61 
    6251            logMsg.WriteLine("---------------------------------------------------------------");
    6352
    64             problemName = CoinMP.CoinGetProblemName(hProb);
    65             solutionStatus = CoinMP.CoinGetSolutionStatus(hProb);
    66             solutionText = CoinMP.CoinGetSolutionText(hProb);
    67             objectValue = CoinMP.CoinGetObjectValue(hProb);
     53            String problemName = CoinMP.CoinGetProblemName(hProb);
     54            int solutionStatus = CoinMP.CoinGetSolutionStatus(hProb);
     55            String solutionText = CoinMP.CoinGetSolutionText(hProb);
     56            double objectValue = CoinMP.CoinGetObjectValue(hProb);
    6857
    6958            logTxt.WriteLine("Problem Name:    " + problemName);
     
    7362            logTxt.WriteLine("---------------------------------------------------------------");
    7463
    75             colCount = CoinMP.CoinGetColCount(hProb);
    76 
    77             xValues = new double[colCount];
    78 
    79             result = CoinMP.CoinGetSolutionValues(hProb, xValues, null, null, null);
    80             for (i = 0; i < colCount; i++) {
     64            int colCount = CoinMP.CoinGetColCount(hProb);
     65
     66            double[] xValues = new double[colCount];
     67
     68            int result = CoinMP.CoinGetSolutionValues(hProb, xValues, null, null, null);
     69            for (int i = 0; i < colCount; i++) {
    8170                if (xValues[i] != 0.0) {
    82                     colName = CoinMP.CoinGetColName(hProb, i);
     71                    String colName = CoinMP.CoinGetColName(hProb, i);
    8372                    logTxt.WriteLine(colName + " = " + xValues[i]);
    8473                }
     
    10594            double[] initValues, char[] colType)
    10695        {
    107             IntPtr hProb;
    108             int result;
    109 
    11096            logTxt.NewLine();
    11197            logTxt.WriteLine("Solve Problem: " + problemName + " (obj=" + optimalValue + ")");
    11298            logTxt.WriteLine("---------------------------------------------------------------");
    11399
    114             hProb = CoinMP.CoinCreateProblem(problemName);
    115             result = CoinMP.CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount,
     100            IntPtr hProb = CoinMP.CoinCreateProblem(problemName);
     101            int result = CoinMP.CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount,
    116102                            objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds,
    117103                            rowType, rhsValues, rangeValues, matrixBegin, matrixCount,
     
    173159            int[] priorIndex, int[] priorValues, int[] priorBranch)
    174160        {
    175             IntPtr hProb;
    176             int result;
    177 
    178161            logTxt.NewLine();
    179162            logTxt.WriteLine("Solve Problem: " + problemName + " (obj=" + optimalValue + ")");
    180163            logTxt.WriteLine("---------------------------------------------------------------");
    181164
    182             hProb = CoinMP.CoinCreateProblem(problemName);
    183             result = CoinMP.CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount,
     165            IntPtr hProb = CoinMP.CoinCreateProblem(problemName);
     166            int result = CoinMP.CoinLoadMatrix(hProb, colCount, rowCount, nonZeroCount, rangeCount,
    184167                            objectSense, objectConst, objectCoeffs, lowerBounds, upperBounds,
    185168                            rowType, rhsValues, rangeValues, matrixBegin, matrixCount,
Note: See TracChangeset for help on using the changeset viewer.