A genetic algorithm approach for scheduling of resources in well-services companies

In this paper, two examples of resources scheduling in well-services companies are solved by means of genetic algorithms: resources for call solving, people scheduling. The results demonstrate that the genetic algorithm approach can provide acceptable solutions to this type of call solving for scheduling in well-services companies. The suggested approach could be easily extended to various resource scheduling areas: process scheduling, transportation scheduling.

The scheduling of incidental and regular maintenance operations in well-services companies is an important topic due of its direct connection with production stopping and financial implications.Also, the companies providing well services are working into a competitive environment and they need to efficiently and quickly compute the schedules for well interventions.Additionally, the costs for well fixing may be computed based on well location, type of call etc [9].In this context, an efficient algorithm for schedule generation is needed.The provided algorithm should be able to deal with rescheduling problems.

A. Problem formulation
In well-services companies, the concept of calls is used to manage the issues or regular maintenance requests for wells.Mainly, there are two kinds of calls: incident calls arisen from a malfunction or incident at a well, with high priority, and regular calls for periodical maintenance operations, low priority.Some of typical well interventions are: pumping, wellhead and "Christmas tree" maintenance, slick line, braided line, coiled tubing, snubbing, workover.For such well interventions, there is need to schedule appropriate resources, depending on their skills.

Each call could be defined by four characteristics:
 type of call, needed resources (number and skill) for solving it  location of the well where the call occurred

 duration for completion
The target is to optimally allocate resources to be able to solve all calls before their dead-line.A similar approach for real-time scheduling of resources was found in [6].  1 contains an example of database with details for calls: needed skills, location, duration and target dead-line.For each skill, a flag with 0 or 1 value is used.The number of skills taken into account skills can be easily extended.The Location column is presenting the place were the call should be fixed.Duration is the needed time to fix the call.Deadline is the time limit until when the call should be closed.All calls are ordered by deadline.
The proposed model of input data, based on ordering by dead-line of calls, is allowing re-scheduling of the existing items from data-base every time when new entries appear.
Only not yet started calls (including transportation) are re-scheduled.An example of database with resources is included in table 2. Each resource has an identifier.The skills of the resources are encoded using flags for each skill, in a similar way with the calls.The location of each resource is different than the location of calls and all resources are grouped together in the well services operation center.
Similar approaches to encode problems can be derived for process scheduling in manufactories or for transportation scheduling.

B. Problem solution
Figure 1 contains the sketch of the used approach for resource scheduling.The requests formulated by calls are fulfilled by scheduling of resources (field operators, equipments, cars).This schedule is generated by genetic algorithm that is using special objectives.Such kind of objectives could be: schedule all tasks before their deadline, the time for fulfilling the last task should be as early as possible.

1) Chromosome encoding
The GA chromosomes are arrays containing the identifiers of resources which will solve each call from database.The resource located at position k will solve the call no k.In table 3, the used encoding from chromosomes is presented.For each call, a gene will have a value from 0 to the maximum value of the resource identifier.Because all resources are consecutively numbered, the maximum value for resource identifiers is the total number of existing resources.The special value 0 is used for not scheduled resources.This approach is allowing the genetic algorithm not to schedule any resources for the low priority calls, in case of huge number of existing calls in database.This type of representation can completely encode a schedule for all calls from database.

2) Objective function
The database with calls is always ordered by deadline.The objective function is evaluating the completion time of each call as it is encoded by chromosomes, as it follows: b) a call is started as soon as possible when all scheduled resources are free; b) the finishing time is the starting time to which it is added the necessary time for completion.
A penalty factor is computed for not scheduled calls and for missed deadlines.
The used objective function is a measure of the total delay, namely the sum of differences between completion time and due date for each call [7]: where L is the total latency, c i is the completion time of call i, d i is the deadline of call i, n is the total number of calls, i is an index between 1 and n.
Minimizing the total delay is a MIN-SUM problem [7].
Another used objective function is designed to minimize the time of completion of the last task, also known as makespan [7].
The corresponding equation for the makespan optimization is:

 
where C is the maximum, c 1 ,c 1 ,...,c n are the completion times of calls 1...n.
The makespan is also used to measure the utilization time of the resources.The makespan minimization is a MIN-MAX problem [7].

