public LPForm() { InitializeComponent(); var lt1 = new Equation(new Digit[] { new Digit(1), new Digit(-1) }, new Digit(-1)); //var lt2 = new Equation(new Digit[] { new Digit(-2, 3), new Digit(-1) }, new Digit(7, 2)); var lt2 = new Equation(new Digit[] { new Digit(-4), new Digit(-6) }, new Digit(21)); var mainEqua = new Equation(new Digit[] { new Digit(1), new Digit(10) }); Task task = new Task(Task.TaskType.Max, new Limit[] { new Limit(Limit.LimitType.Equal, lt1), new Limit(Limit.LimitType.More, lt2), }, mainEqua); ss = new SimplexSolver(task); }
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()); } } }
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()); } } }
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()); }