Essay: Optimizing NP Hard or NP Complete problems

Essay details:

• Subject area(s): Engineering essays
• Reading time: 17 minutes
• Published on: August 27, 2019
• File format: Text
• Number of pages: 2
• Overall rating: 0 out of 5 based on 0 reviews.

Text preview of this essay:

PROBLEMS AND OPTIMIZATION

In this section we talk about the problems and their types. Later on we also move on to discuss about different types of algorithms that can be used to produce an optimal solution for the same.

Generally problems are divided into 4 groups:

1. P

2. NP

3. NP – Complete

4. NP – Hard

5. NP – Easy

6. NP – Equivalent

7. NP – Intermediate

Our main concern for this project is optimizing NP- Hard or NP – Complete problems. So we’ll discuss about these two types of problems below.

NP-HARD AND NP-COMPLETE PROBLEMS:

NP-hard (non-deterministic polynomial-time hard) problems are “those problems that are, considered to at least as difficult to solve as the hardest problems in NP. So basically a problem H is NP-hard when every problem L in NP can be reduced or brought down to H in polynomial time. If we are able to find a polynomial algorithm to solve any NP-hard problem then it would also be useful for all the problems in NP which is close to being impossible since most problems in NP are considered hard.

An example of an NP-hard problem is the decision subset sum problem, which is this: given a set of integers, does any non-empty subset of them add up to zero? This is a decision problem, and also happens to be NP-complete. Another example of this is the optimization problem of finding a cyclic route through all nodes of a weighted graph and also achieving the least cost at the same time. This is commonly known as the traveling salesman problem”. NP-hard problems often turn out to be present in areas such as:

• Configuration

• Data mining

• Selection

• Scheduling

• Rosters or schedules

• Decision support

• Phylogenetics

• Routing/vehicle routing

“A decision problem which is both in NP and NP-hard can be said to be NP -Complete. The set of NP-complete problems is often denoted by NP-C or NPC. Even if any given solution to an NP-complete problem can be verified quickly within polynomial time, there is no fixed or deterministic way by which we can be sure of getting the globally optimal solution i.e. the best solution. Therefore, the time required to solve the problem using any known algorithm increases quickly as the size of the given problem grows”.

So basically a decision problem C is NP-complete if:

1. “C is in NP”, and

2. “Every problem in NP is reducible to C in polynomial time”.

Some examples of these problems are the Knapsack problem and the Travelling Salesman problem. The Travelling Salesman Problem is described below.

Travelling Salesman Problem

The Travelling Salesman Problem is a problem where we have a salesman who has to travel between N number of cities. The order in which he visits all these cities is not very important for him as long as he gets to visit each city during his trip, and finishes where he started his journey. Each city is connected to other close by cities, or nodes by links each of which has one or more weights (or the cost) attached. The cost describes exactly how “hard” it is to traverse this edge on the graph. The pragmatic salesman is keen on keeping both the travel costs and the distance he travels to a minimum.

The Traveling Salesman Problem is a type of a large class of “difficult/hard” optimization problems that have interested mathematicians and computer scientists for decades. This algorithm has immense use in the field of science and engineering. This is the problem that I have considered for optimization. The results obtained after optimizing the same have been shown in the ‘conclusions’ section.

TECHNIQUES FOR OPTIMIZATION:

“The following techniques can be applied to solve computational problems in general, and they often give rise to substantially faster algorithms:

• Approximation: Instead of searching for the most optimal solution, we search for the closest to optimal or “almost” optimal one.

• Randomization: Use randomness to achieve a quicker average running time, and allow the algorithm to be unsuccessful with some small probability.

• Restriction: By limiting the structure of the input to be given, faster algorithms are generally possible.

• Parameterization: There are often faster algorithms if certain parameters of the input are constant or fixed.

• Heuristic: These are the ones which reasonably well in certain cases but there’s no guarantee that the algorithm would produce optimal results or consume less time for other problems”.

METAHEURISTICS

Metaheuristics is a term often used to describe a major and primary subfield of stochastic optimization. Stochastic optimization is a general class of algorithms and techniques which use some degree of randomness to find optimal (or closest to optimal) solutions to hard problems (NP – hard and NP –complete have been discussed in the next section). Metaheuristics are the most general of these kinds of algorithms, and are applied to a very wide range of problems. Metaheuristics are applied to I know it when I see it problems. These are problems for which brute-force is totally out of the question and we have very little to work on. So, in case if we are provided with a temporary solution, we can at least work on it, test it to see whether it is optimal for solving the concerned problem or not.

