# A Probabilistic Markov Chain Model for Short-term Water Demand Forecasting

## Abstract

Urban water management remains a crucial concern for city managers and planners. As water demand forecasting plays a key role in urban water management, identifying factors influencing water demand is particularly important to mitigate water shortage crises. This study utilizes a Markov chain model and Artificial Neural Networks (ANNs) to estimate short-term urban water demand in Tehran. The variables considered for estimation include maximum temperature, water consumption, and precipitation rate in the previous four days. These variables are used as previous events to predict water consumption on the fifth day. Daily data from March 21, 2018 to March 19, 2021 were collected for analysis. The results of the study indicate that the Markov model's forecasting is more accurate compared to the ANN model. The Markov chain model demonstrated 48% and 65% improvement in accuracy compared to the ANN model for the test data and the training data, respectively. This suggests that a Markov chain model can be a valuable tool for estimating short-term urban water demand. The findings of this study can contribute to better urban water management and planning to address water shortage issues effectively.

## 1 Introduction

Proper management and equitable allocation of water resources are crucial in addressing the water scarcity crisis that many countries are facing. By 2050, it is estimated that human society will need to utilize half of the world's freshwater resources to meet its water demand. This highlights the urgency for adopting appropriate water policies (Boretti and Rosa 2019). Currently, more than 26 countries, including 9 in the Middle East, are experiencing severe water scarcity. The severity of this crisis varies across different regions due to factors such as precipitation rate, population growth, water resource distribution, water use culture, per capita income, and climatic conditions (Mahkoui et al. 2014).

Urban water management and identifying the factors affecting urban water demand must receive greater attention. Short-term and long-term water demand forecasting should be considered as a core practice of urban water management. Short-term water demand forecasting includes daily, weekly, and monthly time horizons; however, long-term forecasting contains periods of one to several years. Short-term water demand forecasting is important for managing the efficiency of the existing water supply system, while long-term forecasting is used to plan and design the network, supply new water resources, and develop the existing water supply network.

Urban water demand forecasting helps in predicting the future water demand of a city or an urban area. This prediction is essential for planning and managing the water supply system effectively. By accurately forecasting the demand, water utilities can ensure that there is sufficient water available to meet the needs of the population (Kavya et al. 2023).

Forecasting urban water demand and identifying influencing factors are key steps in managing and mitigating water crises. Future water demand estimates empower decision-makers to take necessary actions considering constraints and emerging crises. Owing to the large number of variables affecting water demand, it's challenging or even impossible to forecast short-term consumption analytically. In such circumstances, employing intelligent systems like data mining and artificial intelligence emerges as a promising option (Kavya et al. 2023).

Recent studies have shown a growing interest in short-term urban water demand forecasting, with some utilizing probabilistic models such as the Markov chain model. For example, Gagliardi et al. (2017) developed a probabilistic short-term water demand forecasting model based on the Markov chain, while Wang et al. (2016) used hybrid Markov chain models for forecast-based analysis of regional water supply and demand in Urumqi, China.

However, the novelty of this paper's proposed model combining ANNs with the Markov chain model needs further clarification. A comparison with recent publications like Alhendi et al. (2023), who used ANNs with an enhanced Markov chain for short-term load and price forecasting in ISO New England, could help highlight the unique aspects of the proposed approach to short-term urban water demand forecasting.

The motivation behind this study is to address the gap in existing literature by introducing a novel probabilistic Markov chain model for short-term water demand forecasting. This model integrates variables such as maximum temperature, previous day's consumption data, and precipitation rate from the previous four days to accurately predict fifth-day consumption levels in Tehran.

This study aims to contribute valuable insights into better urban water management practices by providing accurate short-term forecasts using innovative modeling techniques like the Markov chain model. The findings from this research can aid city managers and planners in effectively addressing issues related to urban water shortage crises. Overall, this study contributes to better understanding and management of urban water demand, providing insights that can help mitigate water shortage crises in cities like Tehran. A brief review of studies on urban water demand forecasting follows.

