Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Efficient Energy Plan Selection in Texas: A Data-Backed Approach with MOGAs, Study Guides, Projects, Research of Optimization Techniques in Engineering

Abstract— The complexity of energy plans can pose a challenging dilemma for a significant number of consumers, given the various service hours and accompanying terms, including potential charges for cancellation. This project focuses on optimizing energy plan selection using a genetic algorithm approach. The objective is to identify the most cost-effective energy plan from a set of ten predefined options based on hourly energy usage data spanning from 2002 to 2022. The algorithm seeks to minimize cost, maximize renewable energy utilization, and consider cancellation fees as significant factors in the decision- making process. The genetic algorithm operates by evaluating plan parameters, including cost and cancellation fee, and adjusting them iteratively to ascertain the most optimal energy plan. The fitness function normalizes these parameters based on hypothetical minimum and maximum values, assigning weighted importance to each criterion.

Typology: Study Guides, Projects, Research

2022/2023

Uploaded on 12/04/2023

musa-ibne-mannan-imon
musa-ibne-mannan-imon 🇺🇸

1 document

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
XX
Efficient Energy Plan Selection in Texas: A Data-
Backed Approach with MOGAs
Al-Mustasin Hossain, Shanae Edwards, Musa Ibne Mannan, Graduate Students, UTD
Abstract The complexity of energy plans can pose a
challenging dilemma for a significant number of consumers, given
the various service hours and accompanying terms, including
potential charges for cancellation. This project focuses on
optimizing energy plan selection using a genetic algor ithm
approach. The objective is to identify the most cost-effective
energy plan from a set of ten predefined options based on hourly
energy usage data spanning from 2002 to 2022. The a lgorithm
seeks to minimize cost, m aximize renewable energy utilization, and
consider cancellation fees as sig nificant factors in the decision-
making process. The genetic algorithm operates by evaluating
plan parameters, including cost and cancellation fee, and
adjusting them iteratively to a scertain the most optimal energy
plan. The fitness function normalizes these parameters based on
hypothetical minimum and maximum values, assigning weighted
importance to each criterion. Through this iterative process, the
algorithm identifies the plan that bes t satisfies the weighted
combination of cost, cancellation fee, and renewa ble energy
objectives. This approach provides a robust methodology for
optimizing energy plan selection bas ed on historical energy usage
data and predefined plan parameters. The abstracted results and
evaluations demonstrate the effectiveness of the genetic algorithm
in determining the most suitable energy plan from the provided
options. This method considers both the temporal consumption
trends and financial limitations within the energy market in Texas.
Index Terms Genetic Algorithms, Energy Plan Optimization,
Cost-Effective Plan Selection, Renewable Energy Utilization,
Cancellation Fees, Decision-Making Factors, Data-Backed
Approach.
I. INTRODUCTION
enetic Algorithms (GAs) are used in optimization to
address complex problems like those in modern power
systems. This technique provides global optimization
for various functions by using a search procedure through a
parameter space incorporating stochasticity to guide the search.
GAs mimic natural selection and Darwin’s theory of evolution
in that they produce the best points in each generation toward
the best solution. The algorithm functions by generating an
initial population, creating other generations, plotting their
This paragraph of the first footnote will contain the date on which you
submitted your paper for review, which is populated by IEEE. It is IEEE style
to dis play support information, including sponsor and financial support
acknowledgment, here and not in an acknowledgment section at the end of the
article. For example, “This work was supported in part by the U.S. Department
of Commerce under Grant 123456.” The name of the corresponding author
appears after the financial information, e.g. (Corresponding author: Second B.
Author). Here you may also indicate if a uthors contributed equally or if there
are co-first authors.
Al-Mustasin Hossain is currently a PhD student in the Mechanical
Engineering Department at the University of Texas at Dallas, Dallas, TX 75235
USA. He completed his master’s in mechanical engineering at Washington
progress, and determining stopping conditions. The next
population relies on computations involving random number
generators which encourages a more exploratory search. This
technique is the best choice for the optimization of power
systems as they have a frequent change and GAs are stable in
application although they are slow. Typically, the design
challenges pertaining to power distribution systems are
addressed by the application of classical optimization
techniques. In this context, the fundamental problem at hand
often revolves around the minimization of an objective
function. The objective function often represents the overall
expenses associated with the expansion of the global power
system, including addressing sizing and location issues within
the distribution system. Genetic Algorithms are commonly
recognized as efficient optimizers and have successfully
addressed industrial optimization challenges in recent times,
yielding favorable outcomes. Genetic Algorithms (GAs) have
been utilized in the design of street lighting networks through
the utilization of binary codification. However, this approach
has encountered difficulties in incorporating some elements of
mathematical models. The utilization of binary codification has
been employed in the context of a genetic algorithm in order to
identify optimal solutions for the construction of distribution
networks [1].
In modern power systems, the main goal of distribution
companies is to minimize operation and maintenance costs.
These companies also aim to manage the uncertainties from
Distributed Generation resources. GAs offers a solution to the
fluctuating energy output from DG resources that poses
challenges for balancing production and consumption, leading
to outages [2].
One approach to solving this issue is placing DG resources
alongside sensitive loads to reduce the risk of inadequate
supply. Leveraging load response programs and consumer
participation through network intelligence can decrease peak
loads avoiding the pollution from energy production. This
approach aligns with the goals of distribution companies to
optimize system efficiency and reliability in the evolving
competitive electricity market [3].
State University Vancouver and undergraduate studies at Mechanical
Engineering at Bangladesh University of Engineering and Technology (BUET),
and joined the PhD program. Email: Al-Mustasin.Hossain@UTDallas.edu.
Shanae Edwards is a PhD student in the Mechanical Engineering
Department at the University of Texas at Dallas, Dallas, TX 75235 USA. She
earned her bachelor's degree from [XX], XX, and has been pursuing her
doctoral studies since []. Email: shanae.edwards@utdallas.edu.
Musa Ibne Mannan is a PhD student in the Mechanical Engineering
Department at the University of Texas at Dallas, Dallas, TX 75235 USA. Musa
completed his master’s in mechanical and manufacturing at Texas State
University, San Marcos, Texas 78666, and be gan his PhD journey in 2023.
Email: musa314@utdallas.edu.
G
pf3
pf4
pf5
pf8

