Chapter 18. Migration Guide

18.1. About the Business Resource Planner Migration

From Red Hat JBoss BRMS and Red Hat JBoss BPM Suite 6.1 onwards, Business Resource Planner is fully supported. Business Resource Planner is a lightweight, embeddable constraint satisfaction engine that is able to solve planning problems. Business Resource Planner includes a public API, which will be backwards compatible in later versions such as 6.2 and 6. For more information, see the Business Resource Planner documentation.
The following changes should be noted for implementation in JBoss BPM Suite/JBoss BRMS 6.1 onwards:
  • Simulated Annealing now uses the time gradient of the current step instead of the time gradient of the last step. The impact of this change is negligible.
  • On AbstractScore, the methods parseLevelStrings(...) and buildScorePattern(...) have been changed from public to protected. It is highly unlikely that this affects your code.
  • The *Descriptor classes have been moved into a descriptor package. SolutionDescriptor.isInitialized(Solution) now requires a ScoreDirector parameter.
  • There is now a better alternative to Brute Force: Branch And Bound, see docs for more information.
  • InverseRelationShadowVariableListener has been renamed to SingletonInverseVariableListener. It, and InverseRelationShadowVariableDescriptor have moved to the package ...impl.domain.variable.inverserelation.
  • The ConstraintOccurrence classes (which were deprecated) have been remove, and should be switched to the ConstraintMatch system.
  • The interface Solution has been promoted to the public API. It has also moved package from impl.solution to api.domain.solution.
    Previously in *.java:
    import org.optaplanner.core.impl.solution.Solution;
    Now in *.java:
    import org.optaplanner.core.api.domain.solution.Solution;
  • All classes in the package impl.move have been moved to impl.heuristic.move. None of them are future-proof enough at this time to be added the public API. Prefer generic moves whenever possible.
    Previously in *.java:
    import org.optaplanner.core.impl.move.Move;
    import org.optaplanner.core.impl.move.CompositeMove;
    import org.optaplanner.core.impl.move.NoChangeMove;
    
    Now in *.java:
    import org.optaplanner.core.impl.heuristic.move.Move;
    import org.optaplanner.core.impl.heuristic.move.CompositeMove;
    import org.optaplanner.core.impl.heuristic.move.NoChangeMove;
    
  • All classpath resources must lose their leading slash, because Business Resource Planner now expects them to adhere to ClassLoader.getResource(String) instead of Class.getResource(String).
    • The SolverFactory.createFromXmlResource(String) parameter must lose its leading slash.
      Previously in *.java:
      ... = SolverFactory.createFromXmlResource(
      "/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
      
      Now in *.java:
      ... = SolverFactory.createFromXmlResource(
      "org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
      
    • All elements <scoreDrl> must lose their leading slash.
      Previously in *SolverConfig.xml and *BenchmarkConfig.xml:
      <scoreDrl>/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
      Now in *SolverConfig.xml and *BenchmarkConfig.xml:
      <scoreDrl>org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
      
    • The PlannerBenchmarkFactory.createFromXmlResource(String) parameter must lose its leading slash.
      Previously in *.java:
      ... = PlannerBenchmarkFactory.createFromXmlResource(
          "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
      
      Now in *.java:
      ... = PlannerBenchmarkFactory.createFromXmlResource(
          "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
      
    • The PlannerBenchmarkFactory.createFromFreemarkerXmlResource(String) parameter must lose its leading slash.
      Previously in *.java:
      ... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource(
      "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
      Now in *.java:
      ... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource(
      "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
  • The @PlanningVariable property chained has been refactored to graphType. This is to allow support for other graph types (such as TREE) in the future.
    Previously in *.java:
    @PlanningVariable(chained = true, ...)
    public Standstill getPreviousStandstill() {
        return previousStandstill;
    }
    Now in *.java:
    @PlanningVariable(graphType = PlanningVariableGraphType.CHAINED, ...)
    public Standstill getPreviousStandstill() {
        return previousStandstill;
    }
  • The constructionHeuristicType BEST_FIT has been renamed into WEAKEST_FIT. The terminology "Best Fit" was not correct and did not allow for STRONGEST_FIT.
    Previously in *SolverConfig.xml and *BenchmarkConfig.xml:
    <constructionHeuristic>
        <constructionHeuristicType>BEST_FIT</constructionHeuristicType>
    </constructionHeuristic>
    
    Now in *SolverConfig.xml and *BenchmarkConfig.xml:
    <constructionHeuristic>
        <constructionHeuristicType>WEAKEST_FIT</constructionHeuristicType>
    </constructionHeuristic>
  • The constructionHeuristicType BEST_FIT_DECREASING has been renamed into WEAKEST_FIT_DECREASING. The terminology "Best Fit" was not correct and did not allow for STRONGEST_FIT_DECREASING.
    Previously in *SolverConfig.xml and *BenchmarkConfig.xml:
    <constructionHeuristic>
    <constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
    </constructionHeuristic>
    Now in *SolverConfig.xml and *BenchmarkConfig.xml:
    <constructionHeuristic>
    <constructionHeuristicType>WEAKEST_FIT_DECREASING</constructionHeuristicType>
    </constructionHeuristic>
    
  • For the shadow variable of a bi-directional relationship, the declaration has changed from @PlanningVariable(mappedBy) to @InverseRelationShadowVariable(sourceVariableName).
    Previously in *.java:
    @PlanningVariable(mappedBy = "previousStandstill")
    Customer getNextCustomer();
    void setNextCustomer(Customer nextCustomer);
    
    Now in *.java:
    @InverseRelationShadowVariable(sourceVariableName = "previousStandstill")
    Customer getNextCustomer();
    void setNextCustomer(Customer nextCustomer);
  • Multiple <planningEntityClass> elements now need to be ordered by superclasses (and superinterfaces) first, instead of superclasses (and superinterfaces) last.
    Previously in *SolverConfig.xml and *BenchmarkConfig.xml:
    <planningEntityClass>...TimeWindowedCustomer</planningEntityClass>
    <planningEntityClass>...Customer</planningEntityClass>
    <planningEntityClass>...Standstill</planningEntityClass>
    
    Now in *SolverConfig.xml and *BenchmarkConfig.xml:
    <planningEntityClass>...Standstill</planningEntityClass>
    <planningEntityClass>...Customer</planningEntityClass>
    <planningEntityClass>...TimeWindowedCustomer</planningEntityClass>
  • The element <planningEntityClass> has been renamed to <entityClass>.
    Previously in *SolverConfig.xml and *BenchmarkConfig.xml:
    <planningEntityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</planningEntityClass>
    
    Now in *SolverConfig.xml and *BenchmarkConfig.xml:
    <entityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</entityClass>
    
  • XStreamScoreConverter and XStreamBendableScoreConverter have moved package.
    Previously in *.java:
    import org.optaplanner.persistence.xstream.XStreamScoreConverter;
    Now in *.java:
    import org.optaplanner.persistence.xstream.impl.score.XStreamScoreConverter;
    Previously in *.java:
    import org.optaplanner.persistence.xstream.XStreamBendableScoreConverter;
    Now in *.java:
    import org.optaplanner.persistence.xstream.impl.score.XStreamBendableScoreConverter;
  • If you have a custom Move implementation, now extract AbstractMove.
    Previously in *.java:
    public class CloudComputerChangeMove implements Move {...}
    Now in *.java:
    public class CloudComputerChangeMove extends AbstractMove {...}