/// <summary> /// Represents linear programming problem for symplex-method /// </summary> /// <param name="problem">Initial problem</param> public ProblemForGomory(DiscreteProgrammingProblem problem) : base(problem) { InitializeComponents(); WholeConstraints.AddRange(problem.WholeConstraints); }
/// <summary> /// Indicates is problem suitable for solving by Gomory method /// </summary> public bool IsSuitable(DiscreteProgrammingProblem problem) { return !HaveNotWholeCoefficient(problem.GetAllConstraints()) && !HaveNotWholeVariable(problem); }
/// <summary> /// Returns true if problem have varables, which isn't whole /// </summary> protected bool HaveNotWholeVariable(DiscreteProgrammingProblem problem) { foreach (var variable in problem.TargetFunction.Arguments) if (!problem.WholeConstraints.Contains(variable)) return true; return false; }
/// <summary> /// Represents copy of discrete programming problem description /// (1. target function, 2. constraint system, 3. zero constraints, 4. whole constraint) /// </summary> public DiscreteProgrammingProblem(DiscreteProgrammingProblem problem) : base(problem) { WholeConstraints = new List<string>(problem.WholeConstraints); }