You are on page 1of 10

Applied Soft Computing 106 (2021) 107274

Contents lists available at ScienceDirect

Applied Soft Computing


journal homepage: www.elsevier.com/locate/asoc

Smart water conservation through a machine learning and


blockchain-enabled decentralized edge computing network

Tanvi Thakur a , Aryan Mehra b , Vikas Hassija a , Vinay Chamola c,d , , Rallapalli Srinivas e,f ,
Karunesh K. Gupta c , Ajit Pratap Singh e
a
Department of CS and IT, Jaypee Institute of Information Technology, Noida, 201304, India
b
Department of Computer Science, Birla Institute of Technology and Science, Pilani, Rajasthan, 333031, India
c
Department of Electrical and Electronics Engineering, Birla Institute of Technology and Science, Pilani, Rajasthan, 333031, India
d
APPCAIR, Birla Institute of Technology and Science, Pilani, Rajasthan, 333031, India
e
Department of Civil Engineering, Birla Institute of Technology and Science, Pilani, Rajasthan, 333031, India
f
Department of Bioproducts and Biosystems Engineering, University of Minnesota, 55108, USA

article info a b s t r a c t

Article history: Forecasting precise water usage corresponding to various beneficial usages is important for optimal
Received 5 November 2020 and sustainable planning and management of water resources. Due to rapid population growth, there
Received in revised form 28 January 2021 is an urgent need for devising water saving solutions. In this paper, we propose a blockchain based
Accepted 27 February 2021
incentivized edge computing framework for water saving using soft computing methodologies. The
Available online 19 March 2021
framework facilitates decision makers in creating awareness among people about water savings in a
Keywords: easily understandable scientific way. Our incentivized blockchain based model uses edge computing
Edge computing at the house nodes of the network to predict the actual usage of a particular household in the
Blockchain locality based on several factors such as number of people, average income of family, profession of
Machine learning the members and previous water demands. By using Feed Forward Networks and Mixture Density
Water conservation
Networks, we predict the water usage in terms of input factors and historical usage respectively,
thus incorporating machine computing into the framework. With the two values from these methods,
a comparison is made with the actual amount of water used by the householders. This research
proposes deployment of the smart contract on the blockchain network for efficient and accurate
reward distribution. Incentives and rewards are given in the blockchain network to houses with lesser
consumption and penalties are imposed when usage crosses predicted and historic usage. The model
ensures that accurate incentives are provided to the people in order to motivate them to avoid wastage
of water. Results show that the methods used in our work perform better than other relevant networks
on a self-synthesized dataset. The proposed methods converge well and show higher spatio-temporal
accuracy.
© 2021 Elsevier B.V. All rights reserved.

1. Introduction pollution, drinking water unavailability, inadequate sanitation,


open waste dumping, loss of forest cover, population growth
Water is one of the most important natural resources required are some of the problems that many parts of India face [2].
for human survival. It is well known that although 97 percent Water wastage at an alarming rate is one of the serious concerns.
of earth is surrounded by water, only 3 percent is available In the past, researchers have put considerable efforts to devise
as freshwater. Water usage is on the rise in various sectors of solutions to control the alarming increase in consumption of
the country [1]. Therefore, sustainable water resources manage- water resources [3]. Considering the utility of water for various
ment is necessary to meet the growing demand for water. Water beneficial usages such as industrial, domestic and agriculture,
its conservation is of utmost importance [4]. Water services are
aimed not only at meeting increasing demand through expanded
∗ Corresponding author at: Department of Electrical and Electronics Engineer- supply capacity but also at influencing future demand to ensure
ing, Birla Institute of Technology and Science, Pilani, Rajasthan, 333031, India efficient, cost-effective and environmentally sustainable water
(vinay.chamola@pilani.bits-pilani.ac.in).
services [5].
E-mail addresses: tanvithakur1999@gmail.com (T. Thakur),
f20170077@pilani.bits-pilani.ac.in (A. Mehra), vikas.hassija@jiit.ac.in This paper discusses a blockchain based incentive model us-
(V. Hassija), ralla008@umn.edu (R. Srinivas), kgupta@pilani.bits-pilani.ac.in ing the soft computing components namely artificial neural net-
(K.K. Gupta), aps@pilani.bits-pilani.ac.in (A.P. Singh). works. Neural network is used for finding the real-time solutions

https://doi.org/10.1016/j.asoc.2021.107274
1568-4946/© 2021 Elsevier B.V. All rights reserved.
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

