Tabnine Logo
HardSoftScore.getInitScore
Code IndexAdd Tabnine to your IDE (free)

How to use
getInitScore
method
in
org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore

Best Java code snippets using org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore.getInitScore (Showing top 9 results out of 315)

origin: kiegroup/optaplanner

@Override
public int compareTo(HardSoftScore other) {
  // A direct implementation (instead of CompareToBuilder) to avoid dependencies
  if (initScore != other.getInitScore()) {
    return initScore < other.getInitScore() ? -1 : 1;
  } else if (hardScore != other.getHardScore()) {
    return hardScore < other.getHardScore() ? -1 : 1;
  } else {
    return Integer.compare(softScore, other.getSoftScore());
  }
}
origin: kiegroup/optaplanner

@Override
public boolean equals(Object o) {
  // A direct implementation (instead of EqualsBuilder) to avoid dependencies
  if (this == o) {
    return true;
  } else if (o instanceof HardSoftScore) {
    HardSoftScore other = (HardSoftScore) o;
    return initScore == other.getInitScore()
        && hardScore == other.getHardScore()
        && softScore == other.getSoftScore();
  } else {
    return false;
  }
}
origin: kiegroup/optaplanner

@Override
public HardSoftScore add(HardSoftScore augment) {
  return new HardSoftScore(
      initScore + augment.getInitScore(),
      hardScore + augment.getHardScore(),
      softScore + augment.getSoftScore());
}
origin: kiegroup/optaplanner

@Override
public HardSoftScore subtract(HardSoftScore subtrahend) {
  return new HardSoftScore(
      initScore - subtrahend.getInitScore(),
      hardScore - subtrahend.getHardScore(),
      softScore - subtrahend.getSoftScore());
}
origin: kiegroup/optaplanner

@Test
public void buildOptimisticBoundOnlyDown() {
  HardSoftScoreDefinition scoreDefinition = new HardSoftScoreDefinition();
  HardSoftScore optimisticBound = scoreDefinition.buildOptimisticBound(
      InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_DOWN, 2),
      HardSoftScore.of(-1, -2));
  assertEquals(0, optimisticBound.getInitScore());
  assertEquals(-1, optimisticBound.getHardScore());
  assertEquals(-2, optimisticBound.getSoftScore());
}
origin: kiegroup/optaplanner

@Test
public void serializeAndDeserialize() {
  PlannerTestUtils.serializeAndDeserializeWithAll(
      HardSoftScore.of(-12, 3400),
      output -> {
        assertEquals(0, output.getInitScore());
        assertEquals(-12, output.getHardScore());
        assertEquals(3400, output.getSoftScore());
      }
  );
  PlannerTestUtils.serializeAndDeserializeWithAll(
      HardSoftScore.ofUninitialized(-7, -12, 3400),
      output -> {
        assertEquals(-7, output.getInitScore());
        assertEquals(-12, output.getHardScore());
        assertEquals(3400, output.getSoftScore());
      }
  );
}
origin: kiegroup/optaplanner

@Test
public void buildOptimisticBoundOnlyUp() {
  HardSoftScoreDefinition scoreDefinition = new HardSoftScoreDefinition();
  HardSoftScore optimisticBound = scoreDefinition.buildOptimisticBound(
      InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_UP, 2),
      HardSoftScore.of(-1, -2));
  assertEquals(0, optimisticBound.getInitScore());
  assertEquals(Integer.MAX_VALUE, optimisticBound.getHardScore());
  assertEquals(Integer.MAX_VALUE, optimisticBound.getSoftScore());
}
origin: kiegroup/optaplanner

@Test
public void buildPessimisticBoundOnlyUp() {
  HardSoftScoreDefinition scoreDefinition = new HardSoftScoreDefinition();
  HardSoftScore pessimisticBound = scoreDefinition.buildPessimisticBound(
      InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_UP, 2),
      HardSoftScore.of(-1, -2));
  assertEquals(0, pessimisticBound.getInitScore());
  assertEquals(-1, pessimisticBound.getHardScore());
  assertEquals(-2, pessimisticBound.getSoftScore());
}
origin: kiegroup/optaplanner

@Test
public void buildPessimisticBoundOnlyDown() {
  HardSoftScoreDefinition scoreDefinition = new HardSoftScoreDefinition();
  HardSoftScore pessimisticBound = scoreDefinition.buildPessimisticBound(
      InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_DOWN, 2),
      HardSoftScore.of(-1, -2));
  assertEquals(0, pessimisticBound.getInitScore());
  assertEquals(Integer.MIN_VALUE, pessimisticBound.getHardScore());
  assertEquals(Integer.MIN_VALUE, pessimisticBound.getSoftScore());
}
org.optaplanner.core.api.score.buildin.hardsoftHardSoftScoregetInitScore

Popular methods of HardSoftScore

  • of
  • ofUninitialized
  • parseScore
  • getSoftScore
  • getHardScore
    The total of the broken negative hard constraints and fulfilled positive hard constraints. Their wei
  • ofSoft
  • toString
  • <init>
  • add
  • assertNoInitScore
  • buildShortString
  • divide
  • buildShortString,
  • divide,
  • equals,
  • getInitPrefix,
  • isFeasible,
  • multiply,
  • negate,
  • ofHard,
  • parseInitScore

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now