public static ArithmeticConstraint operator>=(ArithmeticVariable left, float right)
        {
            var leftExpression = (ArithmeticExpression)left;

            var rightExpression = new ArithmeticExpression(left.Context, right);

            return(leftExpression >= rightExpression);
        }
        public static ArithmeticConstraint CreateConstraint(ArithmeticExpression left, ArithmeticInequality inequality, ArithmeticExpression right)
        {
            var context = left.Context;

            switch (inequality)
            {
            case ArithmeticInequality.Equal: break;

            case ArithmeticInequality.LessThanOrEqual:
            case ArithmeticInequality.GreaterThanOrEqual: {
                var slackVariable = context.Variables.Count;

                context.Variables.Add(false);

                Array.Resize(ref left.Coefficients, context.Variables.Count);

                float slackCoefficient;
                switch (inequality)
                {
                case ArithmeticInequality.LessThanOrEqual: {
                    slackCoefficient = 1.0f;
                } break;

                case ArithmeticInequality.GreaterThanOrEqual: {
                    slackCoefficient = -1.0f;
                } break;

                default: throw new Exception();
                }

                left.Coefficients[slackVariable] = slackCoefficient;
            } break;
            }

            return(new ArithmeticConstraint(left.Constant, left.Coefficients, right.Constant, right.Coefficients));
        }
        public static ArithmeticConstraint operator <=(ArithmeticExpression left, float right)
        {
            var rightExpression = new ArithmeticExpression(left.Context, right);

            return(left <= rightExpression);
        }
        public static ArithmeticConstraint operator ==(float left, ArithmeticExpression right)
        {
            var leftExpression = new ArithmeticExpression(right.Context, left);

            return(leftExpression == right);
        }
 public void Maximize(ArithmeticExpression expression)
 {
     Objective = Objective - expression;
 }
 public void Minimize(ArithmeticExpression expression)
 {
     Objective = Objective + expression;
 }