in the existing scenarios for the efficient and useful data ex- • The network provides the public with one of the most
traction [6]. Blockchain is a decentralized ledger system where important human factors for conserving water — monetary
digital files are grouped into blocks, such as transaction lists or incentive through blockchain networks.
contractual agreements, and stored in a distributed database [7] • The proposed work is tested extensively on curated dataset,
. Complex cryptographic layers ensure a high degree of pro- and outperforms the other related methods with smooth
tection, making transaction records immutable and allowing for convergence as reflected in Table 2 and 4 .
peer-to- peer trade without having to have trusted central au-
thorities [8]. In the recent past Blockchain has found applica- 2. Related work
tions in various domains ranging from 5G network management,
mobile edge computing, VANETs, crowd funding, supply chain, Research has been done in the field of smart water saving
managing government workflows etc.[9–15]. In this paper, we using blockchain technologies. Many works have shown how
devise an efficient solution to water wastage by building a model effective architectures can leverage two layers of the edge com-
that provides a simplified framework to the householders in a puting networks to integrate them with the security and decen-
particular community minimize water wastage by utilizing the tralization of blockchain networks [25].
available water efficiently as the part of the blockchain net- Neural network lies in the layout class ‘‘black-box’’. Such mod-
work [16], where the customer can integrate the data and identity els do not need comprehensive insights into the internal func-
anonymity techniques with the network [17]. tions between inputs and outputs [26]. The techniques of soft
A unique feature of this framework is its ability to use of computing are nowadays being used successfully in many com-
blockchain with edge computing integrated architectures to facil- mercial, domestic, and industrial applications. Artificial neural
itate water savings. Recent research has shown that such systems networks have an inherent ability to learn and recognize highly
function better by decentralizing the data access and storage [18]. non linear relationships [27], and then organize dispersed data
The use of a smart contract in blockchain is inherently decentral- into a nonlinear model. Many researchers have addressed neural
ized. This gives ample opportunity to use sensors or IoT devices network history, capacities, forms, structure and learning algo-
at the house nodes itself to compute the reward and punishment rithms [28]. ANNs are modelling approaches that could be used
of the household based on its previous time series data. in predicting the impacts of deteriorating water quality on drink-
The water saving technique with blockchain includes incor- ing water purification processes [29]. Some studies address the
porating blockchain technology into environmental protection, development and use of mathematical models based on artificial
including thorough transparency in mitigating knowledge asym- neural networks, fitted with experimental data on a laboratory
metry which promotes stronger market structures in resource scale [30]. Some applied backpropagation to predict the water
allocation [19]. Blockchain has always been an effective tool consumption [31]. The findings showed improved prediction after
for such kind of contracts. It ensures heavy penalties against use of the technique highlighted in [32].
those who are not following desired rules required for water Time and again various studies were conducted on prediction
savings [20]. Blockchain network uses distributed storage rather models. Soft computing is a technique where the approximate
than central storage. There is no central governor of the network , model of the problem is available and the proposed solution is
which means that consensus can be achieved without centralized also based on the approximate reasoning techniques. To forecast,
three types of models were used including regression model, time
control. The right and responsibility of any node is equal, and
series model and ANN model [33], concluding that ANN models
all nodes with maintenance feature will maintain the data in the
are good for prediction of values related to water consumption
network [21]. This data from the nodes is used as the input to our
as well as treatment. Regression models have historically been
prediction model. The following points highlight the major steps
used in forecasting rates of water usage. Some early works in
and processes involved in the network:
the field used temperature and rainfall as the weather attributes
• The model used as the base model for prediction is the for such regression models [34,35]. Though several models were
Feed-Forward Neural Network. Neural networks have been proposed as predictors, a study states the importance of each
implemented successfully in various fields including water input feature in the model for water consumption [36]. The
resource management [22]. Here the demand of the various research in this field includes monthly and daily prediction using
houses in the particular locality is predicted. This is done at the Feed-Forward Neural Networks (FNNs) and the Recurrent
the house node itself because of the decentralized structure Neural Networks (RNNs) [37].
of the network. The forecasting models of water demand can be divided into
• Based on the various factors, the consumption value is pre- two types [38] viz. deterministic and stochastic. The first one
dicted using feed-forward neural network and the value is used for handling decision variables known with certainty
is compared with the historical value that is calculated whereas the second one is used when decision variables are ran-
using random probability distribution model for neural net- dom in nature. For example, the deterministic models are used for
works [23]. the primary approaches include multiple, simple, semi-log, and
• Based on these two values and the amount of water sup- log–log regressions mainly the short and medium scales [39–42].
plied, the incentive system is being prepared in blockchain The stochastic models are more commonly used for large-scale
which award good incentive to houses using less water than models, such as moving average, auto-regressive, auto-regressive
moving average, auto-regressive integrated moving average, arti-
predicted, and on the other hand applies penalty to houses
ficial neural networks (ANN), fuzzy control and supply.
using more water than predicted [24].
This paper proposes an approach of an incentivized blockchain
The proposed work has several contributions in the field of based model where the daily predictions are done by the su-
water conservation using soft computing and edge computing pervised Feed-Forward Neural Network [43]. The training of the
as the basis for the network. Some of the major advantages are model is done using an efficient algorithm named Symbiotic Or-
highlighted below: ganism Search [44]. The historical data is predicted using the ran-
dom probability distribution model for neural networks named
• The work is one of the first to use soft computing ap- Mixture Density Network [45]. This value is then added to the
proaches along with machine learning and blockchain for prediction from FNN and final historical dataset is prepared.
conservation of water. The use of SOS to train the FNN is Based on the above values, the incentive system is formulated
novel in its approach and effective without using typical in blockchain. The next section describes the overall procedure
backpropagation or gradient descent. adopted in this study.
2
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

Fig. 1. Proposed edge computing and blockchain integrated framework for smart water saving and distribution system.

3. System model 2. After creating an account, each account is linked to the


specific account address, public and private key collection.
Fig. 1 illustrates the working of proposed model where all the The data that every user shares on the network is pass-
houses in the locality belong to the same blockchain network. The word protected using the assigned private key to avoid
nodes in the blockchain are the houses in the locality and the non-repetition.
transaction from each node refers to the water consumption of 3. To obtain the regular use, the account information in the
that particular house. Fig. 1 shows the detailed working of the network is transferred to the neural feed-forward network
model. for prediction of water use.
The steps involved in the full working of the model are as 4. The output from Feed Forward Neural Network, which
follows: predicts the daily usage is fed to the Mixture Density Net-
1. Whenever new people shift to the locality, they are made work for estimation of the historical water consumption by
to register on the blockchain network by entering all the random probability distribution.
details like-members in the household, average income of 5. The probability estimates of both the models — one pre-
the family, age of the members, gender of the members, dicting the daily usage and other predicting the previous
profession of the members (which includes either office water demands are calculated. Both of these values are
work, raising livestock or farming), number of water using compared with the current consumption of the household.
equipment in the house, awareness of family members 6. If the current consumption is less than the predicted daily
regarding water saving, health conditions of the mem- usage as well as the predicted previous water demand, a
bers and the previous water demands. The water usage is considerable amount of incentive is provided. If the current
tracked using standard equipment that enables data to be consumption lies between both the predicted values, then
extracted, computed and stored at the edge of the network less amount of incentive is provided, and if the consump-
— the houses themselves. tion value lies beyond the predicted values, a penalty will
3
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