In existing literature, urban water demand has been forecasted using various methods including pattern-based methods, as well as linear and nonlinear statistical models (Maidment and Parzen 1984). Studies have shown urban water demand is mainly influenced by temperature, precipitation, and past water demand (Sajadifar and Khiabani 2011). Time series models are widely applied to forecast water demand. In a preliminary study, a daily urban water consumption time series model was developed as a function of precipitation and temperature using previous data signals and applied in 9 cities in the United States to forecast water consumption (Maidment and Parzen 1984).

Artificial Neural Networks (ANNs) are other forecasting methods, used for short-term urban water demand forecasting and the examination of nonlinear models (Jain and Ormsbee 2002; Gonzalez Perea 2019). Some researchers have demonstrated that ANNs perform better than linear regression techniques in forecasting urban water demand (Jain and Ormsbee 2002; Mouatadid and Adamowski 2016). Besides ANNs, support vector machines (SVM) have also been employed for water demand forecasting, proving their efficiency (Herrera et al. 2010).

The number of machine learning-based water demand forecasting programs has recently increased significantly. Various studies have already reported practical results, indicating accurate forecasts can lead to more accurate optimization of operations in water distribution networks (WDNs).

Candelieri et al. (2019) presented a parallel global optimization model to optimize SVM’s regression parameters and accurately forecast water demand in a short-term planning horizon, i.e., 24 h. Each SVM classifier used the first 6 h water consumption as input and forecasted the typical water demand for the next 18 h based on these input data.

Pillay (2005) forecasted short-term water demand for the next 24 h in Toowoomba, Australia. The results showed the urban water demand was completely affected by the maximum temperature, precipitation, rainy days, moving average demand, and 4-day weighted average demand, and imposed constraint levels.

The extreme learning machine (ELM) method has been recently introduced in forecasting programs in computational science. Nair et al. (2013) showed ELM had the potential to perform better than an ANN model in forecasting monsoon rains in the southern peninsula of India.

Xenochristou et al. (2021) developed the Interpretable Machine Learning Approach to forecast urban water demand in the UK. Their results show that temporal, weather, and household characteristics are the most important factors affecting water demand.

Wu et al. (2017) forecasted water demand using a grey-box model in Chongqing, China. Chongqing is an urban region facing water shortages. Rapid economic development and population growth have recently unbalanced water supply and demand. They developed a grey water-forecasting model (GWFM) to estimate urban water demand. They forecasted urban water demand in Chongqing from 2017 to 2025 using GWFM and provided measures and recommendations based on the results.

Gagliardi et al. (2017) developed two homogeneous and non-homogeneous Markov chain models for water demand time series in three regions located in Harrogate and Dales, Yorkshire (UK). They found that a homogeneous Markov chain (HMC) model had higher accuracy than a non-homogeneous Markov chain in forecasting.

Striking a balance between supply and demand at a level acceptable to consumers is among the major challenges in urban water demand forecasting. In many urban planning programs, the future water demand of residents is an important parameter that needs to be accurately estimated. Currently, urban planners and designers typically estimate future water demand based solely on population size due to a lack of appropriate and efficient models. However, many other parameters impact water demand, and their effects should be determined using suitable models before estimating the water consumption.

Tehran, the capital, and most populous city of Iran, often grapples with water crises. Despite having various surface water and groundwater resources, it faces significant challenges in urban water supply and distribution. Consequently, inaccurate water consumption forecasts and imbalances between supply and demand can lead to a multitude of social, political, and environmental crises.

This paper introduces a novel short-term water demand forecasting approach based on a Markov chain model. A Markov chain model can provide a definite prediction of future water demand values. This model, characterized by a simple structure and being easy to comprehend and control, aims to estimate future hourly demands in the short term, relying solely on the observed water demand data.

The main advantage of using a Markov chain model for short-term water demand is its ability to capture the stochastic nature of water demand patterns.