Partial preview of the text

Download Efficient Energy Plan Selection in Texas: A Data-Backed Approach with MOGAs and more Study Guides, Projects, Research Optimization Techniques in Engineering in PDF only on Docsity!

XX

Efficient Energy Plan Selection in Texas: A Data-

Backed Approach with MOGAs

Al-Mustasin Hossain, Shanae Edwards, Musa Ibne Mannan, Graduate Students, UTD

Abstract — The complexity of energy plans can pose a challenging dilemma for a significant number of consumers, given the various service hours and accompanying terms, including potential charges for cancellation. This project focuses on optimizing energy plan selection using a genetic algorithm approach. The objective is to identify the most cost-effective energy plan from a set of ten predefined options based on hourly energy usage data spanning from 2002 to 2022. The algorithm seeks to minimize cost, maximize renewable energy utilization, and consider cancellation fees as significant factors in the decision- making process. The genetic algorithm operates by evaluating plan parameters, including cost and cancellation fee, and adjusting them iteratively to ascertain the most optimal energy plan. The fitness function normalizes these parameters based on hypothetical minimum and maximum values, assigning weighted importance to each criterion. Through this iterative process, the algorithm identifies the plan that best satisfies the weighted combination of cost, cancellation fee, and renewable energy objectives. This approach provides a robust methodology for optimizing energy plan selection based on historical energy usage data and predefined plan parameters. The abstracted results and evaluations demonstrate the effectiveness of the genetic algorithm in determining the most suitable energy plan from the provided options. This method considers both the temporal consumption trends and financial limitations within the energy market in Texas. Index Terms — Genetic Algorithms, Energy Plan Optimization, Cost-Effective Plan Selection, Renewable Energy Utilization, Cancellation Fees, Decision-Making Factors, Data-Backed Approach. I. INTRODUCTION enetic Algorithms (GAs) are used in optimization to address complex problems like those in modern power systems. This technique provides global optimization for various functions by using a search procedure through a parameter space incorporating stochasticity to guide the search. GAs mimic natural selection and Darwin’s theory of evolution in that they produce the best points in each generation toward the best solution. The algorithm functions by generating an initial population, creating other generations, plotting their This paragraph of the first footnote will contain the date on which you submitted your paper for review, which is populated by IEEE. It is IEEE style to display support information, including sponsor and financial support acknowledgment, here and not in an acknowledgment section at the end of the article. For example, “This work was supported in part by the U.S. Department of Commerce under Grant 123456.” The name of the corresponding author appears after the financial information, e.g. (Corresponding author: Second B. Author). Here you may also indicate if authors contributed equally or if there are co-first authors. Al-Mustasin Hossain is currently a PhD student in the Mechanical Engineering Department at the University of Texas at Dallas, Dallas, TX 75235 USA. He completed his master’s in mechanical engineering at Washington progress, and determining stopping conditions. The next population relies on computations involving random number generators which encourages a more exploratory search. This technique is the best choice for the optimization of power systems as they have a frequent change and GAs are stable in application although they are slow. Typically, the design challenges pertaining to power distribution systems are addressed by the application of classical optimization techniques. In this context, the fundamental problem at hand often revolves around the minimization of an objective function. The objective function often represents the overall expenses associated with the expansion of the global power system, including addressing sizing and location issues within the distribution system. Genetic Algorithms are commonly recognized as efficient optimizers and have successfully addressed industrial optimization challenges in recent times, yielding favorable outcomes. Genetic Algorithms (GAs) have been utilized in the design of street lighting networks through the utilization of binary codification. However, this approach has encountered difficulties in incorporating some elements of mathematical models. The utilization of binary codification has been employed in the context of a genetic algorithm in order to identify optimal solutions for the construction of distribution networks [1]. In modern power systems, the main goal of distribution companies is to minimize operation and maintenance costs. These companies also aim to manage the uncertainties from Distributed Generation resources. GAs offers a solution to the fluctuating energy output from DG resources that poses challenges for balancing production and consumption, leading to outages [2]. One approach to solving this issue is placing DG resources alongside sensitive loads to reduce the risk of inadequate supply. Leveraging load response programs and consumer participation through network intelligence can decrease peak loads avoiding the pollution from energy production. This approach aligns with the goals of distribution companies to optimize system efficiency and reliability in the evolving competitive electricity market [3]. State University Vancouver and undergraduate studies at Mechanical Engineering at Bangladesh University of Engineering and Technology (BUET), and joined the PhD program. Email: Al-Mustasin.Hossain@UTDallas.edu. Shanae Edwards is a PhD student in the Mechanical Engineering Department at the University of Texas at Dallas, Dallas, TX 75235 USA. She earned her bachelor's degree from [XX], XX, and has been pursuing her doctoral studies since []. Email: shanae.edwards@utdallas.edu. Musa Ibne Mannan is a PhD student in the Mechanical Engineering Department at the University of Texas at Dallas, Dallas, TX 75235 USA. Musa completed his master’s in mechanical and manufacturing at Texas State University, San Marcos, Texas 78666, and began his PhD journey in 2023. Email: musa 314 @utdallas.edu.

