Issue |
ITM Web Conf.
Volume 72, 2025
III International Workshop on “Hybrid Methods of Modeling and Optimization in Complex Systems” (HMMOCS-III 2024)
|
|
---|---|---|
Article Number | 01001 | |
Number of page(s) | 7 | |
Section | Advances in Hybrid Modeling and Optimization Techniques | |
DOI | https://doi.org/10.1051/itmconf/20257201001 | |
Published online | 13 February 2025 |
Dynamic programming in package Mathematica
1 University of Niš, Faculty of Sciences and Mathematics, Višegradska 33, 18000 Niš, Serbia
2 Laboratory “Hybrid Methods of Modelling and Optimization in Complex Systems”, Siberian Federal University, Prosp. Svobodny 79, 660041 Krasnoyarsk, Russia
* Corresponding author: arstupin@gmail.com
Dynamic programming (DP) is a powerful algorithmic technique for solving optimization problems by breaking them down into simpler subproblems. This paper presents an implementation of DP algorithms for two classic optimization problems: the Knapsack problem and the Traveling Salesman Problem (TSP). The solutions are developed and demonstrated using the Mathematica® programming language. For the Knapsack problem, we present two variants: with and without item repetition. The paper describes the mathematical formulation of each variant and provides detailed Mathematica code for their implementation. Examples are given to illustrate the effectiveness of the algorithms in finding optimal solutions. The TSP implementation demonstrates how DP can be applied to find the shortest Hamiltonian contour in a given network. The paper outlines the mathematical model, recurrent formula, and step-by-step solution process. An example with a four-node network is provided to showcase the algorithm's application. This work highlights the versatility of dynamic programming in solving complex optimization problems and demonstrates the effectiveness of Mathematica as a tool for implementing and visualizing these solutions. The presented algorithms and code snippets serve as valuable resources for researchers and practitioners working on similar optimization challenges.
© The Authors, published by EDP Sciences, 2025
This is an Open Access article distributed under the terms of the Creative Commons Attribution License 4.0, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Current usage metrics show cumulative count of Article Views (full-text article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.
Data correspond to usage on the plateform after 2015. The current usage metrics is available 48-96 hours after online publication and is updated daily on week days.
Initial download of the metrics may take a while.