For this project, we’ve gone through a number of metaheuristic algorithms and the pros and cons associated with each of these algorithms. And most of the algorithms that we have studied about have been written about in the LITERATURE SURVEY section. So basically what we’ve learnt after all this study is that optimization is ubiquitous, forming a part of different fields such as engineering design and economics and being useful in trifles such as holiday planning to hefty tasks such as Internet routing. As money, resources and time are available in a limit as well and hence, optimization when it comes to resource utilization and time consumption is rather important.

Metaheuristic optimization deals with optimization problems using metaheuristic algorithms. “In the simplest sense, an optimization can be considered as a minimization or maximization problem. For example, the function f(x)=x2 has a minimum fmin=0 at x=0 in the whole domain −∞<x<∞ . In general, if a function is simple enough, we can use the first derivative f′(x)=0 to determine the potential locations, and use the second derivative f′′(x) to verify if the solution is a maximum or minimum. However, for nonlinear, multimodal, multivariate functions, this is not an easy task. In addition, some functions may have discontinuities, and thus derivative information is not easy to obtain. This may pose various challenges to many traditional methods such as hill-climbing”.In general, an optimization problem can be written as:

subject to

where f1,…,fI are the objectives, while hj and gk are the equality and inequality constraints, respectively. “In the case when I=1.0, it is termed as single-objective optimization. But if I is equal to or more than 2 , it turns into a multi-objective problem whose solution strategy is different from those for a single objective. Metaheuristic optimization is more about generalized, nonlinear optimization problems rather than linear problems. Obviously, the simplest case of optimization is unconstrained function optimization”. For example, multi-modal test functions are used for validating new optimization techniques or algorithms, and a good example of the same is Ackley’s function which has a global minimum fmin=0 at (0,0).

Figure 9: Ackley’s multimodal function

CLASSIFICATION OF METAHEURISTIC ALGORITHMS

To solve the above mentioned optimization problem, good optimization algorithms are required. These algorithms can be further classified on the basis of their characteristics and focus.

If the derivative/gradient of an objective function is the focus i.e. the basis is focus, then optimization algorithms can be divided into gradient-based algorithms and derivative-free or gradient-free algorithms. A gradient-based algorithm such as hill-climbing makes use of derivative information, and they are quite efficient. Derivative-free algorithms don’t make any use of any derivative information but the values of the objective function itself. In case of any discontinuities present in the function or an excess in cost to calculate derivatives accurately, derivative-free algorithms such as Nelder-Mead downhill simplex turn out to be very useful.

From a different perspective, optimization algorithms can be classified into trajectory-based and population-based. A trajectory-based algorithm typically uses one agent or a solution at a time, which will find out a path as the iterations or repetitions continue. Hill-climbing is a trajectory-based algorithm, and it links or attaches the starting point with the final point via a zig-zag path. Another important example of the same is simulated annealing which is a popular metaheuristic algorithm. While population-based algorithms like particle swarm optimization (PSO) use multiple agents or solutions which will interact/communicate and find out multiple paths.

Optimization algorithms can also be classified as deterministic or stochastic. If an algorithm works in a deterministic and mechanical manner without any sort of randomness in it, it is said to be deterministic. For such algorithms, they will reach the same final solution if we start with the same initial point. Some examples of deterministic algorithms are Hill-climbing and downhill simplex. While if there is some randomness in the algorithm, the algorithm will generally reach a different point every time the algorithm is run despite the use of the same initial point. Some examples of stochastic algorithms are genetic algorithms and particle swarm optimization.

Search capability can also be a factor for classifying these algorithms. In such a case algorithms can be divided into local and global search algorithms. Local search algorithms typically converge/ reach towards local optima which are often not the global optimum, and such an algorithm is mostly deterministic and has zero ability to escape from the local optima. Simple hill-climbing is an example of this. But for global optimization, local search algorithms are not meant to be used, and hence, global search algorithms should be used which are not stuck inside the local optima and can produce a globally optimal result. Modern algorithms are mostly meant for global usage but turn out to be inefficient most of the times.

METAHEURISTIC ALGORITHMS

Some of the most popular metaheuristic algorithms are as follows:

1. Simulated Annealing

Simulated annealing is based on the phenomenon known as metal annealing. The main advantage of simulated annealing is its capability of avoiding being trapped in the local optima unlike the gradient based algorithms.

In this process, the actual search moves trace a piece-wise path where with each move, an acceptance probability is evaluated, which accepts both changes – the ones that improve the objective function and the ones that do not improve the objective. “The acceptance probability p is given by the formula:

p=exp[−ΔEkBT],

where kB is the Boltzmann’s constant, T is the temperature for controlling the annealing process and ΔE is the change in energy. The change in the objective function, Δf , can be related to ΔE in the following way

ΔE=γΔf,

where γ is a real constant (typically, γ=1 for simplicity).