G

XX

Genetic algorithms (GA) are frequently employed as a means to address intricate optimization issues that are challenging to resolve through conventional methodologies. Within the realm of energy management, Genetic Algorithms (GAs) provide the capability to effectively optimize the dimensions and functioning of hybrid renewable energy systems (HRESs). Hybrid renewable energy systems (HRESs) encompass the integration of several renewable energy sources, including solar and wind power, alongside energy storage technologies. This integration aims to establish a dependable and environmentally sustainable electricity supply. The utilization of Genetic Algorithms (GAs) in optimizing Hybrid Renewable Energy Systems (HRES) has the potential to enhance the system's overall efficiency and cost-effectiveness [4]. Arabali et al described a GA-based optimization approach for HRESs that uses historical hourly wind speed, solar irradiance, and load data to stochastically model the uncertainty of wind and PV generation and load. This approach is based on the concept of probabilistic constraints, which allow the GA to consider the probability of violating constraints when making optimization decisions. The authors also propose a two-point estimation (2PE) method to estimate the expected value and standard deviation of the output variables. This study has the assumption that the output variables can be approximated by a linear function of the input variables. A substantial population size is chosen to enhance the likelihood of converging towards the global minimum, but at the expense of a notable increase in computing workload. To preserve favorable outcomes, a pair of exceptional offspring are selected and preserved in each successive generation. The implementation of the Genetic Algorithm (GA) utilizes a double vector form instead of a binary representation in order to ensure coherence in the process of mutation. The optimal balance between crossover and mutation offspring is maintained by fine-tuning the crossover rate to approximately 78%. To guarantee the fulfillment of constraints, a solution that violates a constraint is allocated a substantial penalty factor. The authors evaluate their approach using a case study of a HRES in Nevada. They find that their approach can significantly improve the performance of the HRES compared to a traditional optimization approach that does not consider the uncertainty of the input variables [4]. In their publication titled "Cost-effective allocation of watershed management practices using a genetic algorithm," Arabi et al. introduce an innovative optimization approach to develop comprehensive sediment and nutrient control strategies at the watershed level. This methodology effectively integrates several objectives, which frequently exhibit contradictory characteristics. The approach integrates the utilization of a watershed model known as SWAT, the incorporation of best management practices (BMPs), an economic element, and a spatial search strategy based on a genetic algorithm [3]. The optimization model utilized in this research comprises the SWAT model, which is employed for modeling pollution loads, a tool for representing Best Management Practices (BMPs), an economic component, and a geographic optimization technique based on Genetic Algorithms (GAs). A MATLAB computer program was created to establish the connection between different components of the model. The study involved the evaluation of the model's effectiveness in optimizing the placement of field boundaries, parallel terraces, grassed rivers, and grade stabilization structures within the Dreisbach and Smith Fry watersheds. The results of the study indicate that the optimization methodology is capable of identifying cost- effective BMP placement strategies that achieve multiple objectives. For example, in the Dreisbach watershed, the optimization model identified a plan that reduced sediment loads by 50% and phosphorus loads by 40%, while reducing costs by 20% compared to a non-optimized plan. The GA was able to efficiently search a large number of potential solutions and identify near-optimal solutions. [3] Multiobjective Genetic Algorithms (MOGAs) represent a modified version of the classical Genetic Algorithm (GA), primarily distinguished by their approach to fitness function assignment. While the procedural steps remain similar to GAs, MOGAs aim to generate an optimal Pareto Front in the objective space, ensuring that further enhancement in any fitness function does not occur without considering the impact on other fitness functions [5]. The central goals of MOGAs encompass convergence, diversity, and coverage. Pareto-based MOGAs originated with the introduction of the concept of Pareto dominance by Fonseca and Fleming[6], marking the genesis of the first MOGA. Early approaches, such as the niched Pareto genetic algorithm (NPGA) by Horn et al. [7] and the non-dominated sorting genetic algorithm (NSGA) by Srinivas and Deb [8] addressed multimodal problems. NSGA suffered from issues like lack of elitism and high computation complexity, prompting the development of NSGA-II by Deb et al. [9]. However, challenges persisted, leading to adaptations like the introduction of dynamic crowding distance by Luo et al.[10]. Coello and Pulido [11] proposed a multiobjective micro GA, using an archive to store non-dominated solutions, though its performance was observed to decline in many-objective problems [12]. Decomposition-based MOGAs take a different approach by decomposing a problem into multiple subproblems, solving them simultaneously, and exchanging solutions among neighboring subproblems [12]. Ishibuchi and Murata [13] introduced a multiobjective genetic local search (MOGLS) employing random weights for parent selection and local search for offspring. Jaszkiewicz [14] modified MOGLS with different selection mechanisms for parents. Murata and Gen [15] extended MOGA with a cellular structure, termed C- MOGA, where the selection operator operated on the neighboring cells. Alves and Almeida [16] developed a multi- objective Tchebycheffs-based genetic algorithm (MOTGA) ensuring convergence and diversity. Patel et al. [17] introduced decomposition-based MOGA (D-MOGA) with opposition- based learning for weight vector generation, successfully balancing solution diversity and search space exploration. Based on the previous literatures, multi-objective optimization algorithm was chosen to solve our provided problem. It aims to optimize the selection of energy plans by considering multiple objectives simultaneously, including minimizing cost, maximizing renewable energy utilization, and accounting for cancellation fees. Our work aligns with the category of Multiobjective Genetic Algorithms (MOGAs), specifically

