Пример #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);
            }
        }
Пример #2
0
 public int LabelY(int index)
 {
     if (!initialized)
     {
         return(-42);
     }
     return(LP_DLL.LabelY(solver, index));
 }
Пример #3
0
 public Digit Table(int i, int j)
 {
     if (!initialized)
     {
         return(null);
     }
     return(new Digit(LP_DLL.Table(solver, i, j)));
 }
Пример #4
0
 public int SizeY()
 {
     if (!initialized)
     {
         return(0);
     }
     return(LP_DLL.SizeY(solver));
 }
Пример #5
0
 public void Dispose()
 {
     if (initialized)
     {
         LP_DLL.Release(solver);
     }
     initialized = false;
 }
Пример #6
0
 public Digit Result()
 {
     if (!initialized)
     {
         return(null);
     }
     return(new Digit(LP_DLL.result(solver)));
 }
Пример #7
0
 protected void initialize(Task task)
 {
     if (initialized)
     {
         Dispose();
     }
     LP_DLL.Initialize(solver, task.IntPtr());
     initialized = true;
 }
Пример #8
0
        public bool StepWork()
        {
            if (!initialized)
            {
                return(false);
            }

            return(LP_DLL.StepWork(solver));
        }
Пример #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());
        }
Пример #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());
                }
            }
        }
Пример #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());
                }
            }
        }
Пример #12
0
 public Digit()
 {
     digit = LP_DLL.Digit(0, 1);
 }
Пример #13
0
 public Digit(int num)
 {
     digit = LP_DLL.Digit(num, 1);
 }
Пример #14
0
 public Digit(int num, int denum)
 {
     digit = LP_DLL.Digit(num, denum);
 }
Пример #15
0
 public GomoryFirstSimplexSolver(Task task)
 {
     solver = LP_DLL.GomoryFirstSimplex();
     base.initialize(task);
 }
Пример #16
0
 public SimplexSolver(Task task)
 {
     solver = LP_DLL.Simplex();
     base.initialize(task);
 }
Пример #17
0
 public int Numerator()
 {
     return(LP_DLL.Numerator(digit));
 }
Пример #18
0
 public int Denomerator()
 {
     return(LP_DLL.Denomerator(digit));
 }
Пример #19
0
 public double GetDouble()
 {
     return(LP_DLL.GetDouble(digit));
 }