The efficient management of complex production systems is a challenge in today’s logistics. In the field of intelligent and sustainable logistics, the optimization of production batches, especially in the context of a rapidly changing product range, requires fast and precise computational solutions. This paper explores the potential of quantum computers for solving these problems. Traditional computational methods are often limited when it comes to optimizing complex logistics systems. In response to these challenges, the paper proposes the use of a hybrid algorithm that combines quantum technologies with classical computational methods. Such integration allows the computational power of both types of technologies to be harnessed, leading to faster and more efficient identification of optimal solutions. In this work, we consider the knapsack problem, a classic NP-hard optimization problem that is commonly used to verify the effectiveness of new algorithm construction methods. The algorithm presented is based on the Branch and Bound method and aims to ensure solution optimality in the context of the non-determinism of quantum computers. Within the algorithm, computations are performed alternately on a classical processor and a quantum processor. In addition, the lower and upper bounds of the objective function are computed in constant time using the D-Wave quantum machine.