XX

consumption for each time interval were computed. These statistics provide insights into the variability and central tendencies of energy consumption across the given time. Mean consumption denotes the arithmetic mean of energy consumption values within the dataset. It offers a comprehensive overview of the average levels of consumption. The mean consumption numbers in this scenario vary between about 31,000 and 37,000, with each value amplified by a factor of 10,000. The median consumption, representing the central value in the dataset when organized in either ascending or descending order, provides valuable information about the consumption level at the midpoint. The median consumption estimates, which have been scaled by a factor of 10,000, range from around 29,000 to 35,000 and are lower than the mean consumption. The standard deviation (SD) quantifies the level of variability or dispersion within a dataset. A higher standard deviation (SD) indicates a larger range of values in energy use, indicating greater variability. The standard deviation (SD) values range from around 7,000 to 8,000 (scaled by a factor of 10,000), reflecting the extent to which data points deviate from the mean. Variance, which is the result of squaring the standard deviation, serves as an additional metric for quantifying the extent of dispersion. It quantifies the average amount by which each value in a set deviate from the mean, squared. The maximum and minimum consumption data in the dataset correspond to the highest and lowest levels of consumption, respectively. They provide an indication of the extent to which the majority of the observations are distributed. The minimum consumption varies between 210,000 and 270,000 (multiplied by a factor of 10,000), while the maximum consumption ranges from around 500,000 to 570,000 (scaled by a factor of 10,000). Correlation analysis was also conducted to assess the relationships between energy consumption at various time periods. The correlation matrix in this instance exhibits an extremely strong positive correlation between the different time intervals. Every individual cell within the matrix denotes the correlation coefficient between two distinct intervals, with values spanning from - 1 to 1. A correlation value of 1 represents a complete positive linear relationship, whereas - 1 signifies a complete negative linear association. Values approaching 0 indicate the absence of a linear correlation. It is evident in this matrix that the majority of values are in close proximity to 1, especially along the diagonal spanning from the upper left corner to the lower right corner. The diagonal line in the graph depicts the correlation between each period and itself, which is consistently 1, showing a perfect connection. The significant correlation coefficients observed in the matrix indicate a robust linear association between the time periods, indicating that variations in one interval tend to consistently correspond with variations in another interval, either positively or negatively. The correlation heatmap of energy consumption was presented in Fig 1.