Markov chains are mathematical models that describe a sequence of events where the probability of transitioning from one state to another depends only on the current state. In the context of water demand, this means that the future demand can be predicted based on the current demand level, without considering historical data or external factors. This advantage is particularly useful for short-term water demand forecasting, as it allows for real-time predictions based on current conditions. It can help water utilities and planners make informed decisions regarding resource allocation, infrastructure management, and supply-demand balancing. Additionally, Markov chain models are relatively simple to implement and computationally efficient compared to more complex forecasting techniques. They require minimal data input and can be easily updated as new information becomes available. Overall, the main advantage of using a Markov chain model for short-term water demand is its ability to provide accurate and timely predictions based on current conditions, enabling better planning and management of water resources.

The rest of this paper is organized as follows. The Markov chain model and ANN models are discussed in Section 2. In Section 3, the case study, data and variables are described. The proposed models are evaluated in Section 4, and the results obtained through the application of the models are described and compared. Final conclusions are presented in Section 5.

## 2 Methods

### 2.1 Markov chain model

The proposed water demand forecasting model assumed that the trend of water demand can be defined as a Markov chain. Markov approach modeling is a discrete-time stochastic process with Markov properties. A discrete-time stochastic process involves a system that is in a specific state at each step, with the state changing randomly between the steps. Steps are often considered as time periods, but they can also refer to physical distance or any other discrete variable. Markov states that the conditional probability distribution of the system in the next step depends only on the current state of the system, not on the past states. Changes in the state of the system are called transitions, and the probabilities attributed to these state changes are called transition probabilities. A Markov chain is completely defined by a set of states and transition probabilities. Conventionally, it is assumed that there is always the next state and, as a result, the process continues forever (Ching and Ng 2006, Carpinone et al. 2015).

In general, it is assumed that the stochastic process variable at time *t* can be identified by the mean water demand *q(t)* at time interval Δ*t* (e.g., Δ*t *= 1h). Moreover, it is possible that *N *classes, *c _{1}, c_{2}*, …,

*c*, constituting the entire range of water demand variability, be identified (Ching and Ng 2006).

_{N}If the state, i.e., class *ci*, of the water demand at current time *t *and transition matrix is known, a Markov chain allows us to define its probable state in the future Δ*t*. Equation (1) can be used to estimate the probability vector *P** ^{for}*(

*t*+ Δ

*t*), where

*P*

*represents the actual observed value. This parameter can be applied in the model. Thus, demand*

*(*t)*q(t)*belongs to a combination of

*N*-1 null values, and the value of 1 corresponding to that class (Ching and Ng 2006, Carpinone et al. 2015).

(1) |

Where:

t |
= | time, |

Δt |
= | time interval, |

P(^{for}t + Δt) |
= | probability vector, and |

P(t) |
= | actual observed value |

A transition matrix presents the model parameter that can be estimated by the observed water used in the model calibration phase. Since this is a calibrated variable, it is henceforth represented as Π(*t*)*.*This forecast can include up to the next *k*Δ*t* using Equation (2). Therefore, demand probabilities are forecasted in each class at time *t* + *k*Δ*t *considering *P ^{for}*(

*t*+

*k*Δ

*t*) by the time estimated earlier and the corresponding transition matrix. This information can be employed to obtain a deterministic forecast of future water demand

*q*(

^{for}*t*+

*k*Δ

*t*) at time

*t*+

*k*Δ

*t*as follows: (Ching and Ng 2006, Carpinone et al 2015.).

(2) |

Where:

k |
= | time step into the future. |

The weighted mean of *N* central values of classes *ci *where *i *= 1, …, *N*, represented in vector *m* = [*m** _{1}*,

*m*, …,

_{2}*m*], is calculated using the components of the probability vector predicted at time

_{N}*t*+

*k*Δ

*t*as follows: (Ching and Ng 2006, Carpinone et al. 2015).

(3) |

Where:

q^{for}(t + Δt) |
= | future water demand, and |

N |
= | number of classes. |

The lower-order Markov models may not be as accurate in forecasting compared to higher-order models. However, higher-order models can be more complex and may have reduced coverage. To address these challenges, it can be beneficial to learn and use different orders of Markov models in the forecasting phase. This approach can improve accuracy but also increases complexity. To mitigate this complexity, methods have been developed to reduce the number of states in the model.

