hdbeukel / james-core

Core module of the JAMES framework
Apache License 2.0
6 stars 5 forks source link

Type safe delta evaluations and validations #28

Open hdbeukel opened 9 years ago

hdbeukel commented 9 years ago

Add abstract (inner) classes

that allow to dynamically attach type safe delta evaluations/validations for one or more move types, through a method call like useDelta(MyMove.class, (move, sol, eval/val, data) -> ...). These calls can for example be grouped in the constructor of the objective/constraint, and may use method references to specify the delta evaluation/validation function, as in useDelta(MyMove.class, this::evaluateMyMove).

To evaluate/validate a move, the list of attached delta evaluations/validations is scanned to find one that matches the move type (any super type of the received move). In case of multiple matches, the first one is used. If there is no match, the objective/constraint falls back to full evaluation/validation for that move.