3. 1 .2 Visualization of the Data Heatmap The illustration displays a correlation heatmap that showcases the connections between different time intervals associated with energy use. The heatmap displays the correlation coefficient between two distinct intervals in each cell, with values ranging from - 1 to 1. A value approaching 1 suggests a robust positive linear correlation, whereas a value approaching - 1 indicates a strong negative linear correlation. The diagonal line represents a perfect correlation (1.0) between each period and itself. Fig 3 Correlation Heatmap of Energy Consumption Intervals The heatmap displays mostly high correlation coefficients throughout the matrix, indicating a substantial degree of linear relationship between various time intervals. The symmetrical form of the heatmap suggests that the correlation between two intervals, A and B, is equivalent to the correlation between B and A. Boxplots Fig 4 Boxplot of Energy Consumption The boxplot displays the distribution of energy use over several time intervals throughout a day. Each box in the plot depicts the interquartile range (IQR) of energy consumption, which indicates the range of values that includes the center 50% of the data. The line within the box represents the median consumption, while the whiskers extend to illustrate the range

XX

of readings, omitting any possible outliers. This representation facilitates the comparison of energy usage trends at different time intervals, enables the identification of central tendencies, and aids in the detection of potential deviations or outliers in consumption patterns. Histogram Fig 5 Histograms of Energy Consumption Histograms depicting the probability distribution of energy usage at specific time intervals are presented. Each histogram depicts the frequency of energy consumption values within distinct intervals, providing a comprehensive analysis of consumption trends during various periods of the day. By visually representing the form and distribution of each histogram, it becomes simpler to comprehend the fluctuations, average values, and possible anomalies in energy consumption over the course of the day. Examining these histograms facilitates the identification of periods with the highest levels of consumption, the evaluation of fluctuations in usage intensity, and the comprehension of the general distribution of energy consumption across different time intervals.

  1. PLAN PARAMETERS AND OPTIMIZATION The energy plans, labeled as Plan A to Plan J, include distinct factors such as cost, cancellation fees, and utilization of renewable energy. Every criterion carries substantial importance in assessing the appropriateness and cost-efficiency of an energy plan. Cost pertains to the monetary investments related to each strategy, with a preference for lesser costs to ensure efficient selection. Cancellation fees are the monetary penalties imposed when a plan is cancelled, hence it is preferable to have lesser fees in order to minimize unnecessary costs. Renewable energy usage refers to the extent to which sustainable energy is included in a strategy, in line with environmental goals and potentially impacting decision- making. During the optimization process utilizing genetic algorithms (GAs), the plan parameters are methodically evaluated to determine the most optimal energy plan. Genetic algorithms (GAs) function by repeatedly assessing different combinations of parameters, using a fitness function that assigns weighted significance to factors such as cost, cancellation fees, and the utilization of renewable energy. The iterative procedure involves the normalization of parameter values within predetermined ranges, enabling the algorithm to continuously adapt and optimize parameters towards the most advantageous design. The optimization approach yields optimal plan parameters that fit with the project's objectives of cost-effectiveness, enhanced usage of renewable energy, and reduced cancellation fees. The fitness values obtained throughout the optimization process act as evaluation metrics, providing an indication of how well each plan fulfills the weighted objectives. In addition, the convergence plot provides a visual representation of the iterative process of the genetic algorithm, showing how fitness values change over generations until they reach the most optimal solution. The optimization process has terminated successfully. It offers the optimal plan parameters and their corresponding fitness score. The most optimal strategy is referred to as 'plan A' and has a fitness score of 0. Lower values of the fitness score indicate superior performance. Statistical metrics for energy consumption, such as the mean, median, standard deviation, maximum, and minimum, have been shown in 22 columns.
  2. RESULTS AND DISCUSSION A comprehensive analysis of the variables associated with various optimum strategies such as cost, time frame, greenness of energy, was carried out. The evaluative analysis of different plans comprehending the comparative performance was focused on 10 different plans that denote the factors including the previous variables. The data distribution was evaluated to understand the effectiveness of collected data. The linear relations it showed through the correlation matrix was convincing. The analysis of how factors such as normalized cost (costs standardized for comparison), the proportion of renewable energy usage in programs, and the impact of cancellation fees affect the optimization process were shown to understand how the optimization might work using the genetic algorithm function. The goal was to inspect these elements on decision-making and the ultimate optimum outcomes. This entails deriving significant conclusions or insights from the optimization process, resulting in the plan A to be the most optimal solution. MATLAB code results indicate that after 101 generations and a total of 19400 function evaluations, the optimization process identified 'Plan A' as the best solution with a fitness score of 0. The termination message suggests that the optimization concluded based on the average change in the fitness value being below a predefined tolerance level. The optimization was performed in an unconstrained manner, meaning there were no explicit constraints imposed on the optimization parameters, other than that implied in the function.
  3. CONCLUSION The report presented a comprehensive analysis of various optimized strategies, focusing on factors such as cost, time frame, and greenness of energy. It examined the impact of normalized cost, renewable energy usage, and cancellation fees on the optimization process, aiming to understand their influence on decision-making and the final optimized outcomes. The analysis led to the conclusion that 'Plan A' stood