One such method involves calculating the frequency of states and eliminating those with a frequency below a certain threshold. This helps simplify the model by removing less frequently occurring states. Another method involves estimating the error rate of each state. If a higher-order state has a higher error rate compared to similar states of lower order, it is removed from the model. This technique has shown high accuracy among examined techniques. Overall, these methods aim to strike a balance between accuracy and complexity when using Markov models for forecasting purposes.

In this study, the above procedure was used by creating a graph using the data and MATLAB software. To forecast the water consumption of the fifth day using the Markov chain model in MATLAB software, the temperature, rainfall, and water consumption data for the last four days were collected and uploaded. In the second step, the data were normalized.

After extracting the data and normalizing it, the data should be prepared to be used in a Markov chain model. For this purpose, the data are placed in a square matrix and the Euclidean distance of each row of the created data with other data is calculated (Ching and Ng 2006).

(4) |

Equation (4) calculates the Euclidean distance between rows *i* and *j* of the dataset.

Accordingly, a square matrix *n*n* is created, where *n* is the total number of rows in the generated matrix. So, the necessary series needed to be used in the Markov chain is prepared. This numeric chain could be applied to each row of data. The Markov chain could determine, for example, which row is less likely to be adjacent to which row in the data.

Then, using this data, a matrix of transition probabilities was constructed. This matrix shows how likely each state (water consumption) is to occur on the current day, according to the weather conditions on the previous day.

Using the Markov chain algorithm and starting from the initial state, states (water consumption) are randomly generated. Finally, using the generated states and the transition probability matrix, it iteratively completed the process and moved to the next states (the fifth day). The implementation steps are depicted in Figure 1.

Figure 1 The proposed method flowchart.

### 2.2 Artificial Intelligence Neural Networks model

Artificial Neural Networks (ANNs) are among the computational methods that provide mapping between the input space (input layer) and the desired space (output layer) by identifying the intrinsic relationship between the data and using a learning process and processors called neurons. The hidden layers process the information received from the input layer and provide it to the output layer. Each network is trained by receiving examples. Training is a process that ultimately leads to learning. Network learning occurs when the communication weights between the layers change, such that the difference between the predicted and calculated values is acceptable. By achieving these conditions, the learning process is realized. These weights express memory and network knowledge. (Bhagya Raj and Dash 2022)

The training steps for this algorithm are as follows:

- Assign a random weight matrix to each of the connections.
- Select the appropriate input and output vectors.
- Calculate neuron outputs in each layer, including the output layer.
- Update the weights in the previous layers using the error back propagation method. This error is due to the difference between the actual and calculated outputs.
- Evaluate the performance of the trained network by some defined indicators such as mean squared error (MSE).
- Return to Step 3 or end the training.

In this research, the ANN models utilized a feed-forward multi-layer perceptron design and were trained with a Levenberg-Marquardt (LM) back propagation algorithm. The hidden layer employed the 'logsig' activation function, while the output layer used the 'purelin' function. Each ANN model had four inputs, one output and seven hidden neurons. Wanas et al. (1998) showed that the best performance of an ANN occurs when the number of hidden neurons is equal to *log(T)*, where *T* is the number of training samples. Based on this method, the number of hidden neurons is determined.

## 3 Case study

### 3.1 Study area

Water resources are not efficiently managed in Iran. Population growth (Iran’s population has quadrupled in the last 50 years), unsustainable socioeconomic development, low water productivity, subsidies, keeping water and energy prices low for self-sufficiency and food security, and a country’s specific climatic conditions are important factors affecting water crisis.

These factors have caused more than 90% of Iran’s population and gross domestic product (GDP) to be located in areas where water extraction is beyond or close to the limit of sustainable consumption.

The price of water in urban and rural areas of Iran is very low compared to that of many non-essential goods and public utilities such as electricity, gas, and telephone. Therefore, the price of water is not a good indication about its true value and the need to save it.

The precipitation rate has decreased by 11% in the last 8 years compared to the long-term average; however, urban water demand has increased by about 16% in the same period. These factors have led to increased competition for access to water resources, resulting in many socioeconomic problems.

