Esempio n. 1
0
        public static void Solve(SolveProblem solveProblem)
        {
            const int    NUM_COLS = 4;
            const int    NUM_ROWS = 3;
            const int    NUM_NZ   = 6;
            const int    NUM_RNG  = 0;
            const double DBL_MAX  = 1e37;
            const int    NUM_SEMI = 1;

            string probname = "SemiCont";
            int    ncol     = NUM_COLS;
            int    nrow     = NUM_ROWS;
            int    nels     = NUM_NZ;
            int    nrng     = NUM_RNG;

            string objectname = "z";
            int    objsens    = CoinMP.SOLV_OBJSENS_MIN;
            double objconst   = 0.0;

            double[] dobj = new double[NUM_COLS] {
                0.0, 1.0, 1.0, 0.0
            };

            double[] dclo = new double[NUM_COLS] {
                2.8, 0.0, 0.0, 0.0
            };
            double[] dcup = new double[NUM_COLS] {
                10.0, DBL_MAX, DBL_MAX, DBL_MAX
            };

            char[] rtyp = new char[NUM_ROWS]  {
                'L', 'G', 'E'
            };
            double[] drhs = new double[NUM_ROWS] {
                8.9, 8.9, 10.0
            };

            int[] mbeg = new int[NUM_COLS + 1] {
                0, 1, 2, 3, 6
            };
            int[] mcnt = new int[NUM_COLS] {
                1, 1, 1, 3
            };
            int[] midx = new int[NUM_NZ] {
                2, 0, 1, 0, 1, 2
            };
            double[] mval = new double[NUM_NZ] {
                1, -1, 1, 1, 1, 1
            };

            string[] colNames = new string[NUM_COLS] {
                "s", "pup", "plo", "x"
            };
            string[] rowNames = new string[NUM_ROWS] {
                "bigx", "smallx", "f"
            };

            int semiCount = 1;

            int[] semiIndex = new int[NUM_SEMI] {
                0
            };

            double optimalValue = 1.1;

            solveProblem.RunProblemMip(probname, optimalValue, ncol, nrow, nels, nrng,
                                       objsens, objconst, dobj, dclo, dcup, rtyp, drhs, null, mbeg,
                                       mcnt, midx, mval, colNames, rowNames, objectname, null, null,
                                       0, 0, null, null, null, null, null, semiCount, semiIndex,
                                       0, null, null, null);
        }
Esempio n. 2
0
        public static void Solve(SolveProblem solveProblem)
        {
            const int    NUM_COLS  = 3;
            const int    NUM_ROWS  = 1;
            const int    NUM_NZ    = 3;
            const int    NUM_RNG   = 0;
            const double DBL_MAX   = 1e37;
            const int    NUM_SOS   = 1;
            const int    NUM_SOSNZ = 3;

            string probname = "GamsSos1a";
            int    ncol     = NUM_COLS;
            int    nrow     = NUM_ROWS;
            int    nels     = NUM_NZ;
            int    nrng     = NUM_RNG;

            string objectname = "z";
            int    objsens    = CoinMP.SOLV_OBJSENS_MAX;
            double objconst   = 0.0;

            double[] dobj = new double[NUM_COLS] {
                0.9, 1.0, 1.1
            };

            double[] dclo = new double[NUM_COLS] {
                0, 0, 0
            };
            double[] dcup = new double[NUM_COLS] {
                0.8, 0.6, 0.6
            };

            //char[] rtyp = new char[NUM_ROWS]  {};
            //double[] drhs = new double[NUM_ROWS] {};
            //double[] drng = new double[NUM_ROWS] {};

            double[] drlo = { -DBL_MAX };
            double[] drup = { 1.0 };

            int[] mbeg = new int[NUM_COLS + 1] {
                0, 1, 2, 3
            };
            int[] mcnt = new int[NUM_COLS] {
                1, 1, 1
            };
            int[] midx = new int[NUM_NZ] {
                0, 0, 0
            };
            double[] mval = new double[NUM_NZ] {
                1, 1, 1
            };

            string[] colNames = new string[NUM_COLS] {
                "x1", "x2", "x3"
            };
            string[] rowNames = new string[NUM_ROWS] {
                "xsum"
            };

            int sosCount   = 1;
            int sosNZCount = 3;

            int[] sosType = new int[NUM_SOS] {
                1
            };
            int[] sosBegin = new int[NUM_SOS + 1] {
                0, 3
            };
            int[] sosIndex = new int[NUM_SOSNZ] {
                0, 1, 2
            };

            double optimalValue = 0.72;

            solveProblem.RunProblemMip(probname, optimalValue, ncol, nrow, nels, nrng,
                                       objsens, objconst, dobj, dclo, dcup, null, drlo, drup, mbeg,
                                       mcnt, midx, mval, colNames, rowNames, objectname, null, null,
                                       sosCount, sosNZCount, sosType, null, sosBegin, sosIndex, null,
                                       0, null, 0, null, null, null);
        }