XX

APPENDIX

CODES

clc clear all time = { (see more in the code file) }; data = [ (see more in the code file) ] % Transposing the data for table compatibility data = data.'; usageData = array2table(data, 'VariableNames', time); planNames = {'Plan A', 'Plan B', 'Plan C', 'Plan D', 'Plan E', 'Plan F', 'Plan G', 'Plan H', 'Plan I', 'Plan J'}; % Defining the plan data planData = [ 13.4, 1427.00, 150.00, 26, 2008, 115000, 2.2; % Plan A 13.4, 1430.00, 150.00, 100, 2019, 0, 0; % Plan B 13.5, 1438.00, 150.00, 100, 2001, 223000, 1.3; % Plan C 13.6, 1452.00, 150.00, 6, 2019, 3000, 0; % Plan D 13.6, 1454.00, 300.00, 15, 2021, 0, 5.9; % Plan E 13.7, 1461.00, 240.00, 29, 2022, 0, 2.2; % Plan F 13.8, 1477.00, 150.00, 25, 2020, 0, 0; % Plan G 13.9, 1482.00, 240.00, 100, 2022, 0, 2.2; % Plan H 13.9, 1484.00, 99.00, 26, 2005, 34000, 2; % Plan I 13.9, 1484.00, 199.00, 26, 2005, 34000, 2 % Plan J ]; options = gaoptimset('PopulationSize', 200, 'Generations', 300, 'StallGenLimit', 100, 'CrossoverFraction', 0.8, 'MutationFcn', {@mutationuniform, 0.05}); fun = @(x) objectiveFunction(x, data); [x, fval, exitFlag, output] = ga(fun, size(planData, 1), [], [], [], [], [], [], [], options); if isfield(output, 'fval') disp('Field name "fval" found in the output structure.'); fitnessValues = output.fval; for gen = 1:length(fitnessValues) fprintf('Generation %d - Best Fitness: %f\n', gen, fitnessValues(gen)); end else disp('Field name "fval" not found in the output structure.'); end % Statistical measures for each time interval (column-wise) mean_consumption = mean(data); % Mean consumption median_consumption = median(data); % Median consumption std_consumption = std(data); % Standard deviation of consumption max_consumption = max(data); % Maximum consumption min_consumption = min(data); % Minimum consumption % Displaying the calculated statistical measures disp('Statistical Measures of Energy Consumption:'); disp(['Mean Consumption: ', num2str(mean_consumption)]); disp(['Median Consumption: ', num2str(median_consumption)]); disp(['Standard Deviation of Consumption: ', num2str(std_consumption)]); disp(['Maximum Consumption: ', num2str(max_consumption)]); disp(['Minimum Consumption: ', num2str(min_consumption)]); % Performing correlation analysis correlation_matrix = corrcoef(data); % Compute correlation coefficients % Displaying the correlation matrix disp('Correlation Matrix:'); disp(correlation_matrix); % Visualizing the correlation matrix as a heatmap figure; imagesc(correlation_matrix); colorbar; % Show colorbar indicating the scale title('Correlation Heatmap of Energy Consumption'); xlabel('Time Intervals'); ylabel('Time Intervals'); % Boxplot for Energy Consumption figure; boxplot(data, 'Labels', time); title('Boxplot of Energy Consumption'); xlabel('Time Intervals'); ylabel('Energy Consumption'); % Histograms for Energy Consumption figure; for i = 1:size(data, 2) subplot(5, 5, i); % Adjust subplot layout as needed histogram(data(:, i), 'Normalization', 'probability'); title(['Histogram - ' time{i}]); xlabel('Energy Consumption');

