Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.1.0.Beta4
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.optaplanner.core.api.score
Interface Score<S extends Score>

All Superinterfaces:
  Comparable<S>

All Known Subinterfaces:
  FeasibilityScore<S>

All Known Implementing Classes:
  AbstractScore, BendableScore, HardMediumSoftLongScore, HardMediumSoftScore, HardSoftBigDecimalScore, HardSoftDoubleScore, HardSoftLongScore, HardSoftScore, SimpleBigDecimalScore, SimpleDoubleScore, SimpleLongScore, SimpleScore

    public interface Score<S extends Score>

extends Comparable<S>

A Score is result of the score function (AKA fitness function) on a single possible solution.

Implementations must be immutable.

Implementations are allowed to optionally implement Pareto comparison and therefore slightly violate the transitive requirement of `Comparable.compareTo(Object)`.

An implementation must extend `AbstractScore` to ensure backwards compatibility in future versions.

See Also:
  `AbstractScore`, `HardSoftScore`

Method Summary
`S` | `add(S augment)` Returns a Score whose value is (this + augment).
`S` | `divide(double divisor)` Returns a Score whose value is (this / divisor).
`boolean` | `isCompatibleArithmeticArgument(Score otherScore)`
`S` | `multiply(double multiplicand)` Returns a Score whose value is (this * multiplicand).
`S` | `negate()` Returns a Score whose value is (- this).
`S` | `power(double exponent)` Returns a Score whose value is (this ^ exponent).
`S` | `subtract(S subtrahend)` Returns a Score whose value is (this - subtrahend).
`Number[]` | `toLevelNumbers()` Returns an array of numbers representing the Score.

Methods inherited from interface java.lang.Comparable
`compareTo`

Method Detail

### add

    S add(S augment)

  Returns a Score whose value is (this + augment).

  Parameters:
    `augment` - value to be added to this Score
  Returns:
    this + augment

### subtract

    S subtract(S subtrahend)

  Returns a Score whose value is (this - subtrahend).

  Parameters:
    `subtrahend` - value to be subtracted from this Score
  Returns:
    this - subtrahend, rounded as necessary

### multiply

    S multiply(double multiplicand)

  Returns a Score whose value is (this * multiplicand). When rounding is needed, it should be floored (as defined by `Math.floor(double)`.

  /> If the implementation has a scale/precision, then the unspecified scale/precision of the double multiplicand should have no impact on the returned scale/precision.

  Parameters:
    `multiplicand` - value to be multiplied by this Score.
  Returns:
    this * multiplicand

### divide

    S divide(double divisor)

  Returns a Score whose value is (this / divisor). When rounding is needed, it should be floored (as defined by `Math.floor(double)`.

  /> If the implementation has a scale/precision, then the unspecified scale/precision of the double divisor should have no impact on the returned scale/precision.

  Parameters:
    `divisor` - value by which this Score is to be divided
  Returns:
    this / divisor

### power

    S power(double exponent)

  Returns a Score whose value is (this ^ exponent). When rounding is needed, it should be floored (as defined by `Math.floor(double)`.

  /> If the implementation has a scale/precision, then the unspecified scale/precision of the double exponent should have no impact on the returned scale/precision.

  Parameters:
    `exponent` - value by which this Score is to be powered
  Returns:
    this ^ exponent

### negate

    S negate()

  Returns a Score whose value is (- this).

  Returns:
    - this

### toLevelNumbers

    Number[] toLevelNumbers()

  Returns an array of numbers representing the Score. Each number represents 1 score level. A greater score level uses a lower array index than a lesser score level.

  When rounding is needed, each rounding should be floored (as defined by `Math.floor(double)`. The length of the returned array must be stable for a specific `Score` implementation.

  For example: -0hard/-7soft returns new int{-0, -7}

  Returns:
    never null

### isCompatibleArithmeticArgument

    boolean isCompatibleArithmeticArgument(Score otherScore)

  Parameters:
    `otherScore` - never null
  Returns:
    true if the otherScore is accepted as a parameter of `add(Score)`, `subtract(Score)` and `Comparable.compareTo(Object)`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| OptaPlanner distribution 6.1.0.Beta4
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2014 JBoss by Red Hat. All Rights Reserved.