Class ModelEntity<ME extends ModelEntity<ME>>

    • Field Detail

      • LARGEST

        private static final java.math.BigDecimal LARGEST
      • SMALLEST

        private static final java.math.BigDecimal SMALLEST
      • myAdjustmentExponent

        private transient int myAdjustmentExponent
      • myContributionWeight

        private java.math.BigDecimal myContributionWeight
      • myLowerLimit

        private java.math.BigDecimal myLowerLimit
      • myName

        private final java.lang.String myName
      • myUpperLimit

        private java.math.BigDecimal myUpperLimit
    • Constructor Detail

      • ModelEntity

        private ModelEntity()
      • ModelEntity

        protected ModelEntity​(ME entityToCopy)
      • ModelEntity

        protected ModelEntity​(java.lang.String name)
    • Method Detail

      • deriveAdjustmentExponent

        static int deriveAdjustmentExponent​(AggregatorFunction<java.math.BigDecimal> largest,
                                            AggregatorFunction<java.math.BigDecimal> smallest,
                                            int range)
      • isInfeasible

        static boolean isInfeasible​(java.math.BigDecimal lower,
                                    java.math.BigDecimal upper)
      • toBigDecimal

        static java.math.BigDecimal toBigDecimal​(java.lang.Comparable<?> number)
      • adjust

        public final java.math.BigDecimal adjust​(java.math.BigDecimal factor)
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • getAdjustmentFactor

        public final double getAdjustmentFactor()
        Returns:
        Adjusted "1"
      • getContributionWeight

        public final java.math.BigDecimal getContributionWeight()
        Description copied from interface: Optimisation.Objective
        The weight/factor by which this model entity's value contributes to the objective function - may return null.
        Specified by:
        getContributionWeight in interface Optimisation.Objective
      • getLowerLimit

        public final java.math.BigDecimal getLowerLimit​(boolean adjusted,
                                                        java.math.BigDecimal defaultValue)
      • getLowerLimit

        public final double getLowerLimit​(boolean adjusted,
                                          double defaultValue)
      • getName

        public final java.lang.String getName()
      • getUpperLimit

        public final java.math.BigDecimal getUpperLimit​(boolean adjusted,
                                                        java.math.BigDecimal defaultValue)
      • getUpperLimit

        public final double getUpperLimit​(boolean adjusted,
                                          double defaultValue)
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • isContributionWeightSet

        public final boolean isContributionWeightSet()
      • isInteger

        public abstract boolean isInteger()
        Is this entity (all involved variables) integer?
      • isLowerLimitSet

        public final boolean isLowerLimitSet()
      • isObjective

        public final boolean isObjective()
        Specified by:
        isObjective in interface Optimisation.Objective
        Returns:
        true if this Objective has a non zero contribution weight - it actually is contributing to the objective function.
      • isUpperLimitSet

        public final boolean isUpperLimitSet()
      • level

        public final ME level​(double level)
      • level

        public final ME level​(long level)
      • lower

        public ME lower​(java.lang.Comparable<?> lower)
        Extremely large (absolute value) values are treated as "no limit" (null) and extremely small values are treated as exactly 0.0, unless the input number type is BigDecimal. BigDecimal values are always used as they are.
      • lower

        public final ME lower​(double lower)
      • lower

        public final ME lower​(long lower)
      • reverseAdjustment

        public final java.math.BigDecimal reverseAdjustment​(java.math.BigDecimal adjusted)
        Purely the reverse scaling part of toUnadjusted(double, NumberContext)
      • shift

        public void shift​(java.math.BigDecimal shift)
        Add this shift to the lower/upper limits, if they exist.
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • upper

        public ME upper​(java.lang.Comparable<?> upper)
        Extremely large (absolute value) values are treated as "no limit" (null) and extremely small values are treated as exactly 0.0, unless the input number type is BigDecimal. BigDecimal values are always used as they are.
      • upper

        public final ME upper​(double upper)
      • upper

        public final ME upper​(long upper)
      • weight

        public final ME weight​(double weight)
      • weight

        public final ME weight​(long weight)
      • getLower

        private java.math.BigDecimal getLower​(boolean adjusted)
      • getUpper

        private java.math.BigDecimal getUpper​(boolean adjusted)
      • appendLeftPart

        protected void appendLeftPart​(java.lang.StringBuilder builder,
                                      NumberContext display)
      • appendMiddlePart

        protected void appendMiddlePart​(java.lang.StringBuilder builder,
                                        NumberContext display)
      • appendRightPart

        protected void appendRightPart​(java.lang.StringBuilder builder,
                                       NumberContext display)
      • destroy

        protected void destroy()
      • getAdjustmentExponent

        protected final int getAdjustmentExponent()
      • validate

        protected final boolean validate​(BasicLogger appender)
        Validate model parameters, like lower and upper limits. Does not validate the solution/value.
      • appendToString

        final void appendToString​(java.lang.StringBuilder builder,
                                  NumberContext display)
      • deriveAdjustmentExponent

        abstract int deriveAdjustmentExponent()
      • doIntegerRounding

        abstract void doIntegerRounding()
        If necessary this method should first determine if this ModelEntity is "integer" or not.

        If it is, then verify if all variable factors are integers or if there exists a simple scalar that will make it so. If so, the lower/upper limits are "integer rounded".

      • getAdjustmentExponentValue

        final int getAdjustmentExponentValue()
      • getCompensatedLowerLimit

        final java.math.BigDecimal getCompensatedLowerLimit​(java.math.BigDecimal compensation)
      • getCompensatedLowerLimit

        final java.math.BigDecimal getCompensatedLowerLimit​(java.math.BigDecimal compensation,
                                                            NumberContext precision)
      • getCompensatedUpperLimit

        final java.math.BigDecimal getCompensatedUpperLimit​(java.math.BigDecimal compensation)
      • getCompensatedUpperLimit

        final java.math.BigDecimal getCompensatedUpperLimit​(java.math.BigDecimal compensation,
                                                            NumberContext precision)
      • isClosedRange

        boolean isClosedRange​(java.math.BigDecimal lower,
                              java.math.BigDecimal upper)
        Returns:
        true if both the lower and upper limits are defined, and the range is defined by lower and upper.
      • isInfeasible

        boolean isInfeasible()