Gasolver-a Solution to Resource Constrained Project Scheduling by Genetic Algorithm

The Resource Constrained Scheduling Problem (RCSP) represents an important research area. Not only exact solution but also many heuristic methods have been proposed to solve RCPSP (Resource Constrained Project Scheduling Problem). It is an NP hard problem. Heuristic methods are designed to solve large and highly Resource Constrained software projects. We have solved the problem of resource constrained scheduling problem and named as GASolver. It is implemented in C# using .net platform. We have used Dependency Injection to make the problem loosely coupled, so that other arena of scheduling like Time Cost Tradeoff (CT), Payment Scheduling (PS) etc can be merged with same solution in the future. We have implemented GASolver using Genetic Algorithm (GA).


I. INTRODUCTION
The Resource Constrained Project Scheduling Problem represents an important research problem.Not only exact solution but also many heuristic methods have been proposed to solve RCPSP.It being an NP hard problem, Alcaraz and Maroto [5] mentioned that the optimal solution can only be achieved by exact solution procedures in small software projects, usually with less than 60 activities, which are not highly resource constrained.
Therefore heuristic methods are designed to solve large and highly Resource Constrained software projects.Mohring [6] mentioned that RCPSP is one of the most intractable problems in operations research and many latest optimization techniques and local search were applied to solve it.We have solved the problem of resource constrained scheduling problem and named as GASolver.It is implemented in C# using .netplatform.We have used Dependency Injection (DI) to make the problem loosely coupled, so that other arena of scheduling like Time Cost Tradeoff, Payment Scheduling etc can be merged with same solution in the future.We have implemented GASolver using Genetic Algorithm.The problem statement is explained in the following section.Problem Statement for RCPSP (Resource Constrained Project Scheduling Problem) What is the best way to assign the resources to the activities at specific times such that all of the constraints are satisfied and the best objective measures are produced?II.GENETIC ALGORITHM Genetic algorithms (GAs) are search algorithms that are conceptually based on the methods that living organisms adapt to their environment.These methods, known as natural selection or evolution, combine the concept of survival of the fittest among string structures with a structured yet randomized information exchange to form a search algorithm with some of the innovative flair of human search.In each generation, a new set of string structures is created from (bits and pieces of) the fittest strings from the previous generation and occasionally a randomly altered new part.This process of exploiting historical data allows the GA to speculate on new search points that will improve performance thus producing better solutions.Genetic algorithms were initially developed by JohnH.Holland, a professor of psychology and computer science at the University of Michigan.As an optimization tool, the Genetic Algorithm attempts to improve performance leading to an optimal solution.
In this process, there are two distinct steps, (1) the process of improvement and (2) reaching the optimum itself.Of these two steps, the most important is the process of improvement.In complex systems, due to the potential high costs involved, reaching the optimum solution may not be justified as long as continuous improvement is being made and an optimal (desirable) solution can be found.

Genetic algorithm (GA) [1][2]
[3] is a pioneering method of metaheuristic optimization which originated from the studies of cellular automata of Holland in the 1970s.It is also known as an evolutionary algorithm and a search technique that copies from biological evolution.In Genetic Algorithm, a population of candidate solutions called individuals evolves toward better solutions from generation to generation.ADVANTAGES OF GENETIC ALGORITHM  GA can quickly scan a vast solution set.Bad proposals do not affect the endSolution negatively as they are simply discarded. The inductive nature of the GA means that it doesn't have to know any rules of the problem -it works by its own internal rules.This is very useful for complex or loosely defined problems. They efficiently search the model space, so they are more likely (than local optimization techniques) to converge toward a global minima. There is no need of linearization of the problem. There is no need to compute partial derivatives. More probable models are sampled more frequently than less probable ones www.ijacsa.thesai.org

