Esempio n. 1
0
        public SolverState State()
        {
            if (!initialized)
            {
                return(SolverState.NotInit);
            }
            int state = LP_DLL.State(solver);

            switch (state)
            {
            case 0: return(SolverState.NotInit);

            case 1: return(SolverState.ZeroStr);

            case 2: return(SolverState.ErrorZeroStr);

            case 3: return(SolverState.Support);

            case 4: return(SolverState.ErrorSupport);

            case 5: return(SolverState.Optimal);

            case 6: return(SolverState.ErrorOptimal);

            case 7: return(SolverState.OptimalInteger);

            case 8: return(SolverState.ErrorOptimalInteger);

            case 9: return(SolverState.Finish);

            default: return(SolverState.NotInit);
            }
        }
Esempio n. 2
0
 public int LabelY(int index)
 {
     if (!initialized)
     {
         return(-42);
     }
     return(LP_DLL.LabelY(solver, index));
 }
Esempio n. 3
0
 public Digit Table(int i, int j)
 {
     if (!initialized)
     {
         return(null);
     }
     return(new Digit(LP_DLL.Table(solver, i, j)));
 }
Esempio n. 4
0
 public int SizeY()
 {
     if (!initialized)
     {
         return(0);
     }
     return(LP_DLL.SizeY(solver));
 }
Esempio n. 5
0
 public void Dispose()
 {
     if (initialized)
     {
         LP_DLL.Release(solver);
     }
     initialized = false;
 }
Esempio n. 6
0
 public Digit Result()
 {
     if (!initialized)
     {
         return(null);
     }
     return(new Digit(LP_DLL.result(solver)));
 }
Esempio n. 7
0
 protected void initialize(Task task)
 {
     if (initialized)
     {
         Dispose();
     }
     LP_DLL.Initialize(solver, task.IntPtr());
     initialized = true;
 }
Esempio n. 8
0
        public bool StepWork()
        {
            if (!initialized)
            {
                return(false);
            }

            return(LP_DLL.StepWork(solver));
        }
Esempio n. 9
0
        public Limit(LimitType lt, Equation equa)
        {
            int type = 0;

            switch (lt)
            {
            case LimitType.Less: type = 1; break;

            case LimitType.More: type = 2; break;
            }
            limit = LP_DLL.Limit(type, equa.IntPtr());
        }
Esempio n. 10
0
        public Equation(Digit[] digs)
        {
            IntPtr[] ptrs = new IntPtr[digs.Count()];
            for (int i = 0; i < digs.Count(); i++)
            {
                ptrs[i] = digs[i].IntPtr();
            }
            unsafe
            {
                fixed(IntPtr *pArray = ptrs)
                {
                    IntPtr digitsPtr = new IntPtr((void *)pArray);

                    equation = LP_DLL.Equation(digs.Count(), digitsPtr, new Digit().IntPtr());
                }
            }
        }
Esempio n. 11
0
        public Task(TaskType taskType, Limit[] limits, Equation equation)
        {
            int tt = 0;

            if (taskType == TaskType.Min)
            {
                tt = 1;
            }

            IntPtr[] ptrs = new IntPtr[limits.Count()];
            for (int i = 0; i < limits.Count(); i++)
            {
                ptrs[i] = limits[i].IntPtr();
            }
            unsafe
            {
                fixed(IntPtr *pArray = ptrs)
                {
                    IntPtr limitsPtr = new IntPtr((void *)pArray);

                    task = LP_DLL.Task(tt, limits.Count(), limitsPtr, equation.IntPtr());
                }
            }
        }
Esempio n. 12
0
 public Digit()
 {
     digit = LP_DLL.Digit(0, 1);
 }
Esempio n. 13
0
 public Digit(int num)
 {
     digit = LP_DLL.Digit(num, 1);
 }
Esempio n. 14
0
 public Digit(int num, int denum)
 {
     digit = LP_DLL.Digit(num, denum);
 }
Esempio n. 15
0
 public GomoryFirstSimplexSolver(Task task)
 {
     solver = LP_DLL.GomoryFirstSimplex();
     base.initialize(task);
 }
Esempio n. 16
0
 public SimplexSolver(Task task)
 {
     solver = LP_DLL.Simplex();
     base.initialize(task);
 }
Esempio n. 17
0
 public int Numerator()
 {
     return(LP_DLL.Numerator(digit));
 }
Esempio n. 18
0
 public int Denomerator()
 {
     return(LP_DLL.Denomerator(digit));
 }
Esempio n. 19
0
 public double GetDouble()
 {
     return(LP_DLL.GetDouble(digit));
 }