Information Technology Reference
In-Depth Information
If cooperating algorithms
Al
g
1
and
Al
g
2
are mutually autonomous, then solving
a problem
x
0
with these algorithms does not cause any difficulties, as shown earlier.
However, a problem arises when the cooperating, component algorithms are not
autonomous. It results from the fact that the algorithm
Al
g
1
(properly
Al
g
2
) needs
but has no access to the internal (local) data of the algorithm
Al
g
2
(properly
Al
g
1
),
so it is unable to read the value of variables which are essential for the calculation
of its function
f
1
(properly
f
2
) and for making the next step (Fig.
2.11
).
However, there are possibilities of ensuring access of the algorithm
Al
g
1
(properly
Al
g
2
) to the internal (local) data of the algorithm
Al
g
2
(properly
Al
g
1
). It comes
down to the replacement of algorithms which are mutually non-autonomous with the
algorithms that gain autonomy to some extent, which will be presented further.
Twomethods may be consideredwhich enable access of one algorithm to the inter-
nal (local) data of the other algorithm, that is to say that non-autonomous algorithms
are replaced with autonomous algorithms:
•
with the use of
communication process
between the algorithms,
•
with the use of
observation operation
of action of one algorithm (behaviour) by
the other algorithm.
These methods are presented in later parts of the monograph.
2.5.2.1 The Application of a Communication
Process Between the Algorithms
The application of a communication process enabling access to the internal data
of an algorithm was the underlying reason for introduction of the term of object
was introduced [180]. This term has been known and used for many years in the
algorithm formation and programming technique and especially in object-oriented
programming [67, 68].
The communication process between the algorithms that was used here enables
access to the internal data of an algorithm.
Let us consider the algorithms
Al
g
1
and
Al
g
2
which use the method of commu-
nication (Fig.
2.12
). The algorithms communicating in this particular way will be
referred to as objects (
Obj
1
=
(
).
The process of communication may proceed according to the following scenario:
X
1
,
f
1
)
and
Obj
2
=
(
X
2
,
f
2
)
•
Let us accept that the component algorithm (object)
Obj
1
needs for the calcula-
tion of the function
f
1
access to the parameters
X
2
, being the internal data of the
algorithm (object)
Obj
2
. It constitutes the fundamental difficulty in defining the
next steps changing the state of the object
Obj
1
.
•
In order to receive the necessary data—the object
Obj
2
may make its internal
parameters accessible for the calculation of the function
f
1
of the object
Obj
1
with the use of mechanism referred to as a
method
. The object
Obj
1
starts up the
appropriate method (the
method
1
2
) of the object
Obj
2
(Fig.
2.12
a, dashed arrow).