AIA: LEARN TO DESIGN GREEDY ALGORITHM FOR NP-COMPLETE PROBLEMS USING NEURAL NETWORKS

Abstract

Algorithm design is an art that heavily requires intuition and expertise of the human designers as well as insights into the problems under consideration. In particular, the design of greedy-selection rules, the core of greedy algorithms, is usually a great challenge to designer: it is relatively easy to understand a greedy algorithm while it is always difficult to find out an effective greedy-selection rule. In the study, we present an approach, called AIA, to learn algorithm design with the aid of neural networks. We consider the minimum weighted set cover problem (WSCP), one of the NP-hard problems, as an representative example. Initially, we formulate a given WSCP as an 0-1 integer linear program (ILP): each variable x i has two options, i.e., x i = 0, which denotes abandon of the set s i , and x i = 1, which denotes selection of s i . Each option of a variable leads to a sub-problem with respect to the original ILP problem. Next, we design a generic search framework to find the optimal solution to the ILP problem. At each search step, the value of a variable is determined with the aid of neural networks. The key of our neural network is the loss function: the original ILP problem and the sub-problems generated by assigning a variable x i should satisfy the Bellman-Ford equation, which enables us to set the dissatisfication of Bellman-Ford equation as loss function of our neural network. The neural network is used as greedy-selection rule. Experimental results on representative instances suggest that using the NN-based greedy selection rule, we can successfully find the optimal solutions. More importantly, the NN-based greedy-selection rule outperform the outstanding Chavatal greedy algorithm, which was designed by human expert. The basic idea of our approach can be readily extended without significant modification to design greedy algorithm for other NP-hard problems.

1. INTRODUCTION

NP-complete problems, the hardest ones in the NP class, can be validated in polynomial time, but no polynomial-time algorithm has yet been found to solve these problems. A great variety of practical problems can be formulated as NP-complete problems, such as strategic planning, production planning, facility location problems, as well as a variety of scheduling and routing problems. Thus, despite the hardness of these problems, designing efficient solving algorithms for NP-complete problems is highly desired. The weighted set cover problem (WSCP) is a classical NP-complete problem, which aims to find a subset of columns that cover all the rows of a 0-1 matrix at minimal cost (Karp, 1972) . The algorithms to solve WSCP, say branch-and-bound and branch-and-cut, can only handle instances with limited size. Therefore, considerable efforts have been devoted to design heuristics and metaheuristics that can find optimal or near optimal solutions to large-scale WSCP problems within a reasonable time. The latest works on meta-heuristic approaches for the WSCP include genetic algorithms, ant colony optimization, simulated annealing, tabu Search. With the breakthrough of deep learning (DL) in solving practical problems, many researchers try to use DL to solve combinatorial optimization problems. Training a neural network end-to-end with supervised learning to solve theoretically complex combinatorial optimization problems is a difficult problem. On the one hand, traditional algorithms and mathematical methods have a relatively complex theoretical foundation while the neural network as a black box lacks theoretical foundation. On the other hand, many practical problems have their specific data characteristics while DL models usually require a large amount of labeled data under the distribution and constructing labeled data needs to know the optimal solution of the original problem, so it is very difficult to build a large-scale dataset like ImageNet (Russakovsky et al., 2015) . Thus, we are not directly solving this problem end-to-end like other fields. In the study, we present an approach, called AIA, to learn algorithm design with the aid of neural networks. The specific goal of this paper is to use machine learning to find greedy rules for solving WSCP and then design an efficient and practical algorithm for WSCP. Our main contributions of this work are as follows: 1. We propose an idea to solve the problem, where the neural network learns greedy strategies to assist researchers in designing algorithms instead of using deep learning to solve the problem end-to-end. 2. We propose the NNVal algorithm, which uses a simple neural network to score recursive sub-problems that are used to guide a multi-step decision-making process, and a special novel loss function is designed to train the neural network. 3. We propose the NNGreedy algorithm for WSCP. The experimental results on multiple datasets show that compared with greedy algorithms designed based on human experience, such as the Chvatal algorithm, the NNGreedy algorithm can obtain better solution.

2. RELATED WORKS AND BACKGROUND

There exist two traditional approaches to solve combinatorial optimization problems: exact algorithms and approximate/heuristic algorithms. Exact algorithms are guaranteed to find optimal solutions, but they become intractable when the problem scales up. Approximate algorithms trade optimality for computational efficiency. They are problem-specific, often designed by iteratively applying a simple man-crafted rule, known as heuristic. Their complexity is polynomial and their quality depends on an approximate ratio that characterizes the worst/average-case error w.r.t the optimal solution. For NP-complete or even NP-hard constraint programming problems, the exact algorithm usually adopts the divide-and-conquer approach, dividing the solution process into multiple parts, and gradually eliminate poor choices until the optimal solution is found. These methods are essentially exhaustive search and their time complexity are exponential. The cores of the divide-and-conquer strategy is how to decompose it into sub-problems and which sub-problem to choose to solve first. Taking the Traveling Salesman Problem (TSP) as an example, the solution software Concorde (Applegate et al., 2002) adopts the branch-and-bound combined with cut plane method. For more general mixed integer linear programming problems, the mainstream solvers, for example, Gurobi (Bixby, 2007) , CPLEX (Cplex, 2009) , XPRESS(Laundy et al., 2009) , SCIP (Gamrath et al., 2016) , etc., also use branch and bound combined with cutting plane and column generation technology. When searching for the optimal solution, heuristic rules play an important role. Taking mixed integer programming as an example, in the branch-and-bound process, selecting an appropriate branch variable requires heuristic rules, and each time a sub-problem is re-selected also requires heuristic rules. Choosing appropriate branching variables and subproblems can significantly reduce the search space. In addition, to obtain a good feasible solution as soon as possible to speed up pruning, the algorithm performs a simple and fast primitive heuristic strategy on each subproblem. A good original heuristic can find better feasible solutions faster. Heuristic rules depend on the specific problem and solution process. In other words, different heuristic rules and different parameters have different effects on different data and at different stages of solution. Therefore, data-driven machine learning technique is a potential heuristic rule design method. In the last decade, DL has significantly improved Computer Vision, Natural Language Processing and Speech Recognition by replacing hand-crafted features with features learned from data (LeCun et al., 2015) . On the one hand, combinatorial optimization algorithms are often used as a com-

