/// <summary>
        /// Creates and returns a real variable which represents the maximum of <paramref name="a"/> and <paramref name="b"/>
        /// </summary>
        public static RealVariable Maximize(RealVariable a, RealVariable b)
        {
            RealVariable max = new RealVariable(a.ConstraintThingySolver, null, RealVariable.DefaultRange);

            // calculate the possible range for the sum so we improve the speed of the search
            Constraint.InRange(max, MultiInterval.Max(a.AllowableValues.First, b.AllowableValues.First));

            Max(max, a, b);

            return(max);
        }
        protected internal override void UpdateVariable(RealVariable variable, out bool success)
        {
            MultiInterval result;

            if (variable == Max)
            {
                result = Variables[1].AllowableValues.First;
                for (int i = 2; i < Variables.Length; i++)
                {
                    result = MultiInterval.Max(result, Variables[i].AllowableValues.First);
                }
            }
            else
            {
                // we can't be greater than the 'max', so we bound ourselves to the range    (-infinity, max]
                result = Max.AllowableValues.First.Extend(double.NegativeInfinity);
            }

            variable.NarrowTo(result, out success);

            return;
        }