## 3 Proposed Work Methodology
### Methods of Optimization
#### 3.4.1 Optimization Problem with Resource Constraints  
Our method addresses the challenges due to restricted resources by adjusting the scheduling of noncritical activities within their allowable windows. The pseudocode below illustrates the programming logic used to solve this optimization problem.  
Initialize the following parameters:  
* Define project activities, duration, cost, and resources.
* Set constraints: resource limits, project deadline, precedence relationships.
* Initialize penalty factor \(\delta\) and fitness value.
* Define the following objective functions:
* Minimize project duration: T = sum (X_jm \(*\) T_jm) for all j in CA.
* Minimize project cost: C = sum ([AC_R \(*\) sum(I_tr) \(+\) RC_r \(*\) sum(D_tr)] \(+\) sum (X_jm \(*\) C_jm) \(+\) IC \(*\) T \(+\) (T\(-\)G) \(*\) P) Check the following constraints:
* Duration constraint: ensure noncritical activity durations match execution mode.
* Network constraint: maintain precedence relations among activities.
* Resource constraint: ensure total resource demand does not exceed available resources. Apply penalty function.
* Compute penalty = \(\delta\)(C_max) \(*\) max ((max_daily consumption/resource level)\(-\)1, 0)
* Adjust fitness value: fitness = C_max + penalty. Generate initial schedule.
* Assign execution modes to each activity.
* Compute earliest start and finish times for all activities.
* Optimization loop.
* Evaluate schedule feasibility.
* Adjust noncritical activities within floating periods to balance resource demands.
* If infeasible, increase penalty \(\delta\).
* If feasible, update the best solution. Decision support.
* Compute weighted sum for Pareto-optimal solutions.
* Select optimal solution using normalized objective functions. Output final optimized schedule and cost.  
When the resource demand exceeds availability, noncrucial activities are redistributed inside their floating intervals to balance the resource allocation. The steps for generating an optimal project schedule and cost estimation using optimization techniques are presented in the flowchart shown in Figure 5.  
Additionally, a penalty function is used to deal with instances where resource demand surpasses availability. Several penalty functions are proposed in the literature, with one of the most useful being the death penalty, which, without delay, removes any infeasible answer. The penalty function we implemented is mathematically defined using Equation (1).  
\[Penalty=\delta(C_{max}).\;max\;(\frac{max.\;daily\;consumption}{ resource\;level}-1.0) \tag{1}\]  
where \(\delta\) represents the fitness factor of the modern solution, which is more than one; C\({}_{\max}\) denotes fitness value of the current solution before the penalty is applied. Consequently, Equation (2) offers the correct definition of the fitness function for infeasible solutions.  
\[\text{Fitness value}=\text{C}_{\text{max}}\;+\;\text{penalty} \tag{2}\]  
Increasing the penalty fee \(\delta\) effectively transforms the penalty into a \"death penalty\", thereby preventing the current solution from advancing to the next era. Conversely, decreasing \(\delta\) leads to the current solution advancing to the next era. Thus, it is critical to find a balance: the goal is to dispose of infeasible solutions to achieve the optimal solution while preventing stagnation in local optima through maintaining variability. A penalty cost of 0 suggests that the current answer is possible.