Tehran, the capital of Iran, has a population of about 8.7 million people according to the 2016 census, and spans an area of roughly 700 km^{2}, making it the largest and most populous city in the country. The population now sits at approximately 9.4 million people based on 2021 growth rates, with an additional 2 to 2.5 million people added daily as a floating population.

Despite numerous opportunities and capacities in geographical, socioeconomic, cultural, and political aspects, Tehran faces severe threats and challenges, such as proximity to significant epicenters, extensive eroded textures, acute water shortages, land subsidence, air pollution, and traffic.

Unlike most major cities worldwide, Tehran was not established near a river or water source. Therefore, part of the city's water demand is fulfilled by distant locations and surrounding rivers. In Figure 2, Tajrishy and Abrishamchi (2005) drew an excellent schematic map of water resources in Tehran Metropolitan City.

Three point five million m^{3} of water is consumed daily in Tehran, totaling around 1.1 billion m^{3} of water annually. This represents 17-18% of the total water consumption of the country. The per capita water supply in Tehran is 348 L per person per day, far exceeding the 170 to 220 L in more water-rich developed countries. Additionally, 86.5% of Tehran's renewable water resources are annually consumed, placing the water supply index in a critical state. Due to climatic shifts towards drier conditions, it has become increasingly challenging to meet Tehran's water demand. The situation was unprecedented in terms of water supply in 2020, marking a decline in precipitation not observed in the past 50 years. Precipitation in Tehran Province decreased by 37% compared to the previous water year. The nature of precipitation and distribution also varied. The volume of Tehran's dam reserves fell from approximately 1.1 billion m^{3} in 2020 to 800 million m^{3} in 2021, indicating a decrease in drinking water availability in Tehran's dams by about 300 million m^{3} from the previous year.

Figure 2 Schematic map of water resources in Tehran Metropolitan City.

### 3.2 Data and variables

Meteorological parameters related to the three meteorological stations of Tehran were weighed and the model input data were obtained by calculating their weighted average. The effective parameters of the model were selected by creating a correlation between the weighted average of meteorological parameters and consumption data*.* The selected effective parameters included the average daily temperature (°C), precipitation rate (mm), consumption rate one day before (m^{3}), daily consumption rate one week prior (m^{3}), and daily consumption rate one year ago (m^{3}). Daily data from March 21, 2018, to March 19, 2021 were collected for analysis. The available data were randomly divided into three categories, including model construction data, model evaluation data, and test data, and were used in modeling. Statistical explanations about the water consumption dataset are provided in Figure 3.

Figure 3 Box plot and statistics of the daily water consumption.

The water consumption rate on different days of the year was determined according to the dataset. However, operations were performed on the data to generate inputs and outputs based on the time series data and to make them suitable for use in both the Markov chain model and ANN algorithms.

The consecutive data were divided into five-day intervals in the ANN, i.e., the first four days were considered as the algorithm input, and the fifth day was considered as the output.

After converting the time series data into inputs and outputs, the data were normalized and converted into the 0-1 interval. For this purpose, the data were converted into normal data by the following equation. Accordingly, the maximum and minimum values of each input and output were determined, and then the data of each input were normalized, as follows:

(5) |

After processing the data and converting them into normal form, they were used in the Markov chain model and ANN.

## 4 Results

In this section, Markov chain and Artificial Neural Network (ANN) algorithms are used to forecast water demand. In both algorithms, 80% and 20% of the data were used as training and test data, respectively. In the following, diagrams of training and test data, as well as error rate of the proposed method, are presented.

The Nash-Sutcliffe Efficiency (NSE) is a measure of model performance that compares the observed values with the predicted values. It is calculated as:

(6) |

Root Mean Square Error (RMSE) is another measure of model performance that calculates the square root of the average of the squared differences between observed and predicted values. It is calculated as:

(7) |

Where:

*N *represents the number of data, the outputs of which are predicted by Markov algorithm and ANN. In training and test modes, this parameter was equal to 80% and 20% of the total data, respectively.

*Predicted _{i} *indicates the forecasted water consumption rate on the ith day in the dataset. This parameter was calculated using the Markov algorithm and ANN and displayed in the output as normalized.

*Observed _{i}* shows the actual water consumption rate on the

*ith*day.