III. RELATED WORK
In 1978, Stinson et al. [9] formulated the multiple resourceconstrained scheduling problem as an integer programming problem and advanced a branch-and-bound algorithm for solving it.The algorithm they developed was similar to branchand-bound algorithm with differences in the node selection heuristics employed and the number of resources handled (Johnson's algorithm allows for a single resource).In their algorithm, branching corresponds to creating new partial feasible schedules from given partial feasible schedules.
An experimental investigation was completed in 1988 by Dumond and Mabert [4].They studied RCPSP in an environment where new software projects arrive continuously or randomly to a system in which software projects share common resources and receive completion deadlines.Dumond and Mabert tested the performance of four due date procedures and five scheduling heuristics with full control on the due date assignment.A second test was conducted to examine the performance of the due date procedures when deadlines were set externally.Their experimental results failed to indicate a rule that uniformly outperformed the others.
In 2006 an improved Particle Swarm Optimization (PSO) algorithm [10] for resource-constrained software project scheduling problem was proposed.Improvements based on the basic PSO include: the particle swarm is initialized by heuristic rule to improve the quality of particles; inertia weight was selfadapted with iteration of the algorithm to decelerate the speed of particles; crossover mechanism of genetic algorithm were applied to particle swarm to enable the exchange of good characteristics between two particles.
Computational results for software project instances of PSPLIB demonstrate that this improved PSO was effective as compared with other mataheuristic approaches In 2007 YanLiu presented a fuzzy genetic algorithm for software project scheduling problem with resource constraints and uncertain activity duration [11].The objective of this research was to minimize the fuzzy software project make span.Firstly, fuzzy set was used to represent the uncertainty of activity duration and the corresponding comparison method of fuzzy number called integral value approach was introduced.Second, three genetic operators were used to search for an approximate shortest software project make span.Therefore, this study provided another metaheuristic method for solving resource-constraint software project scheduling problem with uncertain activity duration.
In 2009 itself Mohammad Amin Rigi, Shahriar Mohammadi K. N. Toosi [8] proposed a new evolutionary approach to resource constrained software project scheduling problem.Hybrid genetic algorithm (GA)-constraint satisfaction problem (CSP) has been applied to solve resource constrained software project scheduling (RCPS).GA's task was to find the best schedule.Their approach has used CSP in order to overcome the existing inconsistencies in activities precedence and resources conflicts.A full state CSP with min-conflict heuristic has been used for solving precedence conflicts and a simple iterative CSP is used to resolve the resource conflicts.
A more realistic resource-constrained software projectscheduling was solved in 2010 [7].A model that is applicable to real-world software projects, with discounted cash flows and generalized precedence relations is investigated under inflation factor such that a bonus-penalty structure at the deadline of the software project is imposed to force the software project not to be finished beyond the deadline.The goal was to find activity schedules and resource requirement levels that maximized the net present value of the software project cash flows.A Genetic Algorithm (GA) is designed using a new three-stage process that utilizes design of experiments and response surface methodology.The results of the performance analysis of the proposed methodology showed an effective solution approach to the problem.

IV. SOLUTION TO RESOURCE CONSTRAINED PROJECT SCHEDULING PROBLEM
To implement RCPSP using GA we need to address the following objectives:-A.method of specifying the relationships between the tasks.B. description of resources, skill, salary to perform the tasks.C. The representation of the chromosome.

D. Implementation of selection, crossover and mutation
function.

E. Calculation of an objective function to evaluate the best schedule and optimal cost. F. Class Diagram and Implementation Details of RCPSP.
A. A method of specifying the relationships between the tasks A project is best represented as a Task Precedence Graph (TPG).A TPG is an acyclic directed graph consisting of a set of tasks and a set of precedence relationships.With the help of Task Precedence Graph we will be able to set the precedence for each task.The Task Precedence graph is shown below in the form of Table.

TABLE I. TASK PRECEDENCE GRAPH FOR RCPSP
The task precedence graph describes that Task T1 and T2 are not dependent on any task although for task T3 to finish, Task T1 should be completely finished.Similarly for task T4 to complete, Task T1 and T3 should finish and so on.Thus Task Precedence Graph enables us to set the precedence for various tasks and maintains the order of execution of tasks.

C. Representation of the chromosome for RCPSP
Before Implementation any application with genetic algorithm, the most important part of genetic algorithm is to decide the structure for a genome.The genome is an essential part of genetic algorithm as it will be generated randomly.The genome for our problem is a two-dimensional array consisting of employees and tasks.We will randomly generate the employees who can work on these tasks as the random numbers generated between 0 and 1.The chromosome structure is shown below.

D. Design of operators for Genetic Algorithm
The three critical functions of genetic algorithm are selection, crossover and mutation.These are to be designed for a specific problem.We have designed these operators for RCPSP and they are explained below.

SELECTION:
We initially generate a 2 dimensional array of the above mentioned genome of employee who can work on various tasks.First we check the validity of genome by checking the following 1) Have obeyed the task precedence relationship 2) Have fitness better than death fitness variable 3) Obeys employee skill matrix Here the death fitness variable signifies the fitness of the genome.If the fitness of the genome is -1 , (value of death fitness) then the genome is an invalid genome.We calculate the fitness of the genome.We select only those genome which are good reproducers i.e. which can reproduce.If the fitness is better, only then it will reproduce otherwise it is removed from the genome list and if it is able to reproduce it will be added to the list of genomes which will be further utilized for crossover and mutation.This way we will be able to select the genomes which have the capability to reproduce further.