3) Constraint setting
For each gene, the minimum and maximum values are set: minimum value is 0, maximum values is the number of field operators.The value 0 is used for not scheduled resources.These limit values are grouped in a 2-rows constraint matrix with a number of columns equal to the chromosome's length.Using this constraint matrix, all constraints are specified and they will be checked to be fulfilled during the generation of the initial population after the application of the mutation operator.

4) Initial population
An initial population is generated using a default functionality of the "MATLAB Genetic Algorithms and Direct Search" toolbox [5].The generated population satisfies the minimum and maximum values from the constraint matrix.A value of 200 was used for the GA population size.

5) Genetic operators
Elitism: The elitism operator is set to select 1 individual (the best one) for the next generation.

Schedule
Objectives www.ijacsa.thesai.orgMutation: A customized algorithm was implemented for the mutation operator.This modifies the values of the genes with a random value that preserves the allowed range; mutated genes were kept between the allowed minimum and maximum.The fraction for mutation was set to approx 0.01.
Cross-over: The customized crossover operator is a single point crossover algorithm.By itself, this operator preserves the range of the allowed values for genes.The crossover fraction was set at 0.6.

6) Other genetic algorithm settings
It was used for the tournament selection with rank based scaling of the fitness.The maximum number of generations was 100.

III. RESULTS
The genetic algorithm is iterating and its final best individual is representing the solution of the formulated problem.
The first defined problem is to schedule all resources so that all calls must be solved before their deadline.The table 4 and figure 2 are presenting the obtained results.
The Gantt chart from figure 2 is showing how each resource is allocated to solve various calls.In case of the resource number 2, the first set of solved calls is located at a different location than the call 401; thus, there is need for an extra time to travel from location number 2 to location number 1. Table 4 presents an example of obtained schedule.The resulted schedule is allowing the scheduling needed resources to fulfill all calls, prior to their deadline.By comparing the Time and Target Time columns, it can be observed that all calls are solved at least until the time of the dead-line.The second defined problem is to schedule all resources such that the time needed to fulfill all requests (makespan) is minimum.The obtained results are presented in table 5 and figure 3.   Starting and finishing time is expressed in hours, on X axis.The ID of calls is visible in corresponding rectangle and also on legend.
In case of makespan minimization, the completion time for the last call is 16.But the 1 st dead-line is missed.As a note: the attempt to combine both goals (solving prior dead-line and make span minimization) on this configuration of database was leading to the same results as in the first approach, a value of 17 for the last completion time with all deadlines fulfilled.

A. Problem description
In case of well-services companies, an example of a team is composed as follows: workers, technical coordinator, team leader.Due to their roles they have different type of shifts: 12 hours day / night shifts for workers, 8 hours day shifts for the technical coordinator and team leader.The schedule for workers is organized in a 28 days pattern, as in table bellow.This alternate of day shifts (noted with D), night shifts (N), and free days (-) is assuring a proper fulfillment of rules concerning rest time and the total amount of needed work hours during a month.The team leaders and technical coordinators are scheduled using a pattern with 8 hours day shift (named Flex), only from Monday to Friday.
Additional types of events are: time off, preference day off, preferably working day.The genetic algorithm should generate an automated planning, for each team separately for at least 4 employees for a period up to 6 months.
In this planning, the system must take into account the following rules in the order described below: 1.For each team, there should be no interval uncovered with shifts found with type D and N 2. Allocation pattern with D and N shifts for workers is respecting the table 6.
3. Flex allocation pattern shifts for team leader and technical coordinator is exactly as in table 7.
4. The allocation system for D and N shifts will take into account of the events included in the calendar such as Time Off, preferably day off and preferably working day.When the system will meet one of the special calendar events, the system will schedule the event and then the current pattern will be reset.

5.
If there are situations when some time intervals remain uncovered with workers, the team coordinator can take tours of type D or N 6.If the team has more than 4 workers, and the above conditions are met, after a complete rotation of 28 days, their schedule will continue with Flex week, and then it will return to pattern.7. The coordinators will have Flex shifts, as default, except point 5.

B. Problem solution 1) Chromosome encoding
The basic idea of data representation for this problem is to circular shift the schedule pattern with various numbers of positions for each employee.
The chromosomes are containing numbers indicating the number of positions to shift.
In case of teams with more than 4 workers, the regular pattern is extended with a week Flex pattern.In this case, the pattern is 35 days long.The usage of multiple of 7 numbers for values in chromosomes was leading to good enough results of the generated schedules.Additionally, such weekly shiftings were produced more human readable schedules compared with the approach of daily shifting of patterns.Depending of the length of the pattern, the range of shiftings is from 0 to 3 (for 28 days pattern) and form 0 to 4 (for 35 days pattern).
In case of the team leader, no shifting is needed due to request to allow only Flex schedule pattern.In case technical coordinator, the pattern could be a mix of worker's pattern and  In table 8, the encoding of chromosomes and allowed ranges for each gene is presented.The allowed range is differing according to employee's role.This kind of representation can completely encode the schedules of all employees.

2) Objective function
The objective function is deriving a schedule starting from chromosome encoded shifting positions.The vectors encoding the used patterns are shifted using the values stored inside chromosomes.A temporary schedule is computed first.Then, the schedule is processed by applying special events as preferable day off, or time off or preferable working day.Another step is the update of schedule by resetting pattern after each special calendar event.Next step is the enhancement of schedule by forcing the technical coordinator to cover the missed Day or Nights shifts, if it is the case.Last step is the evaluation of the final schedule: the still missed Day or Night shifts are highly penalized (100 * no_of_missed_shifts ); the difference between number of covered Day and Night shifts targeted to be as close as possible to 0.

F = 100 * no_of_missed_shifts + abs(no_of_day_shifts -no_of_night_shifts)
The goal of the used genetic algorithm is to minimize the value of F.Even the algorithm of population generating or the used mutation or cross-over algorithms are producing floating point values for genes, the objective function is using rounded values for content of chromosomes.

3) Constraint setting
The minimum and maximum values are set, for each gene: minimum value is 0, maximum values are represented by the number of allowed shiftings.These limits are preserved during evolving of the genetic population.The limit values are included into a constraint matrix.

4) Initial population
The initial population is generated using a modified shape of the uniform method from "MATLAB Genetic Algorithms and Direct Search" toolbox [5].This method is preserving the minimum and maximum values from the constraint matrix.The GA population size was set to 100 individuals.

5) Genetic operators
Elitism: The number of elitist individual which are automated selected into next generation was 1.
Mutation: A modified shape of the uniform mutation was used as mutation operator.The used operator is checking the preserving of linear constraints.The default fraction for mutation was used.
Cross-over: The used crossover operator is a multipoint crossover version from GADS toolbox [5].This crossover operator preserves the range of the allowed values for genes.The crossover fraction was set at 0.6.

6) Other genetic algorithm settings
The tournament selection with rank based scaling of the fitness was used.The maximum number of generations was 50.

C. Results
First set of results is for a team with 11 workers and 1 Team Leader / Technical coordinator.
In this case, there were special events, of type preferably day off for the team leader person and for the worker 10.The special events are gray-highlighted in table 9.All rules were fulfilled, including the special events.Additionally, the algorithm was tacking care to balance for each the number of people scheduled for Day or Night shifts, to avoid situations with all except one people scheduled for the night shift.www.ijacsa.thesai.orgAnother example is presented in table 10.Here, the team is consisting in 3 workers, 1 technical coordinator and 1 Team Leader.For this configuration of team, the technical coordinator is following exactly the pattern or regular workers.
The used pattern is only 28 days long.For the last days of the current month, the pattern is repeatedas it can be seen in the gray-highlighted portion of table 10.
In this configuration, all requirements are fulfilled.The difference between total number of day shifts and total number of night shifts is 0.

V. CONCLUSION
Two problems for resource scheduling in case of well services companies were presented in this paper: resource allocation to solve calls and people scheduling for working.For the solving of calls problem, there were proposed two methods: solving before deadline and makespan minimization.Both approacheds had accurate results.Additionally, the proposed approaches are allowing re-scheduling of resources for calls.
The proposed solution for the shift based people scheduling for working has accurate results.Our solution is tacking care of special events too.
In conclusion, the results appear to show that this resource scheduling problem has an acceptable solution via the genetic algorithm approach.
In the future, we intend to extending to process for scheduling or for transportation scheduling.As further extensions, some indicators of resources usage or resource availability could be derived.

Figure 1 .
Figure 1.The genetic algorithm mixes all inputs and generates the schedule

Figure 2 .
Figure 2. The Gantt chart of the generated schedule for the solving prior deadline problem.The Y axis is showing the value of resource identifier.Starting and finishing time is expressed in hours, on X axis.The ID of calls is visible in corresponding rectangle and also on legend.
ijacsa.thesai.orgFor the call 903, there is a delay of 1 hour between target time and completion time.

Figure 3 .
Figure 3.The Gantt chart of the generated schedule for the makespan minimization problem.The Y axis is showing the value of resource identifier.Starting and finishing time is expressed in hours, on X axis.The ID of calls is visible in corresponding rectangle and also on legend.

6 FF
F F F --D D N N -----D D N N N ----D D D N N -----Worker 7 D D N N -----D D N N N ----D D D N N -----F F F F F --Worker 8 ----D D D N N -----F F F F F --D D N N -----D D N N N TC /TL -F F F F --F F F F F --F F F F F --F F F F F --F F F F F --Worker 9 --D D N N N ----D D D N N -----F F F F F --D D N N ---Worker 10 N N -----F F F F F -----D D N N -----D D N N N ----Worker 11 N N -----F F F F F --D D N N -----D D N N N ----D D D TABLE X. RESULTED SCHEDULE FOR A TEAM WITH 3 WORKERS, 1 TECHNICAL COORDINATOR AND 1 TEAM LEADER D N N -----D D N N N ----D D D N N -----D D N N ---Work er 2 N N -----D D N N -----D D N N N ----D D D N N -----Work er 3 ----D D D N N -----D D N N -----D D N N N ----D D D T. C. --D D N N N ----D D D N N -----D D N N -----D D N N N T. L. F F F F F --F F F F F --F F F F F --F F F F F --F F F F F --

TABLE I .
EXAMPLE OF A DATABASE STORING CALLS

TABLE II .
EXAMPLE OF A DATABASE WITH RESOURCES

TABLE III .
CHROMOSOME ENCODING AND ALLOWED RANGES FOR EACH ELEMENT

TABLE IV .
THE SCHEDULE GENERATED BY GENETIC ALGORITHM FOR THE SOLVING PRIOR DEADLINE PROBLEM

TABLE V .
THE SCHEDULE GENERATED BY GENETIC ALGORITHM FOR THE MAKESPAN MINIMIZATION PROBLEM

TABLE VIII .
CHROMOSOME ENCODING AND ALLOWED RANGES FOR EACH ELEMENT

TABLE IX .
RESULTED SCHEDULE FOR A TEAM WITH 11 WORKERS AND 1 TEAM LEADER / TECHNICAL COORDINATOR Worker