XX

ylabel('Probability'); end [bestFitness, bestPlanIndex] = min(fval); bestPlanName = planNames{bestPlanIndex}; disp('Best Plan Parameters:'); disp(x(bestPlanIndex, :)); % Display the parameters of the best plan disp(['Best Plan Name: ' bestPlanName]); disp(['Fitness (Lower is better): ' num2str(bestFitness)]); disp(output); fieldNames = fieldnames(output); disp('Field names in the output structure:'); disp(fieldNames); fitnessField = ''; for i = 1:numel(fieldNames) if isnumeric(output.(fieldNames{i})) fitnessField = fieldNames{i}; break; end end if ~isempty(fitnessField) fitnessValues = output.(fitnessField); figure; plot(fitnessValues, 'LineWidth', 1.5); hold on; if exitFlag == 1 plot(length(fitnessValues), bestFitness, 'ro', 'MarkerSize', 10); else plot(length(fitnessValues), bestFitness, 'bx', 'MarkerSize', 10); end title('Convergence Plot'); xlabel('Generation'); ylabel('Fitness Value'); grid on; hold off; else disp('No fitness-related numeric field found in the output structure.'); end function fitness = objectiveFunction(planParams, data) cost = planParams(:, 3); cancelFee = planParams(:, 4); % Normalizing cost maxCost = max(cost); minCost = min(cost); if maxCost ~= minCost normalizedCost = (maxCost - cost) / (maxCost - minCost); else normalizedCost = zeros(size(cost)); % Handle division by zero end % Normalizing cancellation fee maxCancelFee = max(cancelFee); minCancelFee = min(cancelFee); if maxCancelFee ~= minCancelFee normalizedCancelFee = (maxCancelFee - cancelFee) / (maxCancelFee - minCancelFee); else normalizedCancelFee = zeros(size(cancelFee)); % Handle division by zero end % Calculating total renewable energy used for each plan totalRenewable = sum(planParams(:, 7:end), 2); maxRenewable = max(totalRenewable); minRenewable = min(totalRenewable); if maxRenewable ~= minRenewable normalizedRenewable = (totalRenewable - minRenewable) / (maxRenewable - minRenewable); else normalizedRenewable = zeros(size(totalRenewable)); % Handle division by zero end % Adjusting the weights for objectives weightCost = 0.3; weightRenewable = 0.4; weightCancelFee = 0.3; % Introducing constraints for cancellation fee and cost % (neeeds adjustment) penalty = 10000; % Penalty for not meeting the constraints % Applying constraints % Ensuring the cancellation fee is within an acceptable range cancelFeeConstraint = cancelFee <= maxCancelFee & cancelFee >= minCancelFee; % Ensuring the cost is within an acceptable range costConstraint = cost <= maxCost & cost >= minCost; % Applying penalty if constraints are violated cancelFeePenalty = penalty * ~cancelFeeConstraint; costPenalty = penalty * ~costConstraint; % Combining penalties for violated constraints totalPenalty = cancelFeePenalty + costPenalty; fitness = weightCost * normalizedCost + weightRenewable * normalizedRenewable + weightCancelFee * normalizedCancelFee + totalPenalty; end