Crossover
The crossover operator mimics the way in which bisexual reproduction passes along each parents good genes to the next generation.Normally, two parents Genomes create two new offspring Genomes by combining their "genes" using one point crossover.Let's take an example of two genomes which are successfully randomly generated and passed the first operator of genetic algorithm.

Before crossover
Randomly we have chosen two genomes from the list of selected genomes which can reproduce well.They are represented as Genome1 and Genome2.The crossover can be performed row wise as well as column wise.Let's take we have randomly generated the row wise crossover point as 2. So we will swap genome 1 and genome2 after T2, the two baby genomes will be as follows: We have thus four genomes after crossover.They are Genome1, Genome2 and two 2 baby genomes.They will be sorted according to the fitness values and best of the two are stored in the list of genomes.We have used row wise crossover, we will also perform column wise crossover.We will generate a random number and based on that random we will decide for row wise or column wise crossover operator.

MUTATION
Following the crossover operator the offspring may be mutated by the mutation operator.Mutation is basically to get some variation in the result.Similar to random mutation in the biological world, this function is intended to preserve the diversity of the population, thereby expanding the search space into regions that may contain better solutions.Here for problem of Resource Constrained Project Scheduling, we have a two dimensional array of genome.We randomly pick a genome.We randomly generate an index value, pick any array value randomly, e.g.(4,3).Presently the array value of this cell is one.We flip this value to zero.And index (5,4) which is 0 is flipped to 1.This way we can have variation in the genome results.After mutation we again calculate their fitness and put it in the final list of genomes.

E. Calculation of an objective function to evaluate the best schedule
Our objective is to find a schedule which should finish in minimum duration and should have an optimal cost.Another important objective is that no task should be undone.Our project will not be complete if any of the tasks is left incomplete, so we have maintained a check that no task is left, it should be managed by at least one of the employee.We have made functions like calculate project duration () that is to calculate the duration of the entire project which is shown below with the help of an example.Let say we have chosen this genome to calculate the project duration and project cost which is mentioned below.

E1 E2 E3 E4 E5 E6 E7
T1 1 0 0 0 0 0 0      duration may Table 13.The Figure 6 below shows the graph of Duration Optimization.We can analyze from the graph that Project Duration is constantly decreasing during higher generations while Project Cost is varying between higher and lower values as the weight factor for Project duration is kept one and project cost is kept at zero.

C. Test Case 3
Find the optimum valid schedule, satisfying a composite function including cost and duration.This is the test case in which, we wish to optimize Cost and Duration both.We had two variables in the code, Cost and Duration.
We changed the weight factor of cost to 0.5 and for Duration it is made to 0.5 i.e. focus is on optimizing both Cost and Duration.The results are shown below in Table 15.
The Figure 7 shows the graph of Cost and Duration Optimization.We can analyze from the graph that Project Duration and well as Project Cost both are constantly decreasing during higher generations as the weight factor for Project duration is kept at 0.5 and Project Cost is also kept at 0.5.

VII. CONCLUSION AND FUTURE DIRECTIONS
Resource Constrained Project scheduling is an important problem as studied in literature survey.We have implemented this with Genetic Algorithm using C#.net.Most of the solutions that existed earlier for RCPSP were not extendable.We have implemented GASolver .coreusing which any specific problem domain genome can be constructed.The fitness function is only to be specified by the project manager for their own specific domain.The same GASolver .corecan be extended to other important research areas like Time Cost trade off, Payment Scheduling problem etc.Once all these areas will be part of GASolver, it will be the complete solution to project scheduling problems.

Fig. 1 .
Fig. 1.Data Descriptions for RCPSP Figure 1 above demonstrates the description of relationship for Resource Constrained database. Fig.

TABLE II .
CHROMOSOME STRUCTURE FOR RCPSP

TABLE X .
TASK VS ESTIMATED DAYSAs mentioned earlier the task and Estimated man days are also stored in the above Table.Based on the Task and Estimate days, we have calculated the Task Duration of Genome as shown in