The relationship between NSE and RMSE is that NSE considers both the variability in the observed data and the variability in the predicted data, while RMSE only considers the differences between observed and predicted values. NSE can be thought of as a normalized version of RMSE, as it compares the model's performance to a simple benchmark (the mean observed value). A higher NSE indicates better model performance, while a lower RMSE indicates better model accuracy.

### 4.1 Results of Markov algorithm

The actual values of water consumption and those forecasted by the Markov algorithm are presented in Figure 4. The x-axis and y-axis show the time and actual and forecasted water consumption (output) in normalized form, respectively.

Figure 4(a) Diagram of Markov algorithm for training data, and (b) Diagram of Markov algorithm for test data.

The greater the overlap between the two diagrams, the higher the detection accuracy. In this diagram, a complete overlap was observed between the data most of the time. In other times, where there was no overlap, the forecasted values were very close to the actual data.

The identification error rate of the Markov algorithm's output compared to the actual data for the test set is illustrated in Figure 5. It could be observed that the error rate was statistically insignificant. The x-axis and y-axis show the time and error rate, respectively.

Figure 5 Diagram of identification error rate of Markov algorithm for test data.

### 4.2 Results of Artificial Neural Network model

The following three diagrams illustrate the experiments related to the Artificial Neural Network (ANN) algorithm and the obtained results. In this study, an ANN with four input data, an intermediate layer with three neurons, and an output layer with one neuron, were used.

Figure 6 depicts the forecasted water consumption by the ANN algorithm alongside the actual values in the dataset. The x-axis and y-axis show the time and actual and forecasted water consumption (output) in normalized form, respectively.

Figure 6 Diagram of Artificial Neural Network (ANN) algorithm for training data.

Overlap between the two graphs directly correlates with accuracy. In this diagram, the overlap between the data was less than that in the Markov algorithm and the forecasted data were far from the actual data, suggesting that the Markov algorithm was superior to the ANN algorithm.

Figure 7 highlights a lack of substantial overlap between the actual and forecasted values by the ANN. This suggests that for predicting water consumption rates ANN may not be as accurate as the Markov algorithm. The x-axis and y-axis show the time and actual and forecasted water consumption (output) in normalized form, respectively.

Figure 7 Diagram of Artificial Neural Network (ANN) algorithm for test data.

One reason why the Artificial Neural Network (ANN) may not be sufficiently capable of predicting water demand is due to the complexity and variability of factors that influence water consumption. ANN relies on historical data to make predictions, but if there are sudden changes or unforeseen events that impact water demand, the network may struggle to accurately forecast future consumption rates.

Additionally, an ANN may not be able to effectively capture the non-linear relationships and interactions between different variables that affect water demand. This can lead to inaccuracies in the predictions made by the network, as it may not be able to adapt and learn from new patterns or trends in the data.

The identification error rate of an ANN output compared to actual data for the test data set is reported in Figure 8. The x-axis and y-axis show the time and error rate, respectively. The error rate of the ANN algorithm was significantly higher than that of the Markov algorithm.

Figure 8 Diagram of the identification error rate of the Artificial Neural Network algorithm for test data.

As presented in Table 1, the efficiency of the Markov algorithm was significantly higher than that of the ANN algorithm. The results of the study indicate that the Markov chain model outperformed the ANN model in terms of forecasting accuracy for short-term urban water demand. The RMSE for the Markov algorithm was significantly lower, and the NSE was significantly higher compared to the ANN algorithm.

Table 1 Comparing RMSE and NSE of Markov and Artificial Neural Network (ANN) algorithms.

RMSE | NSE | ||||

Training data | Test data | Training data | Test data | ||

Markov | 0.00026 | 0.00017 | 0.98 | 0.99 | |

ANN | 0.00074 | 0.00033 | 0.83 | 0.87 | |

The accuracy of the Markov Chain model compared to ANN |
-65% | -48% | +18% | +14% |

For the test data, the RMSE for the Markov model was 0.00017, while it was 0.00033 for the ANN model. Similarly, for the training data, the RMSE for the Markov model was 0.00026, whereas it was 0.00074 for the ANN model.