Esempio n. 3
0
        public static void Solve(SolveProblem solveProblem)
        {
            const int    NUM_COLS  = 7;
            const int    NUM_ROWS  = 5;
            const int    NUM_NZ    = 15;
            const int    NUM_RNG   = 0;
            const double DBL_MAX   = 1e37;
            const int    NUM_SOS   = 1;
            const int    NUM_SOSNZ = 3;

            string probname = "GamsSos2a";
            int    ncol     = NUM_COLS;
            int    nrow     = NUM_ROWS;
            int    nels     = NUM_NZ;
            int    nrng     = NUM_RNG;

            string objectname = "z";
            int    objsens    = CoinMP.SOLV_OBJSENS_MIN;
            double objconst   = 0.0;

            double[] dobj = new double[NUM_COLS] {
                0, 0, 0, 0, 0, 1, 1
            };

            double[] dclo = new double[NUM_COLS] {
                0.0, 0, 0, -DBL_MAX, -DBL_MAX, 0, 0
            };
            double[] dcup = new double[NUM_COLS] {
                DBL_MAX, DBL_MAX, DBL_MAX, DBL_MAX,
                DBL_MAX, DBL_MAX, DBL_MAX
            };

            char[] rtyp = new char[NUM_ROWS]  {
                'E', 'E', 'E', 'G', 'G'
            };
            double[] drhs = new double[NUM_ROWS] {
                1, 0, 0, -1.3, 1.3
            };

            int[] mbeg = new int[NUM_COLS + 1] {
                0, 3, 6, 9, 10, 13, 14, 15
            };
            int[] mcnt = new int[NUM_COLS] {
                3, 3, 3, 1, 3, 1, 1
            };
            int[] midx = new int[NUM_NZ] {
                0, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 3, 4, 3, 4
            };
            double[] mval = new double[NUM_NZ] {
                1, 1, 1, 1, 2, 2, 1, 3, 3, -1, -1, -1, 1, 1, 1
            };

            string[] colNames = new string[NUM_COLS] {
                "w1", "w2", "w3", "x", "fx", "fplus", "fminus"
            };
            string[] rowNames = new string[NUM_ROWS] {
                "wsum", "xdef", "fxdef", "gapplus", "gapminus"
            };

            int sosCount   = 1;
            int sosNZCount = 3;

            int[] sosType = new int[NUM_SOS] {
                2
            };
            int[] sosBegin = new int[NUM_SOS + 1] {
                0, 3
            };
            int[] sosIndex = new int[NUM_SOSNZ] {
                0, 1, 2
            };

            double optimalValue = 0.0;

            solveProblem.RunProblemMip(probname, optimalValue, ncol, nrow, nels, nrng,
                                       objsens, objconst, dobj, dclo, dcup, rtyp, drhs, null, mbeg,
                                       mcnt, midx, mval, colNames, rowNames, objectname, null, null,
                                       sosCount, sosNZCount, sosType, null, sosBegin, sosIndex, null,
                                       0, null, 0, null, null, null);
        }