3

I am new to optaplanner. I am using 6.2. I am about to code my first score calculator. I was reading the Java docs about AbstractIncrementalScoreCalculator Is there any other documentation with details on how/why and when the framework calls the difference methods in the interface IncrementalScoreCalculator

void resetWorkingSolution(Sol sol);

void beforeEntityAdded(java.lang.Object o);

void afterEntityAdded(java.lang.Object o);

void beforeVariableChanged(java.lang.Object o, java.lang.String s);

void afterVariableChanged(java.lang.Object o, java.lang.String s);

void beforeEntityRemoved(java.lang.Object o);

void afterEntityRemoved(java.lang.Object o);

Thanks

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120

1 Answers1

1

First write an Easy score calculator, and configure that as an <assertionScoreDirectorFactory>, before writing an incremental score calculator. Because those latter are hard to write.

Take a look at the docs and especially the sequence diagram: the before methods are called before something happens and the after method are called after it happened. An entity is a planning entity. a variable is a planning variable of a planning entity. Added/changed/removed are self explanatory.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120