Package org.ddolib.examples.knapsack
Class KSDdoMain
java.lang.Object
org.ddolib.examples.knapsack.KSDdoMain
Knapsack Problem (KS) with Ddo.
This class demonstrates how to solve an instance of the bounded Knapsack Problem (BKP) using a Decision Diagram Optimization (DDO) algorithm.
The program performs the following steps:
- Loads a knapsack instance from a data file.
- Defines a
DdoModelwith:- A relaxation function for merging states (
KSRelax). - A state ranking heuristic (
KSRanking). - A fast lower bound heuristic (
KSFastLowerBound). - A dominance checker (
KSDominance). - A frontier of type
CutSetType.Frontier(SimpleFrontier). - A width heuristic (
FixedWidth) and cache usage. - Verbose output level (
VerbosityLevel).
- A relaxation function for merging states (
- Creates a
Solversand runs the DDO algorithm. - Prints updates when a new incumbent solution is found and stops after 10 seconds of runtime.
- Outputs the final search statistics.
The DDO solver leverages relaxed decision diagrams, caching, and state ranking to efficiently explore the search space for high-quality solutions.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
KSDdoMain
public KSDdoMain()
-
-
Method Details
-
main
Entry point of the DDO demonstration for the Knapsack Problem.- Parameters:
args- command-line arguments (not used)- Throws:
IOException- if the instance file cannot be read
-