Yildiz, BeytullahYıldız, BeytullahYıldız, BeytullahSoftware Engineering2024-07-052024-07-05202211532-06261532-063410.1002/cpe.65092-s2.0-85112660920https://doi.org/10.1002/cpe.6509https://hdl.handle.net/20.500.14411/2049YILDIZ, Beytullah/0000-0001-7664-5145Knapsack is a combinatorial optimization problem that involves a variety of resource allocation challenges. It is defined as non-deterministic polynomial time (NP) hard and has a wide range of applications. Knapsack problem (KP) has been studied in applied mathematics and computer science for decades. Many algorithms that can be classified as exact or approximate solutions have been proposed. Under the category of exact solutions, algorithms such as branch-and-bound and dynamic programming and the approaches obtained by combining these algorithms can be classified. Due to the fact that exact solutions require a long processing time, many approximate methods have been introduced for knapsack solution. In this research, deep Q-learning using models containing fully connected layers, attention, and transformer as function estimators were used to provide the solution for KP. We observed that deep Q-networks, which continued their training by observing the reward signals provided by the knapsack environment we developed, optimized the total reward gained over time. The results showed that our approaches give near-optimum solutions and work about 40 times faster than an exact algorithm using dynamic programming.eninfo:eu-repo/semantics/closedAccessattentioncombinatorial optimization problemdeep Q-learningknapsackreinforcement learningtransformerReinforcement learning using fully connected, attention, and transformer models in knapsack problem solvingArticleQ3Q2349WOS:000682738000001