第19章 移行ガイド
19.1. Business Resource Planner の移行の概要 リンクのコピーリンクがクリップボードにコピーされました!
Business Resource Planner は、Red Hat JBoss BRMS および Red Hat JBoss BPM Suite の 6.1 以降で完全に対応しています。Business Resource Planner は、計画問題を解決できる、軽量で、埋め込み可能な制約充足エンジンです。Business Resource Planner にはパブリック API が含まれ、6.2 や 6 などの後続バージョンに後方互換が組み込まれます。詳細は、Business Resource Planner ドキュメンテーションを参照してください。
JBoss BPM Suite および JBoss BRMS の 6.1 以降に、以下の変更が実装されました。
- 焼きなまし法では、最後のステップではなく、現在のステップの時間勾配が使用されます。この変更の影響はごくわずかです。
-
AbstractScore では、
parseLevelStrings(…)
メソッドおよびbuildScorePattern(…)
メソッドが、public から protected に変更になりました。コードがこの変更の影響を受ける可能性は極めて低いです。 -
Descriptor
クラスのパッケージが、記述子パッケージへ変更になりました。SolutionDescriptor.isInitialized(Solution)
にはScoreDirector
パラメーターが必要になります。 - 力まかせ (Brute Force) よりも優れた選択肢として分岐限定 (Branch And Bound) があります。詳細はドキュメンテーションを参照してください。
-
InverseRelationShadowVariableListener
の名前がSingletonInverseVariableListener
に変更になり、InverseRelationShadowVariableDescriptor
とともに、パッケージが...impl.domain.variable.inverserelation
に変更になりました。 -
(非推奨になっていた)
ConstraintOccurrence
クラスが削除されたため、ConstraintMatch
システムに切り替える必要があります。 Solution
インターフェースがパブリック API になり、パッケージがimpl.solution
からapi.domain.solution
へ変更になりました。以前の
*.java
:import org.optaplanner.core.impl.solution.Solution;
import org.optaplanner.core.impl.solution.Solution;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:import org.optaplanner.core.api.domain.solution.Solution;
import org.optaplanner.core.api.domain.solution.Solution;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow impl.move
パッケージのクラスはすべてimpl.heuristic.move
に変更になりました。現時点では、パブリック API に追加されるかどうかは予測できないため、できる限り一般的な Move を使用することが推奨されます。以前の
*.java
:import org.optaplanner.core.impl.move.Move; import org.optaplanner.core.impl.move.CompositeMove; import org.optaplanner.core.impl.move.NoChangeMove;
import org.optaplanner.core.impl.move.Move; import org.optaplanner.core.impl.move.CompositeMove; import org.optaplanner.core.impl.move.NoChangeMove;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.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;
import org.optaplanner.core.impl.heuristic.move.Move; import org.optaplanner.core.impl.heuristic.move.CompositeMove; import org.optaplanner.core.impl.heuristic.move.NoChangeMove;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow すべてのクラスパスリソースにある先頭のスラッシュは削除する必要があります。Business Resource Planner では、このリソースは、
Class.getResource(String)
ではなくClassLoader.getResource(String)
を遵守する必要があります。SolverFactory.createFromXmlResource(String)
パラメーターの、先頭のスラッシュは削除する必要があります。以前の
*.java
:... = SolverFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
... = SolverFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:... = SolverFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
... = SolverFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/solver/cloudBalancingSolverConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <scoreDrl>
のすべての要素で、先頭のスラッシュは削除する必要があります。以前の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<scoreDrl>/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
<scoreDrl>/org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<scoreDrl>org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
<scoreDrl>org/optaplanner/examples/cloudbalancing/solver/cloudBalancingScoreRules.drl</scoreDrl>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow PlannerBenchmarkFactory.createFromXmlResource(String)
パラメーターの、先頭のスラッシュは削除する必要があります。以前の
*.java
:... = PlannerBenchmarkFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
... = PlannerBenchmarkFactory.createFromXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:... = PlannerBenchmarkFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
... = PlannerBenchmarkFactory.createFromXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfig.xml");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow PlannerBenchmarkFactory.createFromFreemarkerXmlResource(String)
パラメーターの、先頭のスラッシュは削除する必要があります。以前の
*.java
:... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "/org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
... = PlannerBenchmarkFactory.createFromFreemarkerXmlResource( "org/optaplanner/examples/cloudbalancing/benchmark/cloudBalancingBenchmarkConfigTemplate.xml.ftl");
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
連鎖された
@PlanningVariable
プロパティは、graphType
にリファクタリングされました。これは、将来的に別のグラフタイプ (TREE など) に対応できるようにするためです。以前の
*.java
:@PlanningVariable(chained = true, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
@PlanningVariable(chained = true, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:@PlanningVariable(graphType = PlanningVariableGraphType.CHAINED, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
@PlanningVariable(graphType = PlanningVariableGraphType.CHAINED, ...) public Standstill getPreviousStandstill() { return previousStandstill; }
Copy to Clipboard Copied! Toggle word wrap Toggle overflow constructionHeuristicType
のBEST_FIT
の名前がWEAKEST_FIT
に変更になりました。「Best Fit (最良適合)」という用語は適切ではなく、STRONGEST_FIT
は許可されませんでした。以前の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>BEST_FIT</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>BEST_FIT</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow constructionHeuristicType
のBEST_FIT_DECREASING
の名前がWEAKEST_FIT_DECREASING
になりました。「Best Fit (最良適合)」という用語は適切ではなく、STRONGEST_FIT_DECREASING
は許可されませんでした。以前の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
<constructionHeuristic> <constructionHeuristicType>WEAKEST_FIT_DECREASING</constructionHeuristicType> </constructionHeuristic>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 双方向関係のシャドウ変数では、宣言が
@PlanningVariable(mappedBy)
から@InverseRelationShadowVariable(sourceVariableName)
に変更になりました。以前の
*.java
:@PlanningVariable(mappedBy = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
@PlanningVariable(mappedBy = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:@InverseRelationShadowVariable(sourceVariableName = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
@InverseRelationShadowVariable(sourceVariableName = "previousStandstill") Customer getNextCustomer(); void setNextCustomer(Customer nextCustomer);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 複数の
<planningEntityClass>
要素では、スーパークラス (およびスーパーインターフェース) が命令される順番が、最後から最初に変更になりました。以前の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<planningEntityClass>...TimeWindowedCustomer</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...Standstill</planningEntityClass>
<planningEntityClass>...TimeWindowedCustomer</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...Standstill</planningEntityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<planningEntityClass>...Standstill</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...TimeWindowedCustomer</planningEntityClass>
<planningEntityClass>...Standstill</planningEntityClass> <planningEntityClass>...Customer</planningEntityClass> <planningEntityClass>...TimeWindowedCustomer</planningEntityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow <planningEntityClass>
要素の<entityClass>
の名前が変更になりました。以前の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<planningEntityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</planningEntityClass>
<planningEntityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</planningEntityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*SolverConfig.xml
および*BenchmarkConfig.xml
:<entityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</entityClass>
<entityClass>org.optaplanner.examples.cloudbalancing.domain.CloudProcess</entityClass>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow XStreamScoreConverter
およびXStreamBendableScoreConverter
のパッケージが変更になりました。以前の
*.java
:import org.optaplanner.persistence.xstream.XStreamScoreConverter;
import org.optaplanner.persistence.xstream.XStreamScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:import org.optaplanner.persistence.xstream.impl.score.XStreamScoreConverter;
import org.optaplanner.persistence.xstream.impl.score.XStreamScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以前の
*.java
:import org.optaplanner.persistence.xstream.XStreamBendableScoreConverter;
import org.optaplanner.persistence.xstream.XStreamBendableScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:import org.optaplanner.persistence.xstream.impl.score.XStreamBendableScoreConverter;
import org.optaplanner.persistence.xstream.impl.score.XStreamBendableScoreConverter;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow カスタムの Move を実装している場合は、
AbstractMove
を展開します。以前の
*.java
:public class CloudComputerChangeMove implements Move {...}
public class CloudComputerChangeMove implements Move {...}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 現在の
*.java
:public class CloudComputerChangeMove extends AbstractMove {...}
public class CloudComputerChangeMove extends AbstractMove {...}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
19.2. 値および値の範囲の計画 リンクのコピーリンクがクリップボードにコピーされました!
19.2.1. ValueRangeProvider リンクのコピーリンクがクリップボードにコピーされました!
収集された数 (たとえば List<Integer>
または List<BigDecimal>
) を返す @ValueRangeProvider
がある場合は、メモリー使用が少なく、さらなる機会を提供できる ValueRange
に切り替える必要があります。
例:
これは、以下に変更になりました。
@ValueRangeProvider(id = "delayRange") public CountableValueRange<Integer> getDelayRange() { return ValueRangeFactory.createIntValueRange(0, 5000); }
@ValueRangeProvider(id = "delayRange")
public CountableValueRange<Integer> getDelayRange() {
return ValueRangeFactory.createIntValueRange(0, 5000);
}
アノテーション @ValueRangeProvider
は、以下のパッケージから移動しました。
import org.optaplanner.core.api.domain.value.ValueRangeProvider;
import org.optaplanner.core.api.domain.value.ValueRangeProvider;
以下に変更になりました。
import org.optaplanner.core.api.domain.valuerange.ValueRangeProvider;
import org.optaplanner.core.api.domain.valuerange.ValueRangeProvider;
19.2.2. プランニング変数 リンクのコピーリンクがクリップボードにコピーされました!
PlanningVariableListener
インターフェースの名前が VariableListener
に変更になりました。
以前の *.java
:
public class VehicleUpdatingVariableListener implements PlanningVariableListener<Customer> {
public class VehicleUpdatingVariableListener implements PlanningVariableListener<Customer> {
現在の *.java
:
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
AbstractPlanningVariableListener クラスは削除されました。
以前の *.java
:
public class VehicleUpdatingVariableListener extends AbstractPlanningVariableListener<Customer> {
public class VehicleUpdatingVariableListener extends AbstractPlanningVariableListener<Customer> {
現在の *.java
:
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
public class VehicleUpdatingVariableListener implements VariableListener<Customer> {
VariableListener は、@PlanningVariable
ではなく、シャドウ変数で宣言されるようになりました。このように、Business Rules Planner はシャドウ変数を認識し、すべてのシャドウ変数は、一貫した内容で宣言されます。さらに、これにより、シャドウ変数が、別のシャドウ変数に基づくことができます。
以前の *.java
:
現在の *.java
:
追加設定をしなくても、連鎖変数のアンカーを表わすシャドウ変数に対応するようになりました。たとえば、VRP では、各顧客 (エンティティ) がそれぞれ所有する車 (アンカー) を知る必要があります。この宣言サポートにより、計算を繰り返さなくても、組み込みセレクターがその情報を再利用できます。
以前の *.java
:
現在の *.java
:
VRP ケースをスケールしなくても、近傍選択は重要です。ようやく完全対応となり、ドキュメントが作成されました。
19.3. ベンチマーク リンクのコピーリンクがクリップボードにコピーされました!
新しいアグリゲーター機能に対応するために、ベンチマークの内部が完全にリファクタリングされました。
- 「費やす時間 (time spend)」フェーズの名前が「費やした時間 (time spent)」に変更になりました。これには、ログ出力と、ベンチマークレポートが含まれます。
<warmUp*>
要素の名前が変更になりました。
- <warmUpTimeMillisSpend> 要素の名前が <warmUpMillisecondsSpentLimit> に変更になりました。
- <warmUpSecondsSpend> 要素の名前が <warmUpSecondsSpentLimit> に変更になりました。
- <warmUpMinutesSpend> 要素の名前が <warmUpMinutesSpentLimit> に変更になりました。
- <warmUpHoursSpend> 要素の名前が <warmUpHoursSpentLimit> に変更になりました。
以前の *BenchmarkConfig.xml
現在の *BenchmarkConfig.xml
:
XmlPlannerBenchmarkFactory
クラスは削除され、PlannerBenchmarkFactory
の静的メソッドに置き換わりました。
以前の *.java
:
PlannerBenchmarkFactory plannerBenchmarkFactory = new XmlPlannerBenchmarkFactory(...);
PlannerBenchmarkFactory plannerBenchmarkFactory = new XmlPlannerBenchmarkFactory(...);
現在の *.java
:
PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(...);
PlannerBenchmarkFactory plannerBenchmarkFactory = PlannerBenchmarkFactory.createFromXmlResource(...);
addXstreamAnnotations()
メソッドを使用する場合は、非パブリックの API クラス XStreamXmlPlannerBenchmarkFactory
に目を通してください。
<xstreamAnnotatedClass>
要素の名前が <xStreamAnnotatedClass>
に変更になりました。
以前の *BenchmarkConfig.xml
<problemBenchmarks> <xstreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xstreamAnnotatedClass> ... </problemBenchmarks>
<problemBenchmarks>
<xstreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xstreamAnnotatedClass>
...
</problemBenchmarks>
現在の *BenchmarkConfig.xml
:
<problemBenchmarks> <xStreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xStreamAnnotatedClass> ... </problemBenchmarks>
<problemBenchmarks>
<xStreamAnnotatedClass>org.optaplanner.examples.nqueens.domain.NQueens</xStreamAnnotatedClass>
...
</problemBenchmarks>
19.3.1. SolutionFileIO リンクのコピーリンクがクリップボードにコピーされました!
ProblemIO
の名前が SolutionFileIO
に変更になり、パッケージが変更になりました (パブリック API に追加されました)。
以前の *.java
:
import org.optaplanner.core.impl.solution.ProblemIO; public class MachineReassignmentFileIO implements ProblemIO { ... }
import org.optaplanner.core.impl.solution.ProblemIO;
public class MachineReassignmentFileIO implements ProblemIO {
...
}
現在の *.java
:
import org.optaplanner.persistence.common.api.domain.solution.SolutionFileIO; public class MachineReassignmentFileIO implements SolutionFileIO { ... }
import org.optaplanner.persistence.common.api.domain.solution.SolutionFileIO;
public class MachineReassignmentFileIO implements SolutionFileIO {
...
}
現在の *.java
:
以前の *SolverConfig.xml
および *BenchmarckConfig.xml
:
<problemBenchmarks> <problemIOClass>...MachineReassignmentProblemIO</problemIOClass> ... </problemBenchmarks>
<problemBenchmarks>
<problemIOClass>...MachineReassignmentProblemIO</problemIOClass>
...
</problemBenchmarks>
現在の *SolverConfig.xml
および *BenchmarckConfig.xml
:
<problemBenchmarks> <solutionFileIOClass>...MachineReassignmentFileIO</solutionFileIOClass> ... </problemBenchmarks>
<problemBenchmarks>
<solutionFileIOClass>...MachineReassignmentFileIO</solutionFileIOClass>
...
</problemBenchmarks>
メソッド SolutionFileIO.getFileExtension()
が getInputFileExtension()
と getOutputFileExtension();
に分かれましたが、ファイル拡張には、入力と出力で同じものを使用することが強く推奨されます。
以前の *.java
:
public String getFileExtension() { return FILE_EXTENSION; }
public String getFileExtension() {
return FILE_EXTENSION;
}
現在の *.java
:
19.4. Solver の設定 リンクのコピーリンクがクリップボードにコピーされました!
Solver および BestSolutionChangedEvent では、getTimeMillisSpend()
メソッドの名前が getTimeMillisSpent()
に変更になりました。
以前の *.java
:
... = solver.getTimeMillisSpend();
... = solver.getTimeMillisSpend();
現在の *.java
:
... = solver.getTimeMillisSpent();
... = solver.getTimeMillisSpent();
以前の *.java
:
public void bestSolutionChanged(BestSolutionChangedEvent event) { ... = event.getTimeMillisSpend(); }
public void bestSolutionChanged(BestSolutionChangedEvent event) {
... = event.getTimeMillisSpend();
}
現在の *.java
:
public void bestSolutionChanged(BestSolutionChangedEvent event) { ... = event.getTimeMillisSpent(); }
public void bestSolutionChanged(BestSolutionChangedEvent event) {
... = event.getTimeMillisSpent();
}
Solver フェーズ <bruteForce>
が、<exhaustiveSearch>
の BRUTE_FORCE
タイプに置き換わりました。
以前の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<bruteForce/>
<bruteForce/>
現在の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<exhaustiveSearch> <exhaustiveSearchType>BRUTE_FORCE</exhaustiveSearchType> </exhaustiveSearch>
<exhaustiveSearch>
<exhaustiveSearchType>BRUTE_FORCE</exhaustiveSearchType>
</exhaustiveSearch>
setPlanningProblem(Solution)
メソッドと solve()
メソッドが 1 つになり、solve(Solution)
メソッドとなりました。
以前の *.java
:
solver.setPlanningProblem(planningProblem); solver.solve();
solver.setPlanningProblem(planningProblem);
solver.solve();
現在の *.java
:
solver.solve(planningProblem);
solver.solve(planningProblem);
最適解を得るためには、引き続き solver.getBestSolution()
を使用する必要があります。このメソッドは、今後最適化が必要なくなった場合の対応や、リアルタイムの計画を目的に、意図的に使用されています。
XmlSolverFactory
(パブリック API ではない) クラスが削除され、(パブリック API である) SolverFactory
の静的メソッドに置き換わりました。
以前の *.java
:
SolverFactory solverFactory = new XmlSolverFactory("...solverConfig.xml");
SolverFactory solverFactory = new XmlSolverFactory("...solverConfig.xml");
現在の *.java
:
SolverFactory solverFactory = SolverFactory.createFromXmlResource("...solverConfig.xml");
SolverFactory solverFactory = SolverFactory.createFromXmlResource("...solverConfig.xml");
以前の *.java
:
SolverFactory solverFactory = new XmlSolverFactory().configure(inputStream);
SolverFactory solverFactory = new XmlSolverFactory().configure(inputStream);
現在の *.java
:
SolverFactory solverFactory = SolverFactory.createFromXmlInputStream(inputStream);
SolverFactory solverFactory = SolverFactory.createFromXmlInputStream(inputStream);
以前の *.java
:
SolverFactory solverFactory = new XmlSolverFactory().configure(reader);
SolverFactory solverFactory = new XmlSolverFactory().configure(reader);
現在の *.java
:
SolverFactory solverFactory = SolverFactory.createFromXmlReader(reader);
SolverFactory solverFactory = SolverFactory.createFromXmlReader(reader);
addXstreamAnnotations()
メソッドを使用する場合は、非パブリックの API クラス XStreamXmlSolverFactory
に目を通してください。
カスタムの SolverPhase に、以下の変更が加えられました。
-
CustomSolverPhaseCommand
インターフェースの名前がCustomPhaseCommand
に変更になりました。 -
<customSolverPhase>
要素の名前が<customPhase>
に変更になりました。 -
<customSolverPhaseCommandClass>
要素の名前が>customPhaseCommandClass>
に変更になりました。
以前の *.java
:
public class ToOriginalMachineSolutionInitializer implements CustomSolverPhaseCommand { ... }
public class ToOriginalMachineSolutionInitializer implements CustomSolverPhaseCommand {
...
}
現在の *.java
:
public class ToOriginalMachineSolutionInitializer implements CustomPhaseCommand { ... }
public class ToOriginalMachineSolutionInitializer implements CustomPhaseCommand {
...
}
以前の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<customSolverPhase> <customSolverPhaseCommandClass>...ToOriginalMachineSolutionInitializer</customSolverPhaseCommandClass> </customSolverPhase>
<customSolverPhase>
<customSolverPhaseCommandClass>...ToOriginalMachineSolutionInitializer</customSolverPhaseCommandClass>
</customSolverPhase>
現在の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<customPhase> <customPhaseCommandClass>....ToOriginalMachineSolutionInitializer</customPhaseCommandClass> </customPhase>
<customPhase>
<customPhaseCommandClass>....ToOriginalMachineSolutionInitializer</customPhaseCommandClass>
</customPhase>
ScoreDefinition.getLevelCount()
メソッドの名前が ScoreDefinition.getLevelsSize()
に変更になりました。
19.5. 最適化 リンクのコピーリンクがクリップボードにコピーされました!
19.5.1. 終了 リンクのコピーリンクがクリップボードにコピーされました!
<termination>
の子要素はすべて、名前が変更になりました。
-
<maximumTimeMillisSpend>
要素の名前が<millisecondsSpentLimit>
に変更になりました。 -
<maximumSecondsSpend>
要素の名前が<secondsSpentLimit>
に変更になりました。 -
<maximumMinutesSpend>
要素の名前が<minutesSpentLimit>
に変更になりました。 -
<maximumHoursSpend>
要素の名前が<hoursSpentLimit>
に変更になりました。 -
<scoreAttained>
要素の名前が<bestScoreLimit>
に変更になりました。 -
<maximumStepCount>
要素の名前が<stepCountLimit>
に変更になりました。 -
<maximumUnimprovedStepCount>
要素の名前が<unimprovedStepCountLimit>
に変更になりました。
以前の *SolverConfig.xml
および *BenchmarkConfig.xml
:
以下のようになります。
19.5.2. イベント リンクのコピーリンクがクリップボードにコピーされました!
BestSolutionChangedEvent
クラスおよび SolverEventListener
クラスが、impl.event to api.solver.event
パッケージから削除され、パブリック api に追加されました。
以前の *.java
:
import org.optaplanner.core.impl.event.BestSolutionChangedEvent; import org.optaplanner.core.impl.event.SolverEventListener;
import org.optaplanner.core.impl.event.BestSolutionChangedEvent;
import org.optaplanner.core.impl.event.SolverEventListener;
現在の *.java
:
import org.optaplanner.core.api.solver.event.BestSolutionChangedEvent; import org.optaplanner.core.api.solver.event.SolverEventListener;
import org.optaplanner.core.api.solver.event.BestSolutionChangedEvent;
import org.optaplanner.core.api.solver.event.SolverEventListener;
19.5.3. スコアのトレンド リンクのコピーリンクがクリップボードにコピーされました!
一部のアルゴリズム (構築ヒューリスティック、しらみつぶし探索) のパフォーマンスを向上させるには、<scoreDirectorFactory>
に <initializingScoreTrend>
を指定します。
ANY
、ONLY_UP
、および ONLY_DOWN
を使用する場合は、InitializingScoreTrend
のドキュメンテーションセクションを参照してください。
以前の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<scoreDirectorFactory> <scoreDefinitionType>HARD_SOFT</scoreDefinitionType> <scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl> </scoreDirectorFactory>
<scoreDirectorFactory>
<scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
<scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl>
</scoreDirectorFactory>
現在の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<scoreDirectorFactory> <scoreDefinitionType>HARD_SOFT</scoreDefinitionType> <scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl> <initializingScoreTrend>ONLY_DOWN</initializingScoreTrend> </scoreDirectorFactory>
<scoreDirectorFactory>
<scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
<scoreDrl>.../cloudBalancingScoreRules.drl</scoreDrl>
<initializingScoreTrend>ONLY_DOWN</initializingScoreTrend>
</scoreDirectorFactory>
<initializingScoreTrend>
が指定されていると、 <constructionHeuristic>
が、最も適切な <pickEarlyType>
を自動的に使用するため、<pickEarlyType>
FIRST_NON_DETERIORATING_SCORE
を <initializingScoreTrend>
ONLY_DOWN
に置き換えます。
以前の *SolverConfig.xml
および *BenchmarkConfig.xml
:
現在の *SolverConfig.xml
および *BenchmarkConfig.xml
:
19.5.4. スコア計算プログラム リンクのコピーリンクがクリップボードにコピーされました!
SimpleScoreCalculator
インターフェースの名前が EasyScoreCalculator
になりました。これにより、別のスコアタイプを返す SimpleScore
と区別がつきやすくなりました。同様に、パッケージ名も変更になりました。
以前の *.java
:
import org.optaplanner.core.impl.score.director.simple.SimpleScoreCalculator; public class CloudBalancingEasyScoreCalculator implements SimpleScoreCalculator<CloudBalance> { ... }
import org.optaplanner.core.impl.score.director.simple.SimpleScoreCalculator;
public class CloudBalancingEasyScoreCalculator implements SimpleScoreCalculator<CloudBalance> {
...
}
現在の *.java
:
import org.optaplanner.core.impl.score.director.easy.EasyScoreCalculator; public class CloudBalancingEasyScoreCalculator implements EasyScoreCalculator<CloudBalance> { ... }
import org.optaplanner.core.impl.score.director.easy.EasyScoreCalculator;
public class CloudBalancingEasyScoreCalculator implements EasyScoreCalculator<CloudBalance> {
...
}
以前の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<simpleScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator<simpleScoreCalculatorClass>
<simpleScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator<simpleScoreCalculatorClass>
現在の *SolverConfig.xml
および *BenchmarkConfig.xml
:
<easyScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator
<easyScoreCalculatorClass>org.optaplanner.examples.cloudbalancing.solver.score.CloudBalancingEasyScoreCalculator
BendableScore
設定が変更し、…LevelCount
の名前が …LevelsSize
に変更になりました。
以前の *SolverConfig.xml
および *BenchmarkConfig.xml
:
現在の *SolverConfig.xml
および *BenchmarkConfig.xml
: