1 Introduction

Scheduling is crucial for construction project planning. Properly prepared schedules allow construction managers to prioritize and allocate time for different tasks; represent the dependencies between them; manage resources, both renewable (labor, machinery, materials) and non-renewable (funds). To create a schedule, one must determine the order of tasks and their start times. This must be performed in such a way that specific objectives of the project are achieved whilst at the same time, organizational conditions are fulfilled, and planning constraints are applied. Some of the construction project planning objectives include minimizing the duration of the project; minimizing or providing evenness of the resources’ consumption; maximizing the construction project economic value for the contractor. Organizational conditions may include, for example, the need to ensure the continuity of work performed by various groups of workers, or the possibility of using different construction activities performance modes. Basic planning constraints are linked to the availability of the time, and resources needed to implement them and technological dependencies between the activities.

To meet the needs of the construction market, as well as to ensure flexibility in decision-making, the authors decided to combine concepts of flow shop and multi-mode resource-constrained project scheduling problem. The article presents a new optimization model of a multi-unit construction project with specific assumptions. Its most important assumptions are the need to perform many works in the undertaking for many different building structures, the availability of many different contractors for works in the facilities. The new scheduling model for a multi-unit construction project is illustrated by a computational example. The new presented model takes into account discounted cash flows, the knowledge of which is necessary for construction companies to make strategic decisions, and to survive on the market. In the model presented in the article, the whole project timespan is divided into n-day intervals representing billing periods (usually a month). Direct and indirect costs are calculated proportionally in each period and are discounted every n-days. Income was modeled in a form of Progress Payments (PP) which is common in the construction industry. The client pays contractors based on a monthly invoice, and report on completed works. The payments correspond to the direct and indirect costs plus the contractor’s profit (and are also discounted). However, taking into account specifics of the construction industry, the authors assumed that the payments are made with a 1-month lag. To reflect the market characteristics, contractual penalties for exceeding the deadline were introduced into the model. Penalties related to the discontinuity of work of the work teams were also applied. These penalties are not discounted and are accounted for with a lag equal to one billing period. Accumulated cash flows are calculated for each n-day period. If the accumulated cash flow in a given period is negative, then we charge an additional penalty that corresponds to the cost of the loan required for the financing of the contractor’s operations. The objective function assumes the maximization of the total profit—cumulated cash flow on the last day of the project’s implementation (one period after completion of construction works).

2 Literature review

Theoretical studies of project scheduling problems are currently focused on searching for optimal schedules considering existing constraints. These are usually NP-hard optimization problems, as presented in [2, 3]. Due to the variety of possible constraints and schedules’ objective functions, these problems can be grouped into different categories—models of project scheduling problems (PSP). Deterministic approach for solving PSP optimization is the most common one, due to its practical aspect. The state-of-the-art review of PSP deterministic models was presented in, e.g., [4,5,6]. One of the most common PSP models investigated by researchers is the well-known Resource-Constrained Project Scheduling Problem (RCPSP), e.g., [7]. This phenomenon results from the wide possibilities of applying this problem in the practice of industrial production.

Nowadays, in practice, more and more contracts focus on delivering non-standard products, or ones that were individually agreed on with the client. That is why scheduling production processes are often in line with the principles of project management. The same principle is also characteristic of the construction industry. A generalization of RCPSP is the Multi-Mode RCPSP (MRCPSP or rarely MMRCPSP). In such problems, each activity can be executed in one of the several modes. Each mode has a specific duration and specific resource requirements [8]. Due to the introduction of modes, decision makers are able to study different projects’ variants; for example, testing how allocating additional resources to different tasks will affect project duration. It is worth mentioning that with the introduction of the additional decision variables (activities’ modes), the possible solutions’ space (and, at the same time, the amount of time required to solve the problem) increases. In other words, the computational time required for solving a MRCPSP is longer than that of a similar RCPSP without multiple modes [9].

Generalized RCPS/MRCPS problem is obtained by replacing the makespan minimization with other agents—any regular measure of performance: different types of trade-offs, objective functions, constraints, and conditions, e.g., total cost [10], NPV [11], quality [12], deviations from average employment level [13], total project delay [14], monthly cash demand [15], cost minimization in regard to the base-plan [16], and schedule robustness [17]. Such problems can be referred to as the Generalized Resource-Constrained Project Scheduling Problem (GRCPSP) [9]. Such problems can be divided into different categories, for example, the dependencies between time and cost of a project are taken into account in Multi-Mode Resource Constrained, Discrete Time–Cost Trade-Off problems (MRC-DTCTP) [13] which in construction are often called simply Time–Cost Trade-Off (TCT) problems. Other variations of the problem include P-MRCPSP (P at the beginning stands for Pre-emptive) in which activities can be pre-empted at any point in time and restarted at no additional cost [8] or MRCPSP with Discounted Cash Flows (MRCPSPDCF) [11], which focuses on maximization of NPV.

The procedures used to solve MRCPSP (and scheduling problems in general) can be classified as: exact, heuristic, and metaheuristic [1, 3]. The exact procedures include, among others, linear programming (LP), dynamic programming (DP), and Branch and Bound method (B&B). The heuristic methods include priority rule-based heuristics [9].

Practical scheduling problems in construction can be easily qualified as NP-hard (non-deterministic, polynomial-time hard) problems. The time needed for solving such problems grows exponentially with the increase of the problem’s size [2, 3, 9]—therefore, mathematical and heuristic methods often do not enable finding solutions to complicated construction problems within an acceptable period of time. In the view of many authors, metaheuristic algorithms seem to be the most appropriate measures for scheduling and task sequencing [1, 8,9,10,11, 18].

The metaheuristic approach does not guarantee finding the optimal solution and the obtained results are often subject to their input parameters; however, they seem perfect for solving complicated, NP-hard class problems because they enable computing suboptimal (acceptable) solutions within an acceptable time frame.

A great variety of metaheuristic algorithms can be used for solving GRCPSPs, e.g., Genetic Algorithms (GA) [8, 10], Simulated Annealing (SA) [11], Tabu Search (TS) [11, 19], Particle Swarm Optimization (PSO) [20], Ant Colony Optimization (ACO) [21] or hybrid algorithms [22, 23]. However, only a handful of conducted research activities, concerning multi-mode problems, revolve around the construction industry. Some of these cases involve real-life case studies. Özdamar and Dündar [24] optimized NPV for apartment building construction, with different modes’ duration (however, activities’ cost parameters were fixed). Chen and Weng [25], and Ghoddousi et al. [13] used GA to optimize time–cost trade-off for a simplified warehouse construction project. Zhang and Xu [26] minimized makespan (at the same time maximizing quality) of the hydropower plant using PSO algorithm. The same case has been optimized in terms of time, cost and quality, by Xu and Feng, with the use of hybrid algorithm [27]. Kulejewski and Rosłon reinforced the tabu search algorithm with artificial neural networks (ANN) to minimize the maximum monthly cash demand of apartment building construction [15]. Hegazy with other contributors minimized the total cost of multi-site [28] and repetitive projects [29]. Zhang et al. minimized duration for an example bridge project, their method was developed to facilitate repetitive project scheduling [30].

Methods of repetitive projects scheduling play important role in the current research regarding the construction project scheduling. Such projects can be easily partitioned into different units which can take a form of work zones, whole storys, building structures, or sections of construction objects characterized by the length (for example pipelines). Examples of the projects realized in a flow organization system include multi-story buildings, housing estates or groups of buildings, pipelines, and roads. Each unit of the project requires specialized work crews to perform assumed tasks. These work crews are moving from one unit to another [31]. A special case of repetitive projects is multi-unit projects, which include the implementation of residential, service, industrial or engineering constructions. In general, a feature of this type of project is the ability to set any order for the implementation of the works. Assuming any size of works that make up the implementation of a specific object in a multi-unit project, we get the opportunity to create the optimal schedule for the project. For n = 3 objects, optimization tasks in this problem are NP-hard. To describe and solve such problems, we can use the flow shop theory of scheduling [32]. Research on the problem of multi-unit projects scheduling is focusing mainly on the improvement of current optimization models and improvement of optimization methods [33,34,35,36,37]. In [33], the problem of scheduling with minimization of penalties for exceeding the project’s objects completion deadlines is considered and solved by the metaheuristic scatter search algorithm. In [34], the multi-unit project scheduling model takes into account the possibility of overlapping works in the facilities and is solved using the tabu search algorithm. The optimization criterion is the minimization of the project duration. In the article [35], the NP-difficult problem of scheduling a construction project was considered with the criterion of the sum of penalties for exceeding the deadline for building construction. The parameters of this project were represented by fuzzy numbers or random variables with a normal distribution or the Erlang distribution. In [36], a scheduling model was presented with the possibility of performing one type of work by more than one working group and with sequence relationships given by any graph. The optimization task in this model was solved using the tabu search algorithm. In [37], the scheduling model for a multi-unit project assumes a linear relationship between the time and the cost of carrying out the activity. The criterion of minimizing the total value of the project cost determined on the basis of the mathematical programming model, taking into account direct and indirect costs, costs of missing deadlines and costs of workgroup discontinuities. The optimization task in this model was solved using the modified simulated annealing algorithm.

3 Model of multi-unit project

The paper deals with the issue of construction project’s profit maximization. Using the terminology of the scheduling theory, this problem can be described as follows: a set of n indivisible tasks is given (in the case of this paper—construction objects) that must be performed with m machines (in this paper—teams of working groups). Each of the n construction objects requires m types of operations (in this paper—works) to be performed by m teams of working groups. Out of m teams of workgroups, only one workgroup must be selected to perform a given operation (work) in a given construction object.

It is assumed that the order of execution of construction objects for each of the teams of working groups is the same, i.e., it is a permutational problem. We also assume that each working group from among working group teams has a strictly defined duration t and cost c of the work. Between works on a given construction object, there may be technological breaks between works or there may be a partial overlap of works. Planning a schedule for carrying out such an undertaking, it is crucial to find its optimal schedule that takes into account the criterion adopted by the schedule planner (decision maker).

Finding the schedule of the project makes it possible to determine the order of execution of the objects and the set of choices for the methods of execution of works (the selection of working groups from teams of working groups). The criterion adopted in the project is the maximization of the total profit achieved in the project, more precisely the cumulative cash flow on the last day of the project implementation (an example of the cumulative cash flow chart, prepared in accordance with the principles set out in [37], is shown in Fig. 1—it takes into account the costs incurred during project’s implementation: direct costs of working groups, indirect costs, contractual penalties for exceeding the deadline for completing the construction, penalties related to breaks in the work of working groups, and loan costs).

Fig. 1
figure 1

Sample chart of cumulative cash flows in a construction project

The presented problem is a generalization of the classical permutational flow shop problem, which is shown schematically in Fig. 2. In the terminology of the scheduling theory, it is denoted as the F∣∣Cmax problem, according to Graham’s notation, presented in [39]. In Fig. 2, the variable S denotes the input sequence (permutation) of n tasks to the system of m machines. The cardinality of the set of possible solutions is n!.

Fig. 2
figure 2

Permutation flow shop system, where FIFO is the First In First Out

3.1 Optimization model

The optimization model of the above described problem is as follows:

Parameters:

  • The project consists of a set of building units

    $$ Z = \left\{ {Z_{{1}} ,Z_{{2}} ,Z_{{3}} , \ldots ,Z_{i} , \ldots ,Z_{n} } \right\}. $$
  • To carry out the project works the teams of working groups perform one job of one type which constitute the set

    $$ B = \left\{ {B_{{1}} ,B_{{2}} ,B_{{3}} , \ldots ,B_{j} , \ldots ,B_{m} } \right\}. $$
  • In each team of working groups Bj ∈ B, there are p working groups representing various subcontractors (modes with different capacities and configurations):

    $$ B_{j} = \left\{ {B_{j1} , \ldots , \, B_{jk} , \ldots , \, B_{jp} } \right\}, $$

    where k = 1 ... p.

  • Each object (unit) Zi ∈ Z requires implementation of m works which form the set

    $$ O_{i} = \left\{ {O_{i1} ,O_{i2} ,O_{i3} , \ldots ,O_{ij} , \ldots ,O_{im} } \right\}. $$
  • It is assumed that the work Oij ∈ Oi can be done by the working group Bjk ⊂ Bj. The duration of the work Oij performed by the group is tijk > 0. The set of possible durations of works from the set Oi performed by the working group Bjk defines vector

    $$ t_{i} = \left[ {t_{i1} ,t_{i2} ,t_{i3} , \ldots ,t_{ik} , \ldots ,t_{im} } \right], $$

    where tij = [tij1, …, tijk,…, tijp]. Duration of works tijk are determined on the basis of workload and workgroup size (number of workers) Bjk performing the work Oij.

  • Similarly as the above, it is assumed that the work Oij ∈ Oi can be implemented by the working group Bjk ⊂ Bj. The cost of realization of the work Oij by the working group Bjk defines a variable cijk ≥ 0. The set of possible costs of works cj from the set Oj is defined by the vector

    $$ c_{j} = \left[ {c_{j1} ,c_{j2} ,c_{j3} , \ldots ,c_{jk} , \ldots ,c_{jm} } \right], $$

    where cjk = [cij1,…,cijk,…, cijp].

    The cost of the work cijk is determined by calculation of the cost of execution of the work Oij by the working group Bjk located in the resources of the contractor. It may also be the cost offer of the execution of the work Oij made by the subcontractor represented by the working group Bjk. It is assumed that the time of execution of works tijk are convex, decreasing cost functions cijk.

  • There is the possibility of technological gaps between the works and the simultaneous operation of multiple working groups in the units assumed. Durations of intervals between a given work and the next work (sij ≥ 0) or the length of the simultaneous duration of a given work and the next work (sij < 0) in the unit for a set of works Oi are given in vector si = [si1, si2, si3,…,sik,…,sim]. These times should be understood as the minimum constraint and can take any value. In the further work, there will be called couplings between units.

Constraints:

  • The order of execution of the works resulting from work technology is assumed such that

    $$ O_{{i,j - 1{ }}} \prec { }O_{{i,j{ }}} \prec { }O_{i,j + 1} { }{\text{.}} $$
  • It is assumed that each working group from the team Bj can perform only one job at a time.

  • It is assumed that the work Oij ∈ Oi is performed continuously by the working group Bjk ⊂ Bj in time tijk > 0.

Decision variables are the order π of execution of units, which for each of the working group, is the same and takes the form of a permutation

$$ \pi = \left( {\pi \left( 1 \right), \, \pi \left( 2 \right), \, \pi \left( 3 \right), \ldots , \, \pi \left( j \right), \ldots , \, \pi \left( n \right)} \right) $$

and a set of numbers of ways of work execution (from k = 1 to k = p) in all units of the project is

$$ R = \left( {R_{1} ,R_{2} ,R_{3} , \ldots ,R_{i} , \ldots ,R_{n} } \right),R \in \Re , $$

where Ri = (Ri1, Ri2, Ri3,…, Rij,…, Rim), Rij is the number of ways of realization (from k = 1 to k = p) of the work j in unit i, and is the set of all possible ways to carry out the works in the project. The value of the number k of the way of realization Rij enables allocation of the working group Bjk from the team Bj to the work j in the object i. The form of decision variable R uniquely identifies the allocation of working groups to realization of works in the units. Therefore, using the decision variable R, there are uniquely established not only the durations of individual works carried out in the units but also their cost. After the adoption of the decision variable, R the durations of works tj from the set Oi is as follows:

$$ t_{i} = \left\{ {t_{i1} ,t_{i2} ,t_{i3} , \ldots ,t_{ij} , \ldots ,t_{im} } \right\}, $$

where tij is the duration of the execution of the work j in the object (unit) i. Similarly, in consequence of the adoption of the decision variable R, the set of costs ci of works from the set Oi is as follows:

$$ c_{i} = \left\{ {c_{i1} ,c_{i2} ,c_{i3} , \ldots ,c_{ij} , \ldots ,c_{im} } \right\}, $$

where cij is the cost of implementing work j in the unit i.

The deadlines for the individual works for the decision variables π and R can be determined from the recursive formula:

$$ F_{j,\pi \left( i \right)} = \max \left\{ {F_{{\pi \left( {i - 1} \right),j}} ,F_{\pi \left( i \right),j - 1} + s_{\pi \left( i \right),j - 1} } \right\} + t_{\pi \left( i \right),j} , $$
(1)

where i = 1, 2,…, n, j = 1, 2,…, m, π(0) = 0, F0,j = 0, Fi,0 = 0.

The duration of the entire project Fn,m (time execution of all works in the units) for π* ∈ П and for the decision variable R* ∈  is Fn,m(π*, R*) = Fπ*(n),m.

The deadlines for the performance of individual works and their cost can be found in time O(nm). The number of possible solutions to the presented model is np mn.

Objective function will be cumulated cash flow in the last billing period of the project which represents the total profit for the contractor. The cash flow will be maximized. Variables in the objective function are.

  • \(F_{i,j}\) is the finish time for works performed by a work crew j on unit i,

  • \(F_{n,m}\) is the finish time for construction works,

  • h is the billing period, \(h \in \left\{ {1, \ldots ,H} \right\}\), where H is the last billing period,

  • TI is the time interval (in days), which represents the duration of each billing period,

  • \(t_{i,j }\) is the duration of activities performed by a work crew j to finish all required works on unit i,

  • \(t_{i,j,h }\) is the duration of works performed by a work crew j on unit i during billing period h,

  • \(t^{W}_{j,h }\) is the discontinuity of work duration for a work crew j during billing period h,

  • \(t^{D}_{i}\) is the deadline for completion of works on unit i,

  • \(t^{D}_{i,h }\) is the delay for completion of works on unit i during billing period h,

  • \(c_{i,j }\) is the direct cost of activities performed by a work crew j to finish all required works on unit i,

  • \(c_{ }^{{{\text{Ind}}}}\) is the indirect unit cost per day,

  • α is the discount rate per time interval,

  • Pro is the profit as a percentage,

  • \({\text{Pen}}^{D}_{i}\) is the unit cost penalty for a delay of works on unit i,

  • \({\text{Pen}}^{W}_{j}\) is the unit cost penalty for a discontinuity (downtime) of a work crew j,

  • \({\text{Pen}}_{{{\text{CF}}}}\) is the penalty for negative cash flow as a percentage,

  • \(\phi_{h }\) is the binary variable for modeling negative cash flow penalties in billing period h,

  • \(d_{{\text{Inc }}}\) is the delay (in time intervals) for income accounting,

  • \(d_{{\text{Pen }}}\) is the delay (in time intervals) for penalties accounting,

  • \({\text{CF}}_{h} \) is the cumulated cash flow for billing period h,

  • \({\text{IC}}_{h}\) is the indirect costs in billing period h,

  • \({\text{DC}}_{h}\) is the direct costs in billing period h,

  • \({\text{PC}}_{h}\) is the production cost in billing period h,

  • \({\text{PV}}_{h}\) is the production value in billing period h,

  • \({\text{PD}}_{h}\) is the penalty for a delay of works in billing period h,

  • \({\text{PW}}_{h}\) is the penalty for a discontinuities (downtime) of a work crews in billing period h.

For such adopted parameters, constraints and variables, there is a mathematical programming model formulated, in the following form:

$$ {\text{CF}}_{{H + \max \left( {d_{{{\text{Inc}}}} ;d_{{{\text{Pen}}}} } \right)}} \to \max $$
(2)

s.t.:

$$ H = \frac{{F_{n,m} }}{{{\text{TI}}}} $$
(3)
$$ {\text{CF}}_{h} = \left( {{\text{CF}}_{h - 1} - {\text{PC}}_{h} + {\text{PV}}_{{h - d_{{{\text{Inc}}}} }} - {\text{PD}}_{{h - d_{{{\text{Pen}}}} }} - {\text{PW}}_{{h - d_{{{\text{Pen}}}} }} } \right) \phi_{h } $$
(4)
$$ \phi_{h } = \left\{ \begin{gathered} 1,\quad {\text{if}} \left( {{\text{CF}}_{h - 1} - {\text{PC}}_{h} + {\text{PV}}_{{h - d_{{{\text{Inc}}}} }} - {\text{PD}}_{{h - d_{{{\text{Pen}}}} }} - {\text{PW}}_{{h - d_{{{\text{Pen}}}} }} } \right) \ge 0 \hfill \\ \left( {1 + {\text{Pen}}_{{ - {\text{CF}}}} } \right),\quad {\text{ if}}\left( {{\text{CF}}_{h - 1} - {\text{PC}}_{h} + {\text{PV}}_{{h - d_{{{\text{Inc}}}} }} - {\text{PD}}_{{h - d_{{{\text{Pen}}}} }} - {\text{PW}}_{{h - d_{{{\text{Pen}}}} }} } \right) < 0 \hfill \\ \end{gathered} \right. $$
(5)
$$ {\text{PC}}_{h} = \frac{{{\text{IC}}_{h} + {\text{DC}}_{h} }}{{\left( {1 + \alpha } \right)^{h} }} $$
(6)
$$ {\text{IC}}_{h} = \left\{ {\begin{array}{*{20}c} {c_{ }^{{{\text{Ind}}}} {\text{TI}} , \quad {\text{if}} \, h < H} \\ {c_{ }^{{{\text{Ind}}}} \left( {F_{n,m} - {\text{TI}}\left( {h - 1} \right)} \right),\quad {\text{ if}} \, h = H} \\ \end{array} } \right. $$
(7)
$$ {\text{DC}}_{h } = \mathop \sum \limits_{i = 1}^{n} \mathop \sum \limits_{j = 1}^{m} \frac{{c_{i,j } }}{{t_{i,j,h } }} $$
(8)
$$ {\text{PV}}_{{h - d_{{{\text{Inc}}}} }} = \frac{{\left( {{\text{IC}}_{{h - d_{{{\text{Inc}}}} }} + {\text{DC}}_{{h - d_{{{\text{Inc}}}} }} } \right)\left( {1 + {\text{Pro}}} \right)}}{{\left( {1 + \alpha } \right)^{{h - d_{{{\text{Inc}}}} }} }} $$
(9)
$$ {\text{PD}}_{{h - d_{{{\text{Pen}}}} }} = \mathop \sum \limits_{i = 1}^{n} {\text{Pen}}^{D}_{i} { }t^{D}_{{i,h - d_{{{\text{Pen}}}} }} $$
(10)
$$ {\text{PW}}_{{h - d_{{{\text{Pen}}}} }} = \mathop \sum \limits_{j = 1}^{m} {\text{Pen}}^{W}_{j} { }t^{W}_{{j,h - d_{{{\text{Pen}}}} }} . $$
(11)

The objective function (2) maximizes cumulated cash flow in the last billing period of the project which represents the total profit (TP) for the contractor. The number of billing periods (3) is calculated on the base of the time interval and finish time for construction works. Equation (4) presents the iterative method for cumulated cash flow calculation in the following billing periods.

Negative cash flow results in a necessity for finding additional funds for the conduction of the project’s works. For contractors, this means taking interest-bearing loans or losing the option of investing their own funds (lost profits). Binary variable (5) is modeling this phenomenon by granting penalties in each billing period with negative cash flow.

Production cost (6) in each period is a discounted sum of indirect (7) and direct (8) costs in this period. Production value is invoiced after completion of a billing period and is received (income) by the contractor from the client with an agreed delay (\({d}_{\mathrm{Inc}})\). Production value is subject to discount. Penalties for a delay of works (10) and discontinuities of work crews (11) are also accounted with a delay. First types of penalties are specified in the contract between the investor and the general contractor and usually amount to between 0.05 and 0.2% of the gross contract value for each day of delay. Downtime penalties are related to the contractor’s need to keep the brigades ready for work at all times.

The described model can be represented in the form of a disjunctive graph G(π), an example of which, with highlighted critical path is shown in Fig. 3. The form of the graph is dependent upon an established decisive variable π: G(π) = (N, E(π)),where N is a set of nodes, E(π)—set of arcs. It is assumed that N = {1,.., i,…., n} {1,…, j,…, m} is a set of nodes representing works in units of project. Weight of node (i, j) is equal to the time of work execution tπ(i),j. The set of E(π) = EF ES(π) depends on the assumed decisive variable π. Horizontal arcs (sequential, representing processing order of units) from the set ES(π) are between nodes π(i-1) and π(i), where i = 1,…, n. Vertical arcs (technological) from the set EF are between node standing for work j and j-1. The weight of the vertical arc from set EF is the coupling between units sπ(i),j.

Fig. 3
figure 3

The graph for the described model of the project with the marked critical path

The above presented model is NP-hard optimization problem, because of assumptions from permutation flow shop problem (problem F∣∣Cmax), which is strongly NP-hard. To solve the optimization task, there is individual algorithm proposed. This algorithm will use approximate metaheuristic simulated annealing algorithm or genetic search algorithm.

4 Optimization methods for the presented multi-unit model

The optimization model for the multi-unit project presented above is an NP-hard problem of discrete optimization. There are two different decision variables affecting the value of the objective function. This causes the need to construct an effective individual algorithm for solving discrete optimization tasks in the presented problem. The first decision variable is the order of execution of the project objects (units), which is represented by permutation of the execution of the objects π. This decision variable is discrete, and the issue of searching for the optimal order of execution of the units is NP-hard. Due to the small number of units (most often the maximum number of objects is a dozen or so) that make up the multi-unit project, it is proposed to use the simulated annealing algorithm to solve the sequencing optimization task.

The second decision variable is a set of numbers presenting modes of performing works by available contractors. This decision variable generates a much larger area of possible solutions depending on the number of objects, types of works and the number of modes of performing works for each element of a given unit. Therefore, in this article, it is proposed that this decision variable will be solved using a suitably adapted simulated annealing algorithm or genetic search algorithm.

The method of solving the discrete optimization task for the model of a multi-unit project presented in chapter 3, taking into account both different decision variables, is presented in the form of block diagrams in Figs. 4 and 5. Its steps are consistent with SA algorithm presented in chapter 4.1. When calculating the adopted objective function for a given order π, the problem of profit maximization is solved suboptimally, in accordance with the relationships presented in chapter 3, using the simulated annealing algorithm or the genetic search algorithm.

Fig. 4
figure 4

SA + SA algorithm block diagram

Fig. 5
figure 5

SA + GS algorithm block diagram

4.1 Simulated annealing algorithm

Simulated annealing (SA) algorithm has been proposed in the work of Kirkpatrick [40]. This algorithm uses analogous to the thermodynamic process of cooling the solid to introduce the trajectory of the search of the local extremum. States of solid matter are seen analogously as individual solution to the problem, whereas the energy of the body as the value of the objective function. During the physical process of cooling, the temperature is reduced slowly to maintain energy balance. The SA algorithm starts with the initial solution (usually chosen at random). Then, in each iteration, according to established rules or randomly, there is solution π’ selected from the base neighborhood π. It becomes the base solution in the next iteration, if the value of the objective function is better than the current base solution or if it otherwise may become the base solution with the probability of

$$ p = {\text{ exp}}( - D/T_{i} ), $$

where π = c(π) – c(π´), Ti is the temperature of the current iteration i, c is the objective function. In each iteration, there are m draws from the neighborhood of the current basic solution performed. The parameter called the temperature decreases in the same way as in the natural process of annealing. The most frequently adopted patterns of cooling are geometrical or logarithmic ones. Below is the general algorithm of the SA method used to solve flow problems, which will be used to solve the problem under consideration.

figure a

SA algorithms are used to solve many optimization problems, including flow shop problems which are considered in the context of discrete optimization problems.

4.2 Genetic search algorithm

Genetic search algorithms (GS) use the principles of evolution in nature, which lead to the best adaptation (optimization) of individuals to the conditions found in a given environment. GS algorithm concept was presented in [41, 42]. They use a population of individuals (solutions), which are then processed during the selection, actions induced by the use of genetic operators, and the survival phase. The population in GS algorithms is a set of individuals representing solutions. Each solution is coded by a set of attributes stored in the genetic material (chromosomes, genes). There are many coding methods specific for various optimization problems, e.g., for flow shop problems, subsequent solutions are coded in the chromosome directly using permutation [43]. The population is processed by means of cyclically consecutive processes: reproduction, crossing, and mutation as well as survival or selection. In the reproduction phase, individuals are reproduced in proportion to the measure of adaptation to the environment. The adaptation function, which is a measure of adaptation, can be, e.g., the value of the objective function for a given solution. This process means that individuals with better adaptation will have more descendants in the next generations. Individuals selected from the population form the so-called parental pool from which the pairs are selected (so-called parents) providing individuals of a new generation. They are created using the genetic crossing operator. Then, the mutation process is carried out causing changes in the genetic material, which usually occur with a low probability allowing for the slow introduction of innovation in a generation. In the survival (selection) phase, individuals are selected that will form part of the new population.

Selection can be carried out, e.g., in accordance with the roulette principle (rank selection), in which better chances are given to better-adapted individuals or on a tournament basis. The conditions for stopping the algorithm can be: time limit, the maximum number of iterations, achieving a satisfactory value of the objective function, or the optimal value. The GS method contains many elements that can be freely defined: chromosome coding method, crossover and mutation operators, adaptation function, parent pool selection, and parent matching scheme, survival scheme. The following is the general algorithm for the GS method:

figure b

GS algorithms are currently successfully used to solve a number of optimization problems, including those related to the theory of task scheduling [43]. The GS method has imperfections that can manifest, mainly early convergence to the local extreme or poor convergence to optimal solutions or close to them. However, it behaves quite well for examples of small sizes, such as the model presented in the article.

4.3 The SA + SA form of solving the problem according to the presented model

The method of solving the optimization task in the presented model is consistent with the SA algorithm steps. When searching the set of possible sequencing (permutations) of object execution (the first decision variable), the following assumptions were made regarding its parameters:

  • the \(N\left( \pi \right)\) environment contains permutations generated from π using the “replace” motion,

  • Boltzmann acceptance function was used,

  • the geometric cooling scheme was adopted, i.e., \(T_{i + 1} = { }\lambda T_{i}\) and the initial temperature \(T_{0} = 60\), \(\lambda = 0.7\), the number of solutions considered at the set temperature: 2, the minimum temperature \(T_{\min } = 0.01\).

While calculating the value of the objective function, for a given permutation π, the task of optimizing profit maximization is solved, taking into account the second decision variable, i.e., a set of numbers presenting ways of performing works (modes). For this stage, the following assumptions were made regarding the parameters of the SA algorithm used in it:

  • the neighborhood of a given set of numbers presenting the ways of performing works contains sets generated from the output set by means of the “change to another random” movement,

  • Boltzmann acceptance function was used,

  • the geometric cooling scheme was adopted, i.e., \(T_{i + 1} = { }\lambda T_{i}\) and the initial temperature \(T_{0} = 60\), \(\lambda = 0.99\), the number of solutions considered at the set temperature: 6, the mum temperature \(T_{{{\text{min}}}} = 0.01\).

The presented approach using the SA algorithm for both decision variables will be referred to as the SA + SA algorithm in the following part of the article and is presented in the form of a block diagram in Fig. 4. The SA + SA algorithm has been implemented in the Python programming language.

4.4 The SA + GS form of solving the problem according to the presented model

Similarly to the SA + SA algorithm, the method of solving the optimization task in the presented model is consistent with the SA algorithm steps. While searching the set of possible ordering (permutations) of object execution (the first decision variable), assumptions regarding its parameters were made the same as in the SA + SA algorithm presented in chapter 4.3.

In contrast to the SA + SA algorithm, the GS algorithm was used only when calculating the value of the objective function, when for a given permutation π, the task of optimizing profit maximization is solved taking into account the second decision variable, i.e., a set of numbers presenting the ways (modes) of performing works. For the first decision variable, i.e., the order of execution of the units (objects), it is assumed that the SA algorithm will still be used. Further in the article, the algorithm name SA + GS will be used for this combination of algorithms. The following assumptions were made regarding the form and parameters of the GS algorithm in the SA + GS algorithm:

  • a randomly created population consists of individuals—sets of numbers representing methods of works implementation R, its size is equal to 90,

  • selection—parents are selected using tournament selection, 40% of individuals are selected,

  • crossing—the single point crossing operator was used, parents are chosen randomly,

  • mutation is implemented on individuals of the generation by means of the “change by 1” motion applied to a randomly selected individual from the generation, part of the population is subject to mutation: 5%, probability of mutation: 0.01.

  • the maximum number of iterations of the GS algorithm is 90.

The SA + GS algorithm has also been implemented in the Python programming language and is presented in the form of a block diagram in Fig. 5.

5 Verification of the results

The authors verified the results obtained with the methods presented above. For this purpose, three groups of examples of objects were generated randomly: n = 6 units with m = 2 works, n = 5 units with m = 3 works, and n = 4 units with m = 4 works. Such sizes are characteristic for small problems in the practice of multi-unit construction projects. There were five examples generated in each group. In each of the examples, a maximum value of the total profit of a given project was sought in accordance with the presented model. Each of the studied examples was resolved five times. The results obtained with the help of the original software are presented in Table 1. Then, the three groups of analyzed examples were solved optimally by means of the exhaustive search (ES) algorithm. The obtained results were compared with each other by calculating the percentage relative difference PRD(SA + SA) of the SA + SA algorithm and PRD(SA + GS) of the SA + GS algorithms:

$$ {\text{PRD}}\left( {{\text{SA}} + {\text{SA}}} \right) = 100\% \frac{{K^{{{\text{ES}}}} - K^{{{\text{SA}} + {\text{SA}}}} }}{{K^{{{\text{ES}}}} }} $$
(12)
$$ {\text{PRD}}\left( {{\text{SA}} + {\text{GS}}} \right) = 100\% \frac{{K^{{{\text{ES}}}} - K^{{{\text{SA}} + {\text{GS}}}} }}{{K^{{{\text{ES}}}} }}, $$
(13)

where \(K^{{{\text{SA}} + {\text{SA}}}}\) is the value of the adopted objective function obtained by means of the SA + SA algorithm, \(K^{{{\text{SA}} + {\text{GS}}}}\) is the value of the adopted objective function obtained by means of the SA + GS algorithm, and \(K^{{{\text{ES}}}}\) is the value of the assumed objective function obtained by means of an exhaustive search algorithm.

Table 1 Outcomes of the verification of the results for small examples obtained with the use of the SA + SA and SA + GS algorithms

The average PRD of the applied algorithms are presented in Table 1. The values of these differences are quite small, which confirms the high effectiveness of the algorithms in searching for optimal solutions in the subject. However, the results obtained by the SA + GS algorithm for small examples were slightly better with a average PRD difference of 0.452.

Additional tests were conducted for the bigger examples with n = 10, 15, 20, and m = 3, 5, 7. There were five examples generated for each size. Each of the studied examples was resolved five times. The number of examples for each of the considered sizes (in total 60 examples for all sizes) and the number of attempts to solve them is sufficient to compile statistical data, and draw conclusions about the quality of the results achieved by the tested algorithms. The average results obtained with the help of the created software are presented in Table 2. These examples were too big to be calculated by ES algorithm in a reasonable time, so the results obtained by SA + SA and SA + GS algorithms were tested using random search algorithm (RS algorithm) [44]. PRD(SA + SA) of the SA + SA algorithm and PRD(SA + GS) of the SA + GS algorithms were calculated as follows:

$$ {\text{PRD}}\left( {{\text{SA}} + {\text{SA}}} \right) = 100\% \frac{{K^{{{\text{RS}}}} - K^{{{\text{SA}} + {\text{SA}}}} }}{{K^{{{\text{RS}}}} }} $$
(14)
$$ {\text{PRD}}\left( {{\text{SA}} + {\text{GS}}} \right) = 100\% \frac{{K^{{{\text{RS}}}} - K^{{{\text{SA}} + {\text{GS}}}} }}{{K^{{{\text{RS}}}} }}, $$
(15)

where \(K^{{{\text{RS}}}}\) is the value of the adopted objective function obtained by means of the RS algorithm.

Table 2 Average outcomes of the verification of the results for examples n = 10, 15, 20 obtained with the use of the SA + SA and SA + GS algorithms

The average percentage relative differences of the applied algorithms for bigger examples are presented in Table 2. In the conducted experiments, for sizes, n = 10, 15, 20, and m = 3, 5, 7 the results of the SA + GS algorithm were always better (average PRD of − 8.02%) than the results of the SA + SA algorithm (average PRD of − 1.46%). That is why SA + GS algorithm was selected for the analysis of real-life problem instances. The results of the SA + GS and SA + SA algorithms were always better than the results of the RS algorithm.

6 Case study

The contractor, at the request of the investor, is to carry out a project consisting in the construction of n = 5 residential buildings (units). Each of them requires execution of m = 5 works carried out in a fixed order. Technological and organizational limitation ensures that a work cannot start if the work of the same type in the previous building did not end and if the previous work in the same building was not completed. The project will be implemented in full by the subcontractors. The contractor received numerous bids from the subcontractors which results in a possibility of executing each type of work in one of the three different variants (modes). Each mode has a fixed execution time of a given type of work (expressed in working days) and implementation cost (expressed in EUR). Execution modes are presented in Table 3.

Table 3 Modes of the works execution in n = 5 buildings for m = 5 works including the duration of the works and their cost

The calculation example was created on the basis of a model residential building (determined on the basis of the price catalogue), for which the duration of works and their direct costs were determined. On the basis of these data, the authors generated: the duration of works, and the direct cost of the object, the so-called medium building. The time and direct cost of each job were modified by a random number from − 30 to 30%. The remaining objects were generated on the basis of the so-called medium building using the uniform distribution. When creating the data on the time and cost of works, the principle was followed that any reduction in the duration of an activity resulted in an increase in its cost. The example was generated using randomness due to the inability to obtain real data for such an undertaking with sizes n = 5 objects and m = 5 works. For computation purposes, the authors used: Intel Core i5-4440, 4 GB RAM, OS Windows 10, Python 3.6 (with the uniform distribution based on numpy.random.randint function).

Between the works realized in the technological order, there are couplings between units that have been established on the basis of existing technological constraints which are shown in Table 4.

Table 4 Couplings between units s occurring between the works j and j + 1 for n = 5 units

The duration of a billing period is equal to 20 working days which corresponds with one working month. This duration is set in accordance with construction practice in which works are invoiced on a monthly basis. Negative monthly cash flows force the contractor to take loans at 9% per annum (paid off every month). The indirect costs incurred by the contractor (related to running and supervising the construction) are estimated to be 730 € for each day of the project implementation. The production value is subject to discount each month at the level of 8% per annum. The contractor assumed profit at the level of 12%.

The contractor has a deadline for the implementation of individual buildings imposed by the investor. The directive deadlines are 150, 210, 270, 350, and 380 (in working days) for subsequent units (objects). For failure to meet deadlines, penalties are imposed for the general contractor for each day of delay. For each building, the penalties are respectively: 540, 490, 580, 590, and 570 €. The penalties for discontinuities of work crews have been determined with subcontractors and amount respectively for each type of work (j from 1 to 5) to 200, 200, 100, 0, and 300 € for each day of stoppage. Payment and penalties delays are both equal to 20 business days.

The number of possible solutions for this problem instance is 5!×3 5×5 ≈ 1.02 ×1014. The optimization goal for the contractor is to maximize the total profit—TP (cumulated cash flow for the last month of the project). For the initial schedule of π0 = (1,2,3,4,5) and assumed times and costs of execution of all works in mode 2. Total profit of 143.87 thousand of euro was obtained. The duration of the entire project is at the level of 351 days. However, not all the deadlines for units were met and some downtime penalties were charged. The schedule for the initial π0 = (1,2,3,4,5) rank without optimization is shown in Fig. 6a. The cumulated cash flow for this schedule is presented in Fig. 7a.

Fig. 6
figure 6

a Schedule for the implementation of project in the case study for π0. b Schedule for the implementation of project in the case study for πSA+GS with optimization using SA + GS algorithm

Fig. 7
figure 7

a Cumulated cash flows for the implementation of project in the case study for π0. b Cumulated cash flows for the implementation of project in the case study for πSA+GS with optimization using SA + GS algorithm

The next step in the search for an optimal solution was the use of the SA + GS algorithm to find the optimal schedule of the project that maximizes the assumed goal function, taking into account the possible changes in the order of construction objects execution, and selected execution modes. The algorithm performed 51 iterations according to the parameters described in Sect. 3.

The biggest TP calculated for the project is 204.58 thousand Euro obtained for the following scheduling of units: πSA+GS = (2,3,5,1,4). The selected execution modes are presented in Table 5. The deadline for the project implementation was 283 days. In relation to the initial schedule π0, the total profit was improved by 42% (60.71 thousand Euro) and the deadline for implementation was improved by 19% (68 days). The obtained schedule is shown in Fig. 6b. The cumulated cash flow for this schedule is presented in Fig. 7b.

Table 5 Best execution modes for πSA+GS = (2, 3, 5, 1, 4) with optimization using SA + GS algorithm

7 Summary and conclusions

Scheduling of multi-unit construction projects, which is a case of repetitive projects, is a problem in which discrete optimization tasks often occur. These problems are usually NP-hard due to the fact that they may be qualified as the permutation flow shop problems. In the presented model application of the additional parameter namely, the selection of the works’ execution mode resulted in a significant increase in the number of possible solutions. Consequently, the analyzed discrete optimization problem had two different decision variables. The developed model considered monthly cash flows subject to direct and indirect costs, penalties for missing deadlines, costs of work group discontinuities, and borrowing losses. The latter factor is often overlooked in research. Meanwhile, it can have a significant impact on the outcome of projects. Especially in construction projects in which payment delays and contractual penalties occur (both aspects were included in the model).

Two approaches were tested to solve the problem, a combination of two SA algorithms, and SA algorithm supported by GS algorithm. The results obtained using the second combination were slightly better than results obtained using only SA algorithms. Due to the lack of research in the literature regarding the applied form of the algorithms, the article presents verification of the results provided with its use. It showed its high effectiveness in searching for optimal solutions in the model in question.

The presented model of multi-unit construction project scheduling can be used when determining the optimal work schedule for construction companies using the flow organization system of work. It can be used in the situation when companies use their own working crews to implement the works or intend to select specialized subcontractors who best meet the imposed conditions. The developed model can be easily implemented in scheduling programs and can support the planner when designing multi-unit construction projects, helping to maximize the profit of the planned undertaking. Due to the development of dedicated software for solving optimization tasks, it is possible to extend the current model with additional technological and organizational constraints, additional factors affecting the cost of the project and taking into account other objective functions.