For the test data, the NSE for the Markov model was 0.99, while it was 0.87 for the ANN model. Similarly, for the training data, the NSE for the Markov model was 0.98, whereas it was 0.83 for the ANN model.

The Markov chain model demonstrated 48% and 65% improvement in accuracy compared to the ANN model for the test data and the training data, respectively (Figure 9). The percentage difference of the RMSE of the Markov model from the ANN algorithms is considered as accurate.

Figure 9 Comparing RMSE and NSE of Markov and Neural Network (ANN) algorithms.

These findings suggest that utilizing a probabilistic Markov chain model can be a valuable tool to estimate short-term urban water demand. By considering factors such as temperature, water consumption, and precipitation rate in previous days, city managers and planners can make more accurate forecasts and improve urban water management and planning to effectively address water shortage issues.

## 5 Conclusion

Considering the importance of water in human life and the daily need for water consumption, it is essential to estimate water demand in order to implement the necessary policies for supply and demand management.

Short-term urban water demand forecasting enables managers to better organize water network management and operation. Estimating the future water consumption in cities and designing the appropriate capacity for water distribution and storage systems reveals the need to use behavioral patterns and forecast water consumption rates. Considering that Tehran is facing a drought and water supply crisis, accurate water consumption forecasting models should be identified for urban management of this metropolis.

In this paper, a Markov chain algorithm was developed to forecast water consumption and its performance was compared with that of an Artificial Neural Network (ANN) algorithm. The obtained results from the Markov and ANN algorithms using the dataset were tested to evaluate the proposed method. Also, 80% and 20% of the data were employed as training and test data to train the algorithms. The results showed the Markov model was more efficient than the ANN method. The Markov chain model demonstrated 48% and 65% improvement in accuracy compared to the ANN model for the test data and the training data, respectively.

Given that balancing water supply and demand is among the basic strategies for integrated water resources management (IWRM), accurate water demand forecasting can play a major role in proper planning for the application of limited water resources. Due to the high accuracy of the Markov chain algorithm for forecasting daily water demand, policymakers and managers in the water sector can use the Markov chain algorithm for short-term planning in the water sector.

## References

