Abstract

Introduction. The application of binary-reflected (mirror, reflexive) Gray codes for solving combinatorial problems with pseudo-Boolean functions (polynomials from Boolean variables) is considered. A recursive Ehrlich algorithm is given for generating a sequence of lines n-bit Gray codes, in which each subsequent line differs from the previous one by only one digit (bit). As an example of the effectiveness of the use of these codes, the solution of two combinatorial problems with Boolean variables with a complete enumeration of solutions is considered, and it is shown how these codes can be used to efficiently calculate the values of the objective function and constraints. The results of an experimental study are presented, which show that Gray codes can be practically applied in branching schemes, for example, in the branch and bound method, when the number of variables in the branching nodes of the decision algorithm does not exceed 35. Purpose. The purpose of the article is to show the developers of algorithms and programs how to apply Gray codes in various branching schemes of the decision algorithm, for example, in the branch and bound method, when the number of binary (Boolean) variables at the nodes of the tree is small (less than 35). The technique. The research methodology is based on a computational experiment for solving the 0-1 knapsack problem with the proposed algorithm of exhaustive search the solution with partial and full recalculation of the values of objective function and constraint of the problem. During the experiment, the accuracy of solving the problem by a “greedy” heuristic algorithm with time complexity O(n2) was also checked. Results. As a result of the experiment, it was found that the algorithm with a partial recalculation of the objective function and restrictions can be used for practical calculations in branching schemes, when the number of variables in the nodes of the branching tree does not exceed 35. The algorithm with partial recalculation is faster than the algorithm with full recalculation on average by 7 times. The heuristic "greedy" algorithm can be applied in practice to solve the 0-1 problem of a knapsack of large dimension (more than 10,000 items), when need to obtain an approximate value of the objective function at the limited computing resources. Scientific novelty and practical significance. The novelty of the work lies in the proposed approach to solving combinatorial optimization problems with pseudo-Boolean functions using Gray codes. The efficiency of the proposed algorithm with a partial recalculation of the values of the objective function and constraints is shown, and its can be applied in practice in various branching schemes of the decision algorithm. Keywords: Gray codes, combinatorial optimization problems, problem solving time.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call