Simulated annealing puts an adequate amount of randomness into stuff so as to be able to escape local maxima early in the process without getting late in the process, when a solution is nearby. This makes it pretty amazing at tracking down a decent solution irrespective of its starting point.

2. Genetic Algorithms

Genetic algorithms (GAs) are possibly the most popular evolutionary algorithms with a diverse range of applications. These are heuristic search algorithms based on the evolutionary ideas or notion of natural selection as well as genetics. As such they represent an intelligent and practical exploitation of a random search which is being put to use to solve optimization problems. But GAs are by no means random, instead they use up historical information in order to direct the search into the region of better results within the search space. The basic techniques or methods of the GAs are designed in manner so as to simulate processes in natural systems essential for evolution.

A large number of well-known optimization problems have been solved by GAs. In addition, GAs are population-based and many modern evolutionary algorithms are either based on or have large similarities to GAs.

GAs, developed by John Holland in the latter half of 20th century, are models or abstractions that depict biological evolution based on “Charles Darwin’s theory of natural selection”. Holland was the first to use operators such as crossover, mutation, recombination, and selection in the study of artificial and adaptive systems. These genetic operators are the most important components of GAs as a problem-solving strategy. The process used in GAs involves the encoding of solutions as arrays of bits or character strings (chromosomes), the manipulation or change in these strings by making use of genetic operators and a selection, based on their fitness value to search for a solution to a particular problem. This is often done through the following procedure:

1) Define an encoding scheme;

2) Define a fitness function or selection criterion (objective function);

3) Create a population of chromosomes;

4) Evaluate the fitness or find out the fitness value of every chromosome in the population;

5) Create a new population by performing FPS (fitness-proportionate selection), and using operators such as crossover and mutation;

6) Replace the old population by the new one.

Steps 4), 5) and 6) are then repeated for a number of generations.

At the end, the most optimal chromosome is decoded to get a solution to the problem.

Each iteration, which leads to a new population, is called a generation.

3. Ant Colony Optimization

Ant colony optimization was proposed in the year 1992 by Marco Dorigo and is basically based on the foraging behaviour of social ants. Many insects such as ants make the use of “pheromones as a chemical messenger”. Ants are social insects and millions of them live together in organized colonies. When foraging, a swarm of ants interact in their local environment. Each ant lays pheromones or scent chemicals to communicate with the others. Each ant is also capable of following the route marked with pheromones laid by the others. When an ant finds a food source (solution), it will mark it with the chemical and also mark the trail or route to and from it.

However, the pheromone concentration ϕ decays or evaporates at a constant rate γ.

“That is,

Where ϕ0 is the initial concentration at t=0. Here the evaporation is rather important since it ensures the possibility of convergence and self-organization”.

From the initial foraging route which was chosen randomly, the pheromone concentration differs from route to route and the ants follow the routes with a higher concentration of pheromones and the pheromone is also enhanced by the increasing number of ants. A path becomes the favored path once more and more ants pass through it. Thus, some favorite routes emerge, often the shortest or more efficient ones. This is actually a +ve feedback mechanism. As the system evolves, it converges or reaches to a self-organized state.

Since the ant-colony works on a very dynamic system, the ant colony algorithm can be of immense use in graphs with changing topologies. “Examples of such systems are computer networks and artificial intelligence simulations of workers”.

4. Bee Algorithms

Bee algorithms are a collection of metaheuristic algorithms, based on the foraging behaviour of bees. A few variants of a similar kind exist such as honeybee algorithm, ABC (artificial bee colony), virtual bee algorithm and honeybee mating algorithms.

Honey bees stay in a colony and they forage and store honey in the colony they had constructed. Honey bees can “interact using chemicals known as pheromones and `waggle dance’. For example, an alarming bee may release a chemical message a.k.a. pheromone to stimulate attack response in other bees. When bees find a good food source (optimal solution) and bring some nectar or honey back to the hive, they will send the location of the source by using the waggle dance for signaling reasons”.

Bee algorithms have been put to use in a large number of fields such as:

• Optimisation of clustering systems or classifiers

• Manufacturing process

• Control

• Multi-objective optimisation

• Bio-Engineering

The pseudo code for the same is as follows:

Fig 10: Bees algorithm pseudo-code

Variables:

• ns – Number of scout bees

• ne – Number of elite sites

...(download the rest of the essay above)

This essay was submitted to us by a student in order to help you with your studies.

If you use part of this page in your own work, you need to provide a citation, as follows:

Essay Sauce, Optimizing NP Hard or NP Complete problems. Available from:<https://www.essaysauce.com/engineering-essays/optimizing-np-hard-or-np-complete-problems/> [Accessed 18-10-19].

Review this essay:

Please note that the above text is only a preview of this essay.

 Name Email Review Title Rating Review Content