be charged. This entire calculation takes place at the edge Table 1


node of the blockchain network. Input values.

7. As future extension of our work, we will try for more Number of members (NP)
Average age of members (Aage)
accurate predictions plus some changes in the blockchain Average income of the members (AI)
system where it has more security and integrity. The mod-
Male
els used in the paper for prediction might fail in some Gender of the members(α) Female
cases. Overall, a more efficient algorithm can be designed Child
for the incentive system to motivate people to follow all Farming
the rules effectively. Profession of the members(ω)
Livestock raising
Work from home
Our model provides the speed and convenience of an edge Office going
computing network, combined with the safety and reliability of Number of equipment in house using water (Eq)
the blockchain smart contract [46–52]. This is required for effec- Awareness in family regarding water saving techniques (γ )
tive expansion, if the network to bigger localities and monetary Health conditions of family (π )

reward based incentives are provided. The use of machine learn-


ing algorithms provides the necessary intelligence for predictive
1 if male
{
analysis and neutrality in reward system. The subsequent section
discusses the proposed network model and the mathematics Genderk = 1 if female (6)
behind the water consumption in detail. 0.8 if child
∑N
Professioni
4. Proposed network model ωk = i=1
(7)
N⎧
1 if farming
Considering the houses in the locality H = {H1 , H2 , H3 , . . . ,

1 if livestock raising

Hi , . . . , Hn } where n is the number of houses in the locality Professionk = (8)
⎪0.8 if work from home
that are registered in the blockchain network. All the houses are 0.5

if office going
made to register on the network. In our work two models are
used — Feed-forward Neural Network for daily prediction and Eq −
→ Average number of equipment in house using water
{
Mixture Density Network Model for historical data prediction. 1 if aware
Fig. 2 clearly shows the various components of the model. γk = (9)
0 if not aware

4.1. Feed forward neural network for daily prediction {


1 if healthy
πi = (10)
0.5 if sick
Considering a day where the input of the particular household
is taken. The inputs are taken as a vector with all the fields. Each ∑N
house, Hk , feeds its information vector to the model, λk , which πi
πk = i=1
(11)
can be represented using: N
All these values are given as input to the model in the form
λk = {NPk , AIk , Aagek , αk , ωk , Eqk , γk , πk } (1)
of a vector. Then all this information is fed to the hidden layer
where NPk − → Number of members in the house Hk , where it is being processed to give the required output.
AIk − → Average income of the family Hk , Hidden input may have as many layers as we need in our
Aagek − → Average age of the members Hk , with Agei referring to network. The number of hidden layers affect the error calculation
the member age in our network. Each connection between an input layer and a
αk − → Average value of gender of the members Hk , with αi hidden layer is connected by a weight and also has a value called
referring to a member’s age, bias. Then this hidden layer connects to the output layer which
ωk − → Average value of profession of the members Hk , in turn gives the output.
Eqk − → Average number of equipment in the house using water
Hk ,
γk − → Overall binary awareness of the family regarding saving 4.2. Training of a neural network
water (installing the leak-proof pipeline etc.)Hk ,
πk − → Average health conditions of the members of the house Hk ., For executing any machine learning or deep learning model it
with member values denoted as πi [53] is necessary to first train the model before deploying it to make
Table 1 shows the summarizing of the parameters of input predictions on new data. For FNN the input data include 8 input
nodes. variables- (1) number of members (NP) (2) average income of
The information vector of a particular house is fed as an input the family (AI) (3) average age of members (Aage) (4) gender of
to the feed-forward neural network where N = Total number of members (α ) (5) profession of the members (ω) (6) number of
members of the house equipment in the house using water (Eq) (7) awareness of family
regarding water saving (γ ) (8) health conditions of the members
NPk = Numberofmembers (2) (π ). Our output will predict that how much amount of water
∑N will be utilized by this house. The value will be normalized and
i=1 Incomei
AIk = (3) between 0 to 1.
N Symbiotic organisms search (SOS) is used for the FNN training.
∑N
i=1 Agei SOS shall simultaneously evaluate the set of weights and bias
Aagek = (4)
N in order to minimize the overall error of one FNN and its cor-
∑N
Genderi
responding accuracy through network training. That means the
αk = i=1
(5) FNN structure is fixed at the time of prediction and usage in
N
4
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

Algorithm 1 Training a FNN using Symbiotic Organism Search number of layers and nodes hidden, the more complicated the
(SOS) Algorithm network becomes.
Input: Specified number of organisms (i.e the weights in our Hidden − nodes = 2 ∗ Input − nodes + 1 (16)
space) E , Number of training dataset N , Number of testing
datasets N , Number of input neurons I , Number of output neu- When using Symbiotic Search Organisms Algorithm to opti-
rons O, Termination Criteria T , Formulation of the number of mize network weights and bias, each organism’s dimension is
hidden neurons based on input and output neurons s specified calculated as the sum of weights in the input-hidden junction,
in the above formulas. H hidden-output junction with the respective biases in the nodes.
Output: Final output value between 0 to 1, θfinal
1: Mutualism phase begins 4.4. Fitness function
2: Pick one organism at random Xj where Xj ̸ = Xi
3: Formulate the benefit factor and mutual vector of mutual Through Symbiotic Search Organism Algorithm, each organism
relationship using the Equation 14 is tested and accepted according to its fitness value. The calcula-
4: Change the Xi and Xj organisms based on mutual interaction tion is done by providing the vector of weights and biases to Feed
relationship as given in Equation 12 and 13. Calculate the Forward Neural Network as an input and then the Mean Squared
fitness value of modified organisms. Error is formulated using the training dataset based on the neural
5: if modified organism is fitter than before then consider network prediction. Here j and ĵ are the real and approximate
transformed species and proceed to step 7 values based on the model being proposed, and R is the number
6: else keep preceding species and proceed to next step with of data in the training datasets.
the preceding species R
1∑
7: Commensalism phase begins MSE = (j − ĵ)2 (17)
8: Select one Xj organism at random, where Xj ̸ = Xi R
i=1
9: Change the Xj organism with the aid of Xi according to the
Equation 15 and measure changed organism fitness value
10: if modified organism is fitter than before then consider 4.5. Evaluation of the performance by SOS
transformed species and proceed to step 12
11: else keep preceding species and proceed to step 12 To explain the current data and to determine how unknown
12: Parasitism phase begins data will behave we classify our data. Apart from the MSE criteria,
13: Select one Xj organism at random, where Xj ̸ = Xi accuracy rate was used for the classification problem. This rate
14: Build an organism Xi parasite (parasite vector) by duplicating measures the classifier ’s ability by producing exact results which
organism Xi and modifying randomly selected dimensions can be calculated as follows:
with uniform random number. R̃
15: Calculate the fitness value of modified vector. Accuracy = (18)
R
16: if vector parasite is fitter than Xj then Xj is replaced by
parasite vector where R̃ indicates the number of correctly classified objects by the
17: else hold Xj and disable vector parasite classifier and R indicates the number of objects in the dataset.
18: Check whether the termination criteria is met This is the basic algorithm for the training of the model. The
19: If yes then you can achieve the optimal solution, if no then input is fed to the model and then the various phases work. Like
switch to step 1 and again formulate Xj and Xi in mutualism in the above algorithm we use six different phases-
phase
1. Reading the datasets.
2. Ecosystem initialization.
3. Identifying the best organism Xbest .
the entire system architecture. There are three phases in which 4. Then comes the mutualism phase where the first set of
the algorithm trains the dataset-mutualism phase, commensalism organisms is observed and decision is made according to
phase and parasitism phase according to the given equations. mutual vector and benefit factor.
5. After this is the commensalism phase where the another
Xinew = Xi + α (Xbest − MV ∗BF1 ) (12)
set of organisms is observed and selected based on the
fitness value.
Xjnew = Xj + β (Xbest − MV ∗BF2 ) (13)
6. Then is the parasitism phase where the decision is made
(
Xi + Xj
) according to parasite vector.
MV = (14)
2 4.6. Mixture density network for predicting the historical data
Here BF1 and BF2 are the benefit factor values which are de-
termined randomly as either 1 or 2. MV represents the mutual A Mixture Density Network (MDN) is an interesting model
vector. The following equation gives the Commensalism phase. built within the general framework of neural networks [54]. It
works best for theory of prediction of probability of the super-
Xinew = Xi + δ Xbest − Xj
( )
(15)
vised learning problems. MDN is a class of models obtained by
where δ represents a random number in [−1, 1]. And Xbest is the combining a standard neural network with a mixture of distribu-
highest degree of adaptation organism. tions. It is a framework that helps us formulate the conditional
probability distribution p(y|x) as a mixture of distributions. Input
4.3. The feed forward neural networks architecture x here is a prediction that comes from Feed Forward Neural
Network. The advantage and rationale for using the Mixture
While designing a feed forward neural network, the structure Density Network is that it is one of the few methods that give
must be calculated depending on the number of layers and num- the prediction with probability of water usage by the different
ber of neurons in the input, hidden and output. The greater the households, which is a continuous quantity. Moreover, not all
5
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

Fig. 2. Working of the model.

water consumption distributions are linear, or predictable by a joint distribution over the latent variable z:
single model alone. Using MDN gives us the best theoretical limit ∫
to accuracy as well [54]. MDN also has the capability to take p(y|x) = p(y, z|x)dz
the output value of FNN as input, making the prediction more ∑
= p(y, z|x)
concrete and coherent.
z
Here we work on the Gaussian distribution function, because ∑ (20)
prediction of water trend is most common in Gaussian(normal) = p(z)p(y|x, z)
z
distribution. Our neural net will create a Gaussian or Normal Mix- ∑
πk (x)N y|µk (x), I σk2 (x)
( )
ture Model, which is a standardized linear functionality of K Gaus- =
k
sian distributions. Eq. (19) shows the conditional probability of
Gaussian distribution which is used for further computations [54]. The advantage here is that we now formulate our intuitive ideas
The mixture of distributions is depicted by this equation. Formally in a simple, anticipated manner.
the probability can be expressed under the condition p(y|x) as: Apart from this process we need to add our model parameters
∑ specifically and extract a successful and efficient loss. Till now,
πk (x)N y|µk (x), I σk2 (x) we have discussed and formulated our model outputs as x func-
( )
p(y|x) = (19)
k tions without especially mentioning any model parameters. Let
us place w now as our vector trainable model parameters and
where π (x) is a normalized k coefficient mixing vector as a re-institute our model as a function of both x and w, or more
function of x, and the expression N y|µk (x), I σk2 (x) is a Gaussian
( )
specifically as a function of x specified by w. The conditional p(yx)
component density with means µk (x) and variance σk2 (x), both of distribution can then be changed to especially update it. Now we
which are also functions of x. need to update w as-
The π (x) represents a probability distribution vector for our ∫
function. Gaussian(normal) component portion of the distribution p(y|x, w) = p(y, z|x, w)dz
can be formulated by this process. In order to do the formulation ∑ (21)
πk (x, w)N y|µk (x, w), I σk2 (x, w)
( )
=
of the component, we must add a variable z called as a latent
k
variable that is one-hot encoded with possible K states, and then
π(x) represents the p(z) distribution. More precisely, we could Our trainable parameters of model w are now part of our prob-
abilistic method. Because of this, we may intuitively change w
define p (zk = 1) = π k(x), that is π k(x) as the possibility of z
to optimize our p(yx, w) conditional distribution for any obser-
being in the k state, which can be defined as the fundamental
vation given of y and x. To do this, we have to first improve
probability of z being in the k state. In view of the above calcula-
our conditional distribution to include the full (X, Y) dataset to
tions and probabilities, we can validate our idea of calculating the which we can accessed by defining it as p(Y|X, w) Then, we use
conditional Gaussian part such as p(yx, z), in which we condition Bayes theorem to propose some more probabilistic entities that
the y distribution to both x and our new variable z. Keeping in will help us to define our loss function efficiently as:
mind our current situation p(z) and p(yx, z) distributions, we may
p(w|Y, X)p(Y) = p(Y, w|X) = p(Y|X, w)p(w)
construct a joint distribution p(y, zx) between y and z, and then posterior × evidence = joint distribution = (22)
formulate our conditional distribution p(yx) by depreciating this likelihood × prior
6
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

Table 2
Comparison of MDN with other models.
Null model Linear model DNN MDN
MSE (Mean Squared Error) 2.280 0.200 0.200 0.200
NLL (Negative Log-Likelihood) 1.875 1.200 1.200 −0.334

which leads to-


p(Y|X, w)p(w)
p(w|Y, X) =
p(Y)
(23)
p(w|Y, X) ∝ p(Y|X, w)p(w)
posterior ∝ likelihood × prior
here we realize the proof of the concept is not a function of
w, parameters and would therefore be unnecessary to use that
during our optimization. We should now aim to efficiently find
Fig. 3. Prediction of the water utilized by 10 sample houses using feed-forward
the w, posterior probability, and thus define our loss function
neural network and mixture density network.
L(w) in terms of the likelihood and prior:

−1
L(w) = log( likelihood × prior ) loss with regard to the actual model. The output value from the
N
−1 Mixture Density Network is taken and added to the predicted
= log(p(Y|X, w)p(w)) values of water usage from Feed-Forward Neural Network. This
N
N ( (∫ )) value is taken as the historical data of water consumption by a
−1 ∑ household in the locality.
= log p (yn , zn |xn , w) dzn + log(p(w))
N
n=1
N
( ( 4.8. Evaluating the final results
−1 ∑ ∑
= log πk (xn , w) N (yn |µk (xn , w) ,
N In the end we have the following values-
n=1 k
))
• One from the Feed-Forward Neural Network. This is the
I σk2 (xn , w)
)
+ log(p(w)) daily predicted value of the particular household in the
locality. Let this be V 1
(24) • Second from the Mixed Density Network. This value is added
to the value V 1 from the Feed Forward Model and then the
where we used algorithm to transform a probability result into
final value gives the historical data that is the previous water
a log summation probability of numerical consistency, negation
of minimization rather than maximization, and the summation demands of the house V 2
summed to make the function irreducible to batch sizes. By • Third is the value of the water which is provided by the
explicitly reducing L(w) w.r.t. w we can now improve our model water supply plant to all the houses V 3. This is the actual
parameters w. Here we assume a ambiguous and random prior water consumption.
to p(w) = 1, which simplifies our loss function to:
In the end all these values are compared in the smart contract
N
( ) deployed on ethereum and an incentive value or a penalty value
−1 ∑ ∑
πk (xn , w) N yn |µk (xn , w) , I σk2 (xn , w) is calculated. The criteria for computation of the final incentive
( )
L(w) = log
N or penalty in the smart contract is as follows-
n=1 k

(25) • If the house uses water less than the predicted value V 1
and V 2 then the incentive is provided which is equal to the
Table 2 shows the comparison of MDN with other models. [54]
difference of the water consumed and water supplied V 3.
4.7. Training the model
• If the house uses water between the two predicted values
V 1 and V 2 then the incentive is provided which is equal
to the difference between the water consumed and water
For training first we need to prepare the dataset from the Feed
supplied V 3. This will be lower than the previous case.
Forward Neural outputs. We construct a model where xi is the
input and a value outi is generated, which can be interpreted as
• If the house uses water beyond the predicted values V 1 and
V 2 then penalty is applied which is equal to the extra water
the mean criteria of a Normal distribution for yi according to the
used that is difference between the water consumed and
given function.
water supplied V 3.
Y = X + 0.3 sin(2π X) + noise (26)
. We generate a training dataset as follows — we generate a ma- 5. Numerical analysis and results
trix X of n observations of a 1-dimensional variable x by sampling
uniformly over the interval [0, 1), and then generate a corre- 5.1. Simulation settings
sponding matrix Y of n target observations of a 1 -dimensional
variable y by computing. The noise is the vector of n uniform val- We have used the Feed Forward Neural Network for the pre-
ues sampled over the interval [-0.1,0.1). We can then formulate a diction of the daily consumption on our dataset. We have im-
loss function as the negative probability of log assuming a Normal plemented this in python using pandas, numpy and networks.
distribution, and optimize the parameters of our model for this The values are calculated keeping in mind the minimum error
7
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

5.2. Performance evaluation

We select the weights that give the best possible fitness value
through SOS training mechanism for the neural network. Fig. 4
shows the change in the MSE values over the number of iter-
ations, thus proving that our method converges well. Extensive
dataset synthesis and testing has shown that the training con-
verged with a fitness or MSE loss of 0.0124. When this computa-
tion is carried out locally, within the house node of the blockchain
network, the results will not just have the advantage of the
above mentioned accuracy but also the speed of edge computing
networks.
Fig. 5 shows the comparison of the Mixture Density Network
(MDN) model with A-MDN and R-MDN model [55]. The figure
clearly shows that during the course of time MDN shows the max-
imum accuracy among other models. So clearly this is the best
Fig. 4. Fitness values of the best predicted organism over the number of model to be used in historical prediction of water consumption
iterations..
of the houses. The random probability distribution model used in
this paper is the most efficient for our dataset.

6. Conclusion

In this manuscript, we propose a blockchain and edge com-


puting integrated incentive based framework for smart water
saving and distribution. Since the houses themselves are the
nodes of the blockchain network, the computation takes place at
the edge of the network and provides fast incentivized method of
water conservation. Various steps involved include the accurate
prediction of daily water demands using a Feed Forward Neural
Network that uses many factors to predict water consumption.
The FNN is trained using a soft computing approach called Symbi-
otic Organism Search (SOS). We also use Mixed Density Network
for historical prediction of the house. Together, they give the
best results with high accuracy. The houses using excess water
than predicted values are charged with penalties and those using
Fig. 5. Comparison of MDN with other neural network models. the water efficiently get the incentives through the blockchain
network. This system motivates the people to save water and
prevent any wastage. The novelty of this work is reflected in
rate and maximum efficiency. Firstly our training dataset con- this integration of blockchain and water consumption prediction
tains 30 data points which are synthesized manually with full model in a single framework. Blockchain ensures security and
experimentation. The training is done using the soft computing timely payment of penalties and incentives. Overall, this sys-
algorithm which is SOS algorithm. This algorithm helps us decide tem is unique and provides an efficient framework for optimal
the number of hidden layers (17 in our case) plus the weights water usage. Furthermore, the work lays future groundwork for
of the connections between input and hidden as well as hidden researchers to create innovative designs and networks that in-
and output and also the biases so that we have minimum mean volve using inexpensive soft-computing techniques to conserve
squared error MSE (0.0124 in our case). Our testing dataset con- the environment around us. Using sensors and ML or blockchain
tains 10 data points which are further used to obtain the best integrated services help in creating incentives for the people
results with most accuracy. Another prediction of water usage while making sure about the effectiveness of the implementation
by different houses is done using the Mixed Density Network. of applications like water consumption, medical diagnosis, elec-
We have used three python libraries here namely — Edward, tricity consumption etc . Future work may even further explore
Keras and Tensorflow. In case of water prediction we have taken more input factors for the FNN to make the model more accurate.
Gaussian or Normal distribution. Fig. 3 shows the predicted water
values of the different houses using both Feed-Forward Network
and Mixture Density Networks. These two values obtained can be CRediT authorship contribution statement
combined and compared to produce actual results. Taking these
two values plus the actual water supply we predict the incentive Tanvi Thakur: Methodology, Software, Writing - original draft.
or penalty amount. Each of the node or the house has its own Aryan Mehra: Data curation, Formal Analysis, Writing - original
ethereum wallet(smart contract wallet) with some funds through draft. Vikas Hassija: Project administration, Validation. Vinay
which they can interact with the smart contract on ethereum Chamola: Conceptualization, Supervision, Resources. Rallapalli
network. The smart contract decides the amount of penalty or Srinivas: Conceptualization, Software, Validation. Karunesh K.
incentive to be provided to the single user depending on its water Gupta: Writing - reviewing and editing, Funding acquisition. Ajit
consumption. Pratap Singh: Writing - reviewing and editing, Funding acquisi-
tion.
8
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

Declaration of competing interest [21] Z. Ye, M. Yin, H.J. Llewellyn Tang, Cup-of-water theory: A review on the
interaction of BIM, IoT and blockchain during the whole building lifecycle,
2018, http://dx.doi.org/10.22260/ISARC2018/0066.
The authors declare that they have no known competing finan-
[22] H. Coskun, M. Maktav, H.K. Cigizoglu, Artificial Neural Networks In Water
cial interests or personal relationships that could have appeared Resources. In: (eds) Integration of Information for Environmental Security,
to influence the work reported in this paper. NATO Science for Peace and Security Series C: Environmental Security.
Springer, Dordrecht, 2008.
Acknowledgement [23] A. Gifuni, A. Sorrentino, G. Ferrara, M. Migliaccio, An Estimate of the
Probability Density Function of the Sum of a Random Number N of
Independent Random Variables, Hindawi Publishing Corporation Journal
This work was partially supported by DST Interdisciplinary of Computational Engineering Volume 2015, 2015.
Cyber Physical System (DST-ICPS), India project grant titled ‘‘De- [24] S.V. Akram, P.K. Malik, R. Singh, G. Anita, S. Tanwar, Adoption of blockchain
velopment of Cyber Physical System based Smart Water Grid technology in various realms: Opportunities and challenges, 2020.
for Community usage’’ (Minutes OM No: DST/ICPS/PAMC/Cluster [25] C. Luo, L. Xu, D. Li, W. Wu, Edge computing integrated with blockchain
technologies, in: Complexity and Approximation, Springer, 2020, pp.
(CPSR)/2018 dated 13th March 2018 and Sanction OM: 268–288.
DST/ICPS/Cluster (Cyber Physical Systems)/2018(G) dated 13th [26] A. El-Din, D. Smith, A neural network model to predict the wastewater
March 2019). inflow incorporating rainfall events, Water Res. (2002) 1115–1126.
[27] S. Haykin, Neural Networks: A Comprehensive Foundation, Prentice Hall,
New York, 1999.
References
[28] F. Ogwueleka, T. Ogwueleka, Feed-forward neural networks for precipita-
tion and river level prediction, Adv. Appl. Sci. (2009) 350–356.
[1] R. KB, B. Reddy, S. Patil, Water conservation in India: An institutional
[29] G. O’Reilly, C.C. Bezuidenhout, J.J. Bezuidenhout, Artificial neural networks:
perspective, Ecol. Environ. Conserv. 20 (2014) 303–311.
applications in the drinking water sector, Water Supply (2018) 18 (6)
[2] S.C. Magnus Moglia, S. Tapsuwan, Promoting Water Conservation: Where
(2018) 1869–1887.
to from Here?, CSIRO Land and Water, Ian Wark Building (B203), Clayton
[30] C. Teodosiu, P. Octavian, M. Macoveanu, Neural network models for
South, VIC 3169, Australia, 2018, http://dx.doi.org/10.3390/w10111510.
ultrafiltration and backwashing, 2000.
[3] J. Wescoat, L. James, Searching for Comparative International Water Re-
[31] R. Patel, Modelling Chemical Dosing in a Modem Treatment Plant Us-
search: Urban and Rural Water Conservation Research in India and the
ing Artificial Neural Network (ME Thesis), Department of Environmental
United States, Vol. 7, Massachusetts Institute of Technology, MA, USA.
Engineering, University of Wollongong, 2001.
[4] M. Kumari, J. Singh, Water conservation: Strategies and solutions, Int. J.
[32] X. Mi, M. Sivakumar, D. Hagare, A General Review of Applications of
Adv. Res. Rev. (2016) 75–79.
Artificial Neural Network to Water Industry, Sustainable Earth Research
[5] S. Sharma, K. Vairavamoorthy, Urban water demand management:
Centre (SERC) School of Civil, Mining and Environmental Engineering
Prospects and challenges for the developing countries, Water Environ. J.
University o f Wollongong, NSW, 2522, Australia, 2004.
(2009) 210–218.
[33] R. Yu, S. Kang, S. Liaw, M. Chen, Application of artificial neural network to
[6] D. Ibrahim, An overview of soft computing, Procedia Comput. Sci. 102
control the coagulant dosing in water treatment plant, Water Sci. Technol.
(2016) 34–38.
42 (3-4) (2000) 403–408.
[7] J. Weking, M. Mandalenakis, A. Hein, et al., The impact of blockchain
[34] W.D. Morgan, Smolenm, Climatic indicators in the estlmation of municipal
technology on business models – a taxonomy and archetypal patterns,
water demand, JAWRA J. Amer. Water Resour. Assoc. 12 (3) (1976)
Electron. Mark. (2019).
511–518.
[8] S.J. Pee, J.H. Nang, J.W. Jang, A simple blockchain-based peer-to-peer
water trading system leveraging smart contracts, in: Int’l Conf. Internet [35] R.D. Hansen, R. Narayanan, A monthly time series model of municipal
Computing and Internet of Things | ICOMP’18, 2018. water demand, JAWRA J. Amer. Water Resour. Assoc. 17 (4) (1981)
578–585.
[9] V. Hassija, G. Praveen, V. Chamola, N. Kumar, Blockchain for 5G: A prelude
to future telecommunication, IEEE Netw., 34 (6) 106–113. [36] M. Bakker, H. van Duist, K. van Schagen, J. Vreeburg, L. Rietveld, Improving
[10] V. Hassija, V. Gupta, S. Garg, V. Chamola, Traffic Jam probability estimation the performance of water demand forecasting models by using weather
based on blockchain and deep neural networks, IEEE Trans. Intell. Transp. input, Procedia Eng. 70 (2014) 93–102.
Syst. 1–10. [37] S. Shah, M. Hosseini, Z.B. Miled, R. Shafer, S. Berube, A water demand
[11] V. Hassija, V. Chamola, G. Han, J. Rodrigues, M. Guizani, Dagiov: A prediction model for central Indiana, in: The Thirtieth AAAI Conference on
framework for vehicle to vehicle communication using directed acyclic Innovative Applications of Artificial Intelligence (IAAI-18).
graph and game theory, IEEE Trans. Veh. Technol. 69 (4). [38] D. Kofinas, N. Mellios, E. Papageorgiou, C. Laspidou, Urban water demand
[12] V. Hassija, V. Chamola, S. Zeadally, BitFund: A Blockchain-based Crowd forecasting for the island of skiathos, Engineering 89 (2014) 1023–1030,
Funding Platform for Future Smart and Connected Nation, Vol. 60, 2014.
Sustainable Cities and Society, Elsevier. [39] A.S. Polebitski, R. Palmer, Seasonal residential water demand forecasting
[13] V. Hassija, V. Chamola, V. Gupta, S. Jain, N. Guizani, A survey on for census tracts,, J. Water Resour. Plann. Manage. 136 (1) (2010) 27–36.
supply chain security: Application areas, security threats, and solution [40] R.B. Billings, D.E. Agthe, Space versus multiple regression for forecasting
architectures, IEEE IoT J.. urban water demand,, J. Water Resour. Plann. Manage. 124 (2) (1998)
[14] V. Hassija, V. Saxena, V. Chamola, A mobile data offloading framework 113–117.
based on a combination of blockchain and virtual voting, Softw. Pract. [41] A. Arouna, S. Dabbert, Determinants of domestic water use by rural
Exp. Wiley, preprint online http://dx.doi.org/10.1002/spe. households without access to private improved water sources in benin:
[15] V. Hassija, V. Chamola, N. Dara, N. Kumar, M. Guizani, A Blockchain A seemingly unrelated tobit approach, Water Resour. Manage. 24 (2010)
and edge computing-based secure framework for government tender 1381–1398.
allocation, IEEE Internet Things J.. [42] A. Altunkaynak, M. Özger, M. Çakmakci, Water consumption prediction of
[16] M. Lacity, Addressing key challenges to making enterprise blockchain istanbul city by using fuzzy logic approach, Water Resour. Manage. 19 (5)
applications a reality, MIS Q. Exec. 17 (2018) 201–222. (2005) 641–654.
[17] H.H.M. Mahmoud, W. Wu, Y. Wang, Secure data aggregation mechanism [43] G. Bebis, M. Georgiopoulos, Feed-forward neural networks, IEEE Potentials,
for water distribution system using blockchain, in: 25th International Con- 13 (4) 27–31.
ference on Automation and Computing (ICAC), Lancaster, United Kingdom, [44] H. Wu, Y. Zhou, Q. Luo, M.A. Basset, Training feedforward neural networks
2019, 2019, pp. 1–6, http://dx.doi.org/10.23919/IConAC.2019.8895146. using symbiotic organisms search algorithm, Comput. Intell. Neurosci.
[18] R. Yang, F.R. Yu, P. Si, Z. Yang, Y. Zhang, Integrated blockchain and edge (2016).
computing systems: A survey, some research issues and challenges, IEEE [45] C.M. Bishop, Mixture Density Networks, Neural Computing Research Group
Commun. Surv. Tutor. 21 (2) (2019) 1508–1532, http://dx.doi.org/10.1109/ Dept. of Computer Science and Applied Mathematics Aston University
COMST.2019.2894727. Birmingham. B4 7ET, U.K..
[19] U.W. Chohan, Blockchain and Environmental Sustainability: Case of IBM’s [46] J. Zhang, C. Xu, Z. Gao, J. Rodrigues, V. Albuquerque, Industrial pervasive
Blockchain Water Management, Critical Blockchain Research Initiative edge computing-based intelligence iot for surveillance saliency detection,
(CBRI); Centre for Aerospace & Security Studies (CASS), 2019. IEEE Trans. Ind. Inform. v. 1, p. 1.
[20] B. Bordel, D. Martin, R. Alcarria, T. Robles, A blockchain-based water control [47] C. Wang, G. Yang, G. Papanastasiou, I. Heye Zhang, J.J.P.C. Rodrigues Fellow,
system for the automatic management of irrigation communities, in: 2019 I. Victor Hugo, C. de Albuquerque, Senior Member, Industrial cyber-physical
IEEE International Conference on Consumer Electronics (ICCE), Las Vegas, systems-based cloud iot edge for federated heterogeneous distillation, IEEE
NV, USA, 2019, http://dx.doi.org/10.1109/ICCE.2019.8661940. Trans. Ind. Inform. v. 1, p. 1.

9
T. Thakur, A. Mehra, V. Hassija et al. Applied Soft Computing 106 (2021) 107274

[48] Z. Gao, H. Zhang, S. Dong, S. Sun, X. Wang, G. Yang, W. Wu, S. Li, V.H.C. [52] M. Melo, F. Mota, V. Albuquerque, A. Alexandria, development of a robotic
de Albuquerque, Salient object detection in the distributed cloud-edge airboat for online water quality monitoring in lakes, Robotics, 8, 19.
intelligent network, IEEE Netw. 34 (2020) 216–224. [53] D. Liska, E. Mah, T. Brisbois, P.L. Barrios, L.B. Baker, L.L. Spriet, Narrative re-
[49] T. Alladi, V. Chamola, N. Sahu, M. Guizani, Application of blockchain in view of hydration and selected health outcomes in the general population,
unmanned aerial vehicles: A review, Veh. Commun., Elsevier, Vol. 23, Nutrients 11 (1) (2019) 70.
article. 100249. [54] C.M. Bishop, Mixture Density Networks, Aston University, 1994.
[50] T. Alladi, V. Chamola, R. Parizi, K.K.R. Choo, Blockchain applications for [55] S. Mukherjee, D. Shankar, A. Ghosh, N. Tathawadekar, P. Kompalli, S.
industry 4.0 and industrial IoT: A review, IEEE Access, 7, pp. 176935 Sarawagi, K. Chaudhury, ARMDN: Associative and recurrent mixture
176951. density networks for eretail demand forecasting.
[51] G. Chalapathi, V. Chamola, A. Vaish, R. Buyya, Industrial internet of things
(IIOT) applications of edge and fog computing: A review and future
directions, arXiv preprint arXiv:1912.00595.

10

You might also like