- Alhendi, A., A.S. Al-Sumaiti, M. Marzband, R. Kumar, and A.A. Zaki Diab. 2023. “Short-term load and price forecasting using artificial neural network with enhanced Markov chain for ISO New England.“
*Energy Reports*9, 4799–4815. https://doi.org/10.1016/j.egyr.2023.03.116 - Bhagya Raj, G.V.S., and K.K. Dash. 2022. “Comprehensive study on applications of artificial neural network in food process modeling.“
*Critical Reviews in Food Science and Nutrition*62 (10): 2756–2783. https://doi.org/10.1080/10408398.2020.1858398 - Boretti, A., and L. Rosa. 2019. “Reassessing the projections of the World Water Development Report.”
*npj Clean Water*2, 15. https://doi.org/10.1038/s41545-019-0039-9. - Candelieri,A., I. Giordania, F. Archetti, K. Barkalov, I. Meyerov, A. Polovinkin, A. Sysoyev, and N. Zolotykh. 2019. “Tuning hyperparameters of a SVM-based water demand forecasting system through parallel global optimization.”
*Computers & Operations Research*106, 202–209. https://doi.org/10.1016/j.cor.2018.01.013 - Carpinone, A., M. Giorgio, R. Langella, and A. Testa. 2015. “Markov chain modeling for very-short-term wind power forecasting.”
*Electric Power Systems Research*122, 152–158. https://doi.org/10.1016/j.epsr.2014.12.025 - Ching, W.K., and M.K. Ng. 2006.
*Markov Chains: Models, Algorithms and Applications*.**Springer Science and Business Media, Inc., New York, USA. - Gagliardi, F., S. Alvisi, Z. Kapelan, and M. Franchini. 2017. “A Probabilistic Short-Term Water Demand Forecasting Model Based on the Markov Chain.”
*Water*9 (7): 507. https://doi.org/10.3390/w9070507 - Gonzalez Perea, R., E. Camacho Poyato, P. Montesinos, and A. Rodriguez Diaz. 2019. ”Optimization of water demand forecasting by artificial intelligence with short data sets.”
*Bio Systems Engineering*177: 59–66. https://doi.org/10.1016/j.biosystemseng.2018.03.011 - Herrera, M., S. Canu, A. Karatzoglou, R. Pérez-García, and J. Izquierdo. 2010. “An approach to water supply clusters by semi-supervised learning.” Conference Proceedings: International Congress on Environmental Modeling and Software (IEMSs), Ottawa, Canada.
- Jain, A., and L.E. Ormsbee. 2002. “Short-term water demand forecast modeling techniques conventional methods versus AI.”
*Journal AWWA*94 (7): 64–72. https://doi.org/10.1002/j.1551-8833.2002.tb09507.x - Kavya, M., A. Mathew, P.R. Shekar, and P. Sarwesh. 2023. “Short term water demand forecast modelling using artificial intelligence for smart water management.“
*Sustainable Cities and Society*95, 104610. https://doi.org/10.1016/j.scs.2023.104610 - Mahkoui, H., K. Jajarmi, and Z. Pishgahifar. 2014. “Environmental threats in the countries of the Persian Gulf geopolitical region with emphasis on the water crisis.”
*Regional Planning Quarterly, Fourth Year*13: 133–143. In Persian. sid.ir/paper/230509/en - Maidment, D.R., and E. Parzen. 1984. ”Cascade Model of Monthly Municipal Water Use.”
*Water Resources Research*20 (1): 15–23. https://doi.org/10.1029/WR020i001p00015 - Mouatadid, S., and J. Adamowski. 2016. “Using extreme learning machines for short-term urban water demand forecasting.”
*Urban Water Journal*14 (6): 620–638. https://doi.org/10.1080/1573062X.2016.1236133 - Nair, A., U.C. Mohanty, and N. Acharya. 2013. “Monthly prediction of rainfall over India and its homogeneous zones during monsoon season: A supervised principal component regression approach on general circulation model products.”
*Theoretical and Applied Climatology*111, 327–339. https://doi.org/10.1007/s00704-012-0660-8 - Pillay, R.S. 2005. “Short-term water demand forecasting for production optimization.” Dissertation, University of Southern Queensland, Faculty of Engineering and Surveying, Australia.
- Sajadifar, S.H., and N. Khiabani. 2011.” Modeling of Residential Water Demand Using Random Effect Model, Case Study: Arak City.”
*Journal of Water and Wastewater*22 (3): 59–68. - Tajrishy, M., and A. Abrishamchi. 2005. ”Integrated approach to water and wastewater management for Tehran, Iran.” In
*Water Conservation, Reuse, and Recycling*,*Proceedings of the Iranian-American Workshop.* - Wanas, N., G. Auda, M.S. Kamel, and F. Karray. 1998. “On the optimal number of hidden nodes in a neural network."
*Conference proceedings, IEEE Canadian Conference on Electrical and Computer Engineering (Cat. No. 98TH8341)*, Waterloo, ON, Canada, vol. 2, 918–921. https://doi.org/10.1109/CCECE.1998.685648 - Wang, B., L. Liu, G.H. Huang, W. Li, and Y.L. Xie. 2016. ”Forecast-based analysis for regional water supply and demand relationship by hybrid Markov chain models: a case study of Urumqi, China.”
*Journal of Hydroinformatics*18 (5): 905–918. https://doi.org/10.2166/hydro.2016.202 - Wu, H., B. Zeng, and M. Zhou. 2017.
*"*Forecasting the Water Demand in Chongqing, China Using a Grey Prediction Model and Recommendations for the Sustainable Development of Urban Water Consumption.*"**International Journal of Environmental Research and Public Health*14 (11): 1386. https://doi.org/10.3390/ijerph14111386 - Xenochristou, M., C. Hutton, J. Hofman, and Z. Kapelan. 2021.” Short-Term Forecasting of Household Water Demand in the UK Using an Interpretable Machine Learning Approach.”
*Journal of Water Resources Planning and Management*147 (4). https://doi.org/10.1061/(ASCE)WR.1943-5452.0001325