Modelling the Formation of Virtual Buying Cooperatives with
Grammars of Regulated Rewriting
Suna Bensch
1
, Sigrid Ewert
2
and Mpho Raborife
2
1
Department of Computing Science, Ume
˚
a University, Ume
˚
a, Sweden
2
School of Computer Science and Applied Mathematics, University of the Witwatersrand, Johannesburg, South Africa
Keywords:
Coalition Formation, Virtual Buying Cooperative, Regulated Rewriting, Random Permitting Context Gram-
mar, Random Context Grammar.
Abstract:
In this paper we model virtual buying cooperatives (VBC) with grammars of regulated rewriting and show
that, if VBC relevant information is distributed over several successive VBC processes and must, in a later
stage, be synchronised and co-ordinated, the formal grammar needs to be very powerful with respect to mode
of derivation and thus generative capacity. In particular, we show how to model the supplier phase, invitation
phase, and declaration phase of a VBC with random permitting context grammars and the VBC reservation
phase with random context grammars under a special kind of leftmost derivation. If we use random permit-
ting context grammars for all processes, we can only model a VBC formation during which information is
introduced and processed locally and successively rather than being spread over different VBC processes.
1 INTRODUCTION
Cooperatives are generally goal-directed and have a
short lifespan; they are formed with a purpose and
dissolve when that purpose no longer exists and the
agents leave the cooperative (Horling and Lesser,
2005). They are most useful in situations where a
single organisation or business cannot perform a par-
ticular task or the efficiency of the task is increased
if more than one organisation or business performs it.
We consider cooperatives formed by physically dis-
tributed enterprises with the purpose of purchasing
items from a supplier as a single entity in a virtual
marketplace. The authors in (Ngassam and Raborife,
2013) term such a cooperative a virtual buying coop-
erative (VBC). Since a VBC acts as a single entity and
can buy a larger amount than an individual enterprise,
the VBC can negotiate favourable pricing.
In this paper we divide the VBC formation process
into four phases, supplier phase, invitation phase,
declaration phase and reservation phase and propose
that the reservation phase is guided by a purchasing
strategy that either promotes close business associ-
ations or a wide association distribution. The VBC
formation is basically the process during which enter-
prises invite their associates to participate in a VBC.
The VBC itself is the finally formed cooperative, that
is, the enterprises that purchase items from a supplier.
We model the formation of a VBC and the VBC it-
self with grammars and strings that these grammars
generate. Grammars or rewriting systems are genera-
tive devices that generate infinitely many strings in a
so-called language but are themselves finite represen-
tations. Grammars are a suitable tool for modelling
VBCs because they
describe the formation of a VBC as a generative
process reflecting the joint effort of all involved
enterprises,
generate infinite possibilities of VBC structures
(i.e. VBCs),
can easily be implemented, and
shed light on the structural conditions of a VBC
and thus can guide the implementation and re-
duce the costs for the actual technological devel-
opment.
An implementation of our grammar model should
enable the enterprises participating in a VBC, to
form the VBC cooperatively and according to
their needs and networks,
decide on a purchasing strategy for the VBC,
be able to see the current state of the VBC forma-
tion (e.g. the participating enterprises, the quan-
tity provided by the supplier), and
Bensch, S., Ewert, S. and Raborife, M.
Modelling the Formation of Virtual Buying Cooperatives with Grammars of Regulated Rewriting.
DOI: 10.5220/0006403700450055
In Proceedings of the 7th International Conference on Simulation and Modeling Methodologies, Technologies and Applications (SIMULTECH 2017), pages 45-55
ISBN: 978-989-758-265-3
Copyright © 2017 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
45
have proof of how many items an enterprise will
obtain once the overall quantity is purchased from
the supplier.
A technological realisation should take into ac-
count that in rural areas Internet is not always acces-
sible, but a text message based implementation would
let the isolated small enterprises communicate and
form the VBC via text messages. The content of such
text messages should contain information about the
current state of the VBC formation which is reflected
in our model as sentential forms during a derivation
process (explained in more detail later). We believe
that an implementation of our VBC model would en-
able such small businesses that operate in isolation to
access markets, to exploit current market opportuni-
ties in a virtual marketplace whilst maintaining their
autonomous business operations in the real world.
We model VBCs with grammars of regulated
rewriting and show that, if VBC relevant information
is introduced in different VBC formation phases and
must during the reservation phase be co-ordinated, the
grammars need to be very powerful with respect to
derivation mode and thus generative capacity. In par-
ticular, we show that the reservation phase requires
random context grammars under a special kind of
leftmost derivation, whereas supplier phase, invita-
tion phase, and declaration phase of a VBC can be
modelled with random permitting context grammars
(without leftmost restriction). Finally we show that, if
we only use random permitting context grammars to
model all four VBC phases, the VBC model will be
restricted, since information has to be processed “lo-
cally” and successively and cannot be spread across
the four phases.
2 RELATED WORK
The authors in (Ngassam and Raborife, 2013) con-
sider VBCs, that is, cooperatives formed by geo-
graphically distributed enterprises in a virtual market-
place. These enterprises meet at a virtual marketplace
and form cooperatives as and when needed based on
the items they are interested in. The enterprises pool
their buying power and negotiate a favourable pricing
based on the number of items that they will purchase.
Once they have made the purchase, the cooperative is
disbanded and another cooperative can be formed.
A VBC is especially beneficial to very small enter-
prises (VSEs) where the owners usually work in iso-
lation and are not connected to economically strong
regions and markets. Due to their small sizes, VSEs
do not buy significantly large amounts of goods and
this hinders their ability to fully aggregate demand
and negotiate discounted prices from their suppli-
ers. In emerging economies such as the Republic
of South Africa, VSEs are essential in driving eco-
nomic growth and creating employment (Ngassam
and Raborife, 2013). These businesses are crucial to
emerging economies but are usually operated in infor-
mal environments which are typically characterised
by poor infrastructure, poor inventory management,
bad working habits, and lack of direct access to mar-
kets. This leads to the exploitation of such enterprises
by their suppliers (Merz et al., 2007) (Merz, 2010).
The authors in (Mashkov et al., 2015) model coali-
tion formation as unselfish agents using Petri Nets.
We model the formation of a VBC and the VBC it-
self with random context grammars and one of their
variants. Various regulated rewriting grammars and
their languages and the motivations thereof are ex-
tensively described in (Dassow and P
˘
aun, 1989). We
choose random context grammars to model the VBC
formation since many actions during the formation
are context-dependent and the grammar formalism is
a relatively simple extension of the easy-to-handle
context-free grammars. Random context grammars
(rcgs) (van der Walt, 1972) belong to the class of
context-free grammars with regulated rewriting (Das-
sow and P
˘
aun, 1989), i.e., the productions of a gram-
mar are context-free, but are applied in a non-context-
free manner.
In rcgs, the application of a production at any step
in a derivation depends on the set of symbols that ap-
pear in the sentential form of the derivation at that
step. As opposed to context-sensitive grammars, the
context may be distributed in a random manner in the
sentential form. Context is classified as either per-
mitting or forbidding: permitting context enables the
application of a production, while forbidding context
inhibits it. When a grammar uses permitting context
only or forbidding context only, it is called a random
permitting context grammar (rPcg) or random forbid-
ding context grammar (rFcg), respectively. The corre-
sponding generated languages are called random per-
mitting context languages (rPcls) and random forbid-
ding context languages (rFcls).
The authors in (Dassow and P
˘
aun, 1989) showed
that rcgs without erasing productions lie strictly be-
tween the context-free and context-sensitive gram-
mars. When erasing productions are allowed, rcgs are
as powerful as the recursively-enumerable grammars.
It is not known whether rFcgs without erasing produc-
tion rules have an erasing equivalent. However, every
rPcg with erasing production rules has a non-erasing
equivalent (Zetzsche, 2010).
SIMULTECH 2017 - 7th International Conference on Simulation and Modeling Methodologies, Technologies and Applications
46
supplier phase
invitation phase
declaration phase
reservation phase
invitation tree
purchasing strategy
Figure 1: An illustration of the VBC formation process
divided into supplier phase, invitation phase, declaration
phase and reservation phase. The invitation phase is reg-
ulated by an invitation tree and the reservation phase is reg-
ulated by a chosen purchasing strategy.
3 VBC FORMATION
The formation of a VBC involves an enterprise
(termed the initiator enterprise) approaching a sup-
plier with the intent to purchase items (Ngassam and
Raborife, 2013). The supplier in turn replies with the
overall available quantity of the requested items. The
initiator enterprise then purchases items, and invites
selected associates, who in turn invite their associates,
etc., to join the VBC in order to purchase the items
from the supplier. In our model of a VBC formation
we deviate from (Ngassam and Raborife, 2013) as fol-
lows. The initiator enterprise approaches a supplier
that replies with the overall quantity of purchasable
items as in (Ngassam and Raborife, 2013) but the ini-
tiator enterprise does not necessarily get to purchase
before all other enterprises. Our model of VBC for-
mation, which is illustrated in Figure 1 consists of the
four following successive phases.
The first phase is the supplier phase in which the
supplier provides the quantity of goods that can be
purchased to a favourable pricing. The supplier phase
is followed by the invitation phase in which all en-
terprises that belong to a network of associates and
want to participate in the VBC are invited. In the
subsequent declaration phase all enterprises declare
how many items they would want to purchase. The
last phase is the reservation phase where enterprises
reserve the quantity of goods they will obtain after
the overall quantity is purchased from the supplier.
We suggest that the reservation phase (i.e. the actual
purchasing) in the VBC is regulated by a purchasing
strategy that is chosen after the declaration phase. We
propose two different strategies:
1. (Early strategy or E-strategy) Enterprises that
were invited at an earlier time step can purchase
items before enterprises that were invited at a
later time step. This reflects a purchasing strat-
egy where close associations or first-degree asso-
ciations are promoted.
2. (Maximal strategy or M-strategy) Maximize the
number of enterprises that purchase. This strategy
reflects a network-wide distribution of purchasing
opportunities to as many enterprises as possible.
One can think of other possible purchasing strate-
gies, including a mixture between E- and M-strategy.
In this paper we assume that a purchasing strategy
is chosen outside our model. Regardless of the pur-
chasing strategy, the difference between the number
of items provided by the supplier and the number of
items purchased by the VBC should be as small as
possible. This is in order to guarantee that the VBC
can negotiate a favourable pricing. Moreover, the to-
tal number of items purchased by members of the
VBC cannot be more than the quantity made avail-
able to them by the supplier. In our model the four
phases of a VBC and the results thereof are explicitly
modelled as generative processes. We will construct
grammar fragments for all four phases. The supplier
phase is part of our model and represents the supplier
providing the available overall quantity of goods. For
the subsequent invitation phase we assume the follow-
ing:
The VBC formation starts with a given network
graph. A network graph represents a network of
associates and is represented as a graph. A net-
work graph is finite and predetermined at the start
of a VBC formation. Network graphs can be ex-
tended by adding new enterprises to the network
(but not during a VBC formation).
Enterprises can invite as many associates from
their network as desired, regardless of whether the
invited associates are interested in purchasing or
not, or whether they invite other associates or not.
An enterprise may only be invited once.
During the invitation phase an invited enterprise
can either invite other enterprises from its network or
not invite any further enterprises. During the declara-
tion phase an invited enterprise can either declare the
amount it wants to purchase or opt out of the VBC by
not declaring items. During the reservation phase and
after a purchasing strategy has been chosen, we model
the binding allocation of goods to the enterprises that
have chosen to purchase. The reservation phase is the
part of the coalition formation that requires grammars
with high generative capacity to model, since the co-
ordination of information must be modelled with de-
vices that have the capacity to keep track of informa-
tion distributed over several phases.
Modelling the Formation of Virtual Buying Cooperatives with Grammars of Regulated Rewriting
47
4 DEFINITIONS AND
PRELIMINARIES
Let N denote the integers, and N
+
= {1, 2,.. .}. An
alphabet is a finite set of symbols. A word over an
alphabet Σ is a finite ordered list of symbols chosen
from the set Σ. A language L is a set of words over
some alphabet (Xavier, 2005).
Definition 1. (Ewert and Van der Walt, 2002)
A random context grammar (rcg) is a quadruple
G = (V
N
,V
T
,P, S), where
1. V
N
is a finite set of non-terminals,
2. V
T
is a finite set of terminals,
3. P is a finite set of productions of the form
A x (P ; F ),
where A V
N
, x (V
N
V
T
)
and P , F V
N
, and
4. S V
N
is the start symbol.
Let V denote V
N
V
T
. For two strings y
1
,y
2
V
and a production A x (P ;F ) in P, we may write
y
1
Ay
2
= y
1
xy
2
if every B P is in the string y
1
y
2
and no B F is in the string y
1
y
2
. We refer to
y
1
Ay
2
= y
1
xy
2
as a derivation step and to the strings
y
1
Ay
2
, y
1
xy
2
as sentential forms. The reflexive and
transitive closure of = is denoted by
=. The lan-
guage generated by a grammar G is defined as
L(G) = {w | w V
T
and S
= w}.
A random permitting context grammar (rPcg) is
a random context grammar G = (V
N
,V
T
,P, S), where
for each production A x (P ; F ) P, F =
/
0. A ran-
dom forbidding context grammar (rFcg) is a random
context grammar G = (V
N
,V
T
,P, S), where for each
production A x (P ; F ) P, P =
/
0. A context-
free grammar (cfg) is a random context grammar
G = (V
N
,V
T
,P, S), where P = F =
/
0 for each produc-
tion A x (P ; F ) P. A language is context-free,
random permitting context, random forbidding con-
text, or random context if it is generated by a context-
free, random permitting context, random forbidding
context, or random context grammar respectively. In
the remainder of this paper, we write A x instead
of A x(
/
0;
/
0), if the permitting and forbidding con-
text are empty sets. If a context consists only of one
element, we write A instead of {A}.
Example 1. Let G = ({S,A, B,C},{a, b, c},P, S),
where P is given by
{S ABC,
A aA
0
(B;
/
0),
B bB
0
(C;
/
0),
C cC
0
(A
0
;
/
0),
A
0
A(B
0
;
/
0),
B
0
B(C
0
;
/
0),
C
0
C(A;
/
0),
A a(B;
/
0),
B b(C;
/
0),
C c}.
The generated language is L(G) = {a
n
b
n
c
n
| n 1}.
The derivation starts with rewriting S with the first
rule and we obtain the sentential form ABC. Now the
second and third are applicable, each of which intro-
duces an A
0
or B
0
into the sentential form. After, for
example, applying the second and third rule we ob-
tain the sentential form aA
0
bB
0
C. Then the fourth rule
is applied (since there is an A
0
in the sentential form)
and we obtain the sentential form aA
0
bB
0
cC
0
. Note
that at this point of the derivation process the fifth
rule as well as the sixth rule can be applied. If we,
at this point, would apply the sixth rule we would ob-
tain the sentential form aA
0
bBcC
0
and the fifth rule
would not be applicable since the symbol B
0
does not
occur in the sentential form. In fact, such a deriva-
tion would block and never complete since no rule
could be applied. So, after obtaining the sentential
form aA
0
bB
0
cC
0
as described above, we apply the fifth,
sixth, seventh rule and obtain aA
0
bB
0
cC
0
aAbBcC.
After this we start the first cycle again (applying sec-
ond, third, fourth rule again) or terminate the deriva-
tion by using the last three rules. We can generate all
strings consisting of an equal number of occurrences
of a, b, and c.
5 RANDOM PERMITTING
CONTEXT GRAMMARS
In this section we construct successively fragments of
an rPcg for the supplier phase, invitation phase, decla-
ration phase and reservation phase and show that the
reservation phase cannot be described by an rPcg. We
illustrate the modelling with the Examples 2, 3, 4, and
5.
Let q 1 be the number of enterprises participat-
ing in the VBC. The language that we want to gener-
ate is L
VBC
and reflects the outcomes of the supplier
phase, invitation phase, declaration phase, and reser-
vation phase. We divide a string in L
VBC
by the des-
ignated symbol $, where to the left of the $ symbol
invitation and declaration are represented and to the
right of $ the reservation and supplier phase are rep-
resented. L
VBC
is defined as:
SIMULTECH 2017 - 7th International Conference on Simulation and Modeling Methodologies, Technologies and Applications
48
A
B
C
D E
F
G
Figure 2: The graph represents a network of associates.
Each node label corresponds to a name of an enterprise and
an edge connecting a node n
1
with a node n
2
represents that
the enterprises at n
1
and n
2
are associates.
L
VBC
= {a
n
1
b
n
2
c
n
3
.. . q
n
q
ˆ
$a
m
1
b
m
2
c
m
3
.. . q
m
q
x
k
|
for1 i q, m
i
= n
i
or 0,n
i
1, k 0}.
The non-context-free language L
VBC
reflects the
VBC formation and the VBC itself (that is, the enter-
prises that will purchase goods and were selected by
a purchasing strategy). The letters a, b,. . ., q repre-
sent different enterprises and the number of their oc-
currences (n
1
occurrences of a, n
2
occurrences of b,
etc.) represent the quantity of goods they declared
(i.e. would want to buy). To the right of the
ˆ
$ symbol
we represent the enterprises that will purchase goods,
possibly followed by some letters x representing items
provided by the supplier that the VBC will not buy.
In particular, a string in the language represents the
result of the invitation phase and declaration phase to
the left of the symbol
ˆ
$ and the reservation to the right
of the symbol
ˆ
$. In what follows, we describe how a
random permitting context grammar G is constructed
to describe the phases up to the reservation phase.
We assume there exists a network of associates
represented by a graph. Let the network graph in Fig-
ure 2 represent such a network of associates, where
A is the name of the initiator enterprise. Each node
label corresponds to a name of an enterprise and an
edge connecting a node n
1
and a node n
2
represents
that the enterprises at nodes n
1
and n
2
are associates.
In Figure 2, for example, enterprise A is linked with
enterprises B, C, D, E and G and enterprise B is linked
with its associates A, C and E, etc.
Assume the network graph N in Figure 2 as
given. We start with modelling the initiator enter-
prise approaching the supplier and the supplier pro-
viding the overall quantity that the VBC can purchase.
To this end, we construct a fragment of our rPcg
G = (V
N
,V
T
,P, S) as follows.
Example 2. We construct rules of the following
form: S A
0
A
inv
X
0
, X
0
X
0
X, X
0
$, where
A
0
,A
inv
,X
0
,X ,$ V
N
. The first rule rewrites the start
symbol and is applied once, representing the initiator
approaching the supplier. The second rule is applied
as many times as the total number of purchasable
items the supplier is providing and the third rule is ap-
plied once, indicating that the supplier provided a to-
tal number of items and that the supplier phase ended.
After applying these three initial rules and assuming
that the supplier provides ten items, we have a sen-
tential form of the following form (representing the
result of the supplier phase):
A
0
A
inv
$XXXX XXXXX X.
Now the invitation phase begins where the initia-
tor enterprise begins inviting its associates. Note that
a network graph represents the entire network of en-
terprises, not necessarily the enterprises that are in-
vited to join a VBC. Moreover, note that from a net-
work graph one cannot see when and which enter-
prises invited which enterprises. Therefore, given a
network graph N, we construct an invitation tree θ
according to the sequence of invitations and then con-
struct production rules for G. Since the initiator en-
terprise and all other invited enterprises must not be
invited again (by other enterprises at a later time), the
set of node labels (i.e. enterprises) in an invitation
tree θ are distinct. We construct the invitation tree
such that a node labelled with a nonterminal symbol
is never introduced more than once. The Algorithm 1
constructs an invitation tree θ from a given network
graph N according to the sequence of invitations.
Algorithm 1. Input: A network graph N. Output:
An invitation tree θ with n tree layers for the sequence
of invitations. Method: Construct an invitation tree θ
as follows:
Let the initiator A label the root of θ and denote it
tree layer L
0
.
For each tree layer L
i
, 0 i n and for each sym-
bol A
1
,A
2
,. . ., A
k
in L
i
do
for A
j
, 1 j k inviting associates
B
1
,B
2
,. . ., B
l
j
do
for all B
l
, 1 l l
j
not occurring in any tree
layer L
g
, 0 g i do
let B
1
,B
2
,. . ., B
l
j
, 1 l l
j
be the children of
A
j
.
Denote the resulting layer L
i+1
.
As an example, assume that enterprise A invites B
and C and that B invites E and C invites G. Then θ is
as illustrated in Figure 3.
Given an invitation tree θ we construct the rules
for the invitation phase. The invitation rules are of the
form A
ˆ
ˆ
AB
A
C
A
.. . G
A
A
inv
B
inv
.. . G
inv
. This rule re-
flects that enterprise A invited enterprises B,C, ... ,G
Modelling the Formation of Virtual Buying Cooperatives with Grammars of Regulated Rewriting
49
A
B
C
E
G
Figure 3: An invitation tree θ representing that enterprise A
invites B and C, that B invites E and that C invites G.
by the subscript A on the nonterminals. The nontermi-
nals with the subscript “inv” give the respective enter-
prises the opportunity to invite their associates. The
Algorithm 2 constructs the invitation rules with per-
mitting context.
Algorithm 2. Input: An invitation tree θ. Output:
Invitation rules with permitting context. Method:
Construct the invitation rules as follows:
If the root of θ is labelled by A and A
1
,A
2
,. . ., A
k
occur in layer L
1
as children nodes of A do
add the rule
A
inv
ˆ
ˆ
AA
1
A
A
2
A
.. . A
k
A
A
1
inv
A
2
inv
.. . A
k
inv
($;
/
0)
to P.
For all tree layers L
i
, 1 i n and all symbols
A
j
, 1 j l occurring in L
i
do
for j = 1 add a rule
A
1
inv
ˆ
ˆ
A
1
B
1
A
1
B
2
A
1
.. . B
p
A
1
B
1
inv
B
2
inv
.. . B
p
inv
(
ˆ
ˆ
A
;
/
0)
to P, where B
f
, 1 f p, are the children of
node A
1
in L
i+1
and
ˆ
ˆ
A is (the rightmost) A
l
oc-
curring in layer L
i1
.
for j = 2, . .. , l add a rule
A
j
inv
ˆ
ˆ
A
j
C
1
A
j
C
2
A
j
.. .C
r
A
j
C
1
inv
C
2
inv
.. .C
r
inv
(
ˆ
ˆ
A
j1
;
/
0)
to P, where C
g
, 1 g r, are the children of
node A
j
in L
i+1
.
If a node A has no children we add the rule
A
inv
ˆ
ˆ
A(
ˆ
ˆ
Y,
/
0)
to P, where
ˆ
ˆ
Y is either (the rightmost) A
l
occur-
ring in the previous layer L
i1
or
ˆ
ˆ
A
j1
.
For the rightmost Z in the last layer L
n
that has
no children add the rule
Z
inv
ˆ
ˆ
Z#(
ˆ
ˆ
Y,
/
0)
to P, where
ˆ
ˆ
Y is either (the rightmost) A
l
occur-
ring in the previous layer L
i1
or
ˆ
ˆ
A
j1
.
The nonterminal symbols of the form
ˆ
ˆ
A are intro-
duced in order to keep track of the order of the invi-
tations, because no enterprise invited at a later stage
should be able to act prior to an enterprise that was
invited before. Note how the permitting context of
ˆ
ˆ
A
nonterminals is simply carried over to the next layer
in a tree or to a sister node to the right in a layer. The
symbol # indicates that the invitation phase ended.
For our example, the following rules would be
constructed.
Example 3. We construct
A
inv
ˆ
ˆ
AB
A
C
A
B
inv
C
inv
($;
/
0),
B
inv
ˆ
ˆ
BE
B
E
inv
(
ˆ
ˆ
A;
/
0),
C
inv
ˆ
ˆ
CG
C
G
inv
(
ˆ
ˆ
B;
/
0),
E
inv
ˆ
ˆ
E(
ˆ
ˆ
C;
/
0),
G
inv
ˆ
ˆ
G#(
ˆ
ˆ
E;
/
0).
Applying the rules in our running example we ob-
tain the sentential form:
A
0
ˆ
ˆ
AB
A
C
A
ˆ
ˆ
BE
B
ˆ
ˆ
E
ˆ
ˆ
CG
C
ˆ
ˆ
G#$XXXX XXXXX X.
In the declaration phase all invited enterprises that
want to buy items declare how much they would want
to buy. For this, we introduce for all nonterminal sym-
bols with a subscript and for A
0
, simple recursive rules
that are applied as many times as the number of the
items that the respective enterprise wants to purchase.
For A
0
we introduce A
0
A
0
A(#;
/
0) and A
0
A(#;
/
0)
and for a nonterminal symbol A
B
we introduce rules
of the form A
B
A
B
A
B
. For an enterprise A
B
that
does not want to purchase anything, we introduce a
rule of the form A
B
A
B
OO
the subscript OO standing
for “opt out”. The rules for the declaration phase (ex-
cept the initiator rules) are context-free, since a (left-
most) ordering on the declaration of goods does not
matter.
Now we introduce rules that delete all nontermi-
nals A in the sentential form that are marked with
ˆ
ˆ
A
or the subscript OO. Note that this is a simple design
choice that can be made as desired. We make this
design choice to simplify the formalisation and for
better readability of the paper. In case terminal sym-
bols a are marked with ˆa or the subscript OO, the lan-
guage L
VBC
must be changed accordingly. We intro-
duce for all nonterminals of the form
ˆ
ˆ
A and A
B
OO
the
rules
ˆ
ˆ
A λ(#;
/
0) and A
B
OO
λ(#;
/
0), respectively.
Example 4. In our example we assume that the en-
terprises A, B and E want to purchase five items each
and that enterprises C and G opt out. Applying the
rules, that we construct as explained above, we ob-
tain the following sentential forms:
SIMULTECH 2017 - 7th International Conference on Simulation and Modeling Methodologies, Technologies and Applications
50
A
0
ˆ
ˆ
AB
A
C
A
ˆ
ˆ
BE
B
ˆ
ˆ
E
ˆ
ˆ
CG
C
ˆ
ˆ
G#$XXXX XXXXX X
A
5
B
5
A
C
A
OO
ˆ
ˆ
BE
5
B
ˆ
ˆ
E
ˆ
ˆ
CG
C
OO
ˆ
ˆ
G#$XXXX XXXXX X
A
5
B
5
A
E
5
B
#$XXXX XXXXX X.
After the declaration phase a purchasing strategy
is chosen outside our model. The chosen purchasing
strategy determines which enterprises may purchase
items. After the declaration phase (and deleting the
marked nonterminals) we obtain sentential forms of
the form: A . .. AB .. . BC ...C . . .#$X ...X indicating
the quantity each enterprise would want to purchase
to the left of the symbol $ and the quantity provided
by the supplier to the right of the symbol $.
Note that in order to obtain a string in the language
L
VBC
, we would have to rewrite the leftmost nonter-
minal on the left side of the symbol $ and then we
would have to rewrite the leftmost nonterminal X on
the right side of the symbol $. We basically would
need to walk across the sentential form and back. In
the following we argue that such a mode of derivation
cannot be encoded in the permitting context, but that
we need forbidding context too. This kind of rcg with
a special kind of leftmost restriction is investigated
in (Dassow and P
˘
aun, 1989) (leftmost restriction II,
page 54). In this leftmost restriction at each step of
a derivation the leftmost occurrence of a nonterminal
in a sentential form which can be rewritten has to be
rewritten. It is shown that the generative capacity of
rcg with this kind of leftmost restriction is consider-
ably increased (they generate recursively-enumerable
languages) (see Theorem 1.4.4 in (Dassow and P
˘
aun,
1989)). If no deleting rules are used, rcg with this left-
most restriction generate context-sensitive languages.
A simpler form of leftmost restriction in which at each
step of a derivation the leftmost occurrence of a non-
terminal has to be rewritten, decreases the generative
capacity to context-free.
Lemma 1. Given a sentential form of the form
w = A .. . AB. . .BC . . .C . .. #$X . .. X, there is no rPcg
that alternates between rewriting the leftmost nonter-
minal of the left hand side of $ and the leftmost non-
terminal of the right hand side of $.
Proof idea 1. Assume that there exists such an rPcg.
Then there exists a rule of the form A α(X;
/
0),
α (V
N
V
T
)
to rewrite the leftmost nonterminal in
w. Then there exists a rule the second nonterminal
A in w from being replaced. One way to do this is a
rule of the form A α
0
(Y ;
/
0), where Y is a nonter-
minal that is introduced by a rule that rewrites X, i.e.
X
ˆ
αY (K;
/
0) for some K V
N
. Then we have the
following rules
r
1
: A α(X ;
/
0) and r
2
: A α
0
(Y ;
/
0).
Thus, the first two A in the sentential form w must
be distinct, otherwise r
1
is applicable to the second
nonterminal A immediately after the first A has been
replaced (i.e. not the derivation we want). Extend-
ing this discussion in a similar fashion, we conclude
that all nonterminals to the left hand side of $ must be
distinct. A similar discussion holds for the nontermi-
nals X to the right of $. Then w consists of distinct
nonterminals and we can build a regular grammar
that rewrites w into a regular string w
0
L
VBC
, which
shows the contradiction.
6 RANDOM CONTEXT
GRAMMARS
Thus, at this point we know that random permitting
grammars are not powerful enough to model the reser-
vation phase. We can however construct a random
context grammar and impose the leftmost restriction
II described above in order to model the reservation
phase. The Algorithm 3 constructs rcg production
rules describing the reservation phase.
Algorithm 3. Input: An invitation tree θ. Output:
Reservation rules with permitting and forbidding con-
text. Method: Construct the reservation rules as fol-
lows:
Let A
1
,A
2
,. . ., A
k
be the enterprises that have
been chosen by the E-strategy or M-strategy.
For every A
i
, 1 i k do
Construct for A
1
the following rules:
A
1
a
1
ˆ
A
1
(X;{
ˆ
A
1
,
ˆ
X
A
1
})
X a
1
ˆ
X
A
1
(
ˆ
A
1
;
ˆ
X
A
1
)
ˆ
A
1
λ(
ˆ
X
A
1
;
/
0)
ˆ
X
A
1
λ(
/
0;
ˆ
A
1
)
where
ˆ
A
1
and
ˆ
X
A
1
are newly introduced nontermi-
nal symbols in V
N
.
Construct for all other A
i
, j = 2,. .. , k, the follow-
ing rules
A
i
a
i
ˆ
A
i
(X;{A
i1
,
ˆ
A
i1
,
ˆ
X
A
i1
,
ˆ
A
i
})
X a
i
ˆ
X
A
i
(
ˆ
A
i
;
ˆ
X
A
i
)
ˆ
A
i
λ(
ˆ
X
A
i
;
/
0)
ˆ
X
A
i
λ(
/
0;
ˆ
A
i
)
where
ˆ
A
i
and
ˆ
X
A
i1
are newly introduced nonter-
minal symbols in V
N
.
Modelling the Formation of Virtual Buying Cooperatives with Grammars of Regulated Rewriting
51
For all other nonterminals B on the left hand side
of $ representing enterprises that were not cho-
sen by a purchasing strategy create the following
rules:
B b.
Add X x(
/
0;γ) to P to finally replace possible
nonterminals X, where
γ = {A
1
,A
2
,. . ., A
k
,
ˆ
A
1
,
ˆ
A
2
,. . .,
ˆ
A
k
,
ˆ
X
A
1
,
ˆ
X
A
2
,. . .,
ˆ
X
A
k
}.
Add the rules # λ($;
/
0) and $
ˆ
$(
/
0;#) to P,
ˆ
$ V
T
.
Example 5. Suppose that, in our running example,
the E-strategy determined that the two enterprises A
and B were chosen to purchase items. Then, the fol-
lowing rules would be constructed:
A a
ˆ
A(X;{
ˆ
A,
ˆ
X
A
}),
X a
ˆ
X
A
(
ˆ
A;
ˆ
X
A
),
ˆ
A λ(
ˆ
X
A
;
/
0),
ˆ
X
A
λ(
/
0;
ˆ
A),
B
A
b
ˆ
B
A
(X;{A,
ˆ
A,
ˆ
X
A
,
ˆ
B
A
}),
X b
ˆ
X
B
A
(
ˆ
B
A
;
ˆ
X
B
A
),
ˆ
B
A
λ(
ˆ
X
B
A
;
/
0),
ˆ
X
B
A
λ(
/
0;
ˆ
B
A
),
X x(
/
0;{A, B,
ˆ
A,
ˆ
B,
ˆ
X
A
,
ˆ
X
B
A
}),
E
B
e.
Corollary 1. A rcg modelling a VBC and its four
phases has to work in leftmost restriction II.
Figure 4 illustrates the information that we obtain
after each phase. The information is represented in
the sentential forms that our grammar generates. In
Figure 4 the sentential forms are generalised to the
following two parts: left of the $ symbol and right of
the $ symbol.
7 VBC MODEL CHANGE
If we want to generate L
VBC
with random permitting
context grammars, we have to change the ordering
of the phases in our VBC model and thus the VBC
model itself. We generate the information to the left
of the $ symbol and the information to the right of $
successively with chain rules. In order to be able to
control the rewriting we have to have a constant num-
ber of nonterminals in each sentential form and we
have to build chain rules accordingly. By our previ-
ous discussion we know that the occurrences of the
supplier phase
AAA . . . AAA$XXX . . . XXX
quantity supplied items
invitation phase
AAA . . . AAA$XXX . . . XXX
who invited whom
quantity supplied items
declaration phase
AAA . . . AAA$XXX . . . XXX
quantity supplied itemswho invited whom,
who wants how much
reservation phase
AAA . . . AAA$XXX . . . XXX
quantity supplied items,
who gets how much
who invited whom,
who wants how much
Figure 4: The information that we obtain after each phase
represented as generalised sentential forms. The sentential
forms are divided into left of $ and right of $ and are de-
picted as AAA.. .AAA$XXX ... XXX. Beneath each left and
right part we explain what kind of information is conveyed.
nonterminals X cannot be matched against the occur-
rences of the nonterminals to the left of $ with only
permitting context. Therefore, we cannot initiate a
VBC with letting the supplier provide the quantity of
purchasable items. Instead the phases of the changed
VBC model are the following. Each enterprise partic-
ipating in the VBC (starting with the initiator)
declares the quantity of goods it wants to purchase
to the left and to the right of $ symbol, and then
invites its associates from its network.
After the declaration and invitation phases, the pur-
chasable quantity provided by the supplier is inquired
and a purchasing strategy is chosen accordingly out-
side the grammar model. Once the enterprises are
determined by the E-strategy or M-strategy a string
in L
VBC
is generated. In this alternative VBC model
the declaration phase and invitation phase alternate
for each enterprise that is invited to join the VBC.
This process is illustrated in Figure 5 for n enterprises.
Moreover, Figure 5 shows that after all enterprises de-
clared and invited their associates, the supplier pro-
vides purchasable items. Depending on the formed
VBC and chosen purchasing strategy, the process fi-
nally leads to a deal or non-deal.
Algorithm 4 generates the fragments of the rPcg
for the declaration phase and invitation phase. Some
of the design choices can be made differently but the
SIMULTECH 2017 - 7th International Conference on Simulation and Modeling Methodologies, Technologies and Applications
52
declaration phase for enterprise A
1
invitation phase for enterprise A
1
.
.
.
declaration phase for enterprise A
n
invitation phase for enterprise A
n
invitation tree
invitation tree
supplier phase
deal or non-deal
purchasing strategy
Figure 5: An illustration of the individual processes of the
alternative and restricted VBC model.
quintessence is that information cannot be distributed
over several phases and co-ordinated later, but has to
be introduced rather locally.
Algorithm 4. Input: An invitation tree θ. Output:
Production rules for the declaration and invitation
phase for each enterprise participating in the alter-
native VBC model. Method: Construct the rules as
follows:
Let S A$X
A
be a rule.
For each tree layer L
i
, 0 i n and for each sym-
bol A
1
,A
2
,. . ., A
k
in L
i
do
for A
j
, 1 j k construct declaration rules as
follows
A
j
A
j
A
0
j
(X
A
j
;
/
0)
X
A
j
X
A
j
X
0
A
j
(A
0
j
;
/
0)
A
0
j
A
j
(X
0
A
j
;
/
0)
X
0
A
j
X
A
j
(A
j
;
/
0)
for A
j
, 1 j k inviting associates
B
1
,B
2
,. . ., B
l
j
construct the following rules
A
j
B
1
B
2
.. . B
l
j
X
A
j
X
B
1
X
B
2
.. . X
B
l
j
({B
1
B
2
.. . B
l
j
};
/
0)
for the leaf nodes A in θ construct the following
rules
A λ
Note that the rules have to be applied in the or-
der they are constructed in Algorithm 4, since other-
wise the derivation blocks. After applying rules con-
structed in Algorithm 4 we obtain a sentential form of
the form (here simplified for better readability):
A
n
1
B
n
2
.. . $X
n
1
A
X
n
2
B
.. .
Once a purchasing strategy is chosen after con-
sultation with the supplier about the quantity of pur-
chasable goods, context-free rules can be generated as
outlined in Algorithm 5.
Algorithm 5. Input: A sentential form w result-
ing from the declaration and invitation phase and
the chosen enterprises by the purchasing strategy.
Output: Production rules for terminating the deriva-
tion. Method: Construct the rules as follows:
Let w = A
n
1
B
n
2
.. . Z
n
p
$X
n
1
A
X
n
2
B
.. . X
n
p
Z
.
Construct for all nonterminals A
j
occurring to the
left of $ rules of the form
A
j
a
j
Construct for all chosen enterprises B
j
rules of
the form
X
B
j
b
j
Construct for all other nonterminals X occurring
on the right hand side of $ the following rules:
X λ
8 CONCLUSIONS
We showed how to model the supplier phase, invi-
tation phase, and declaration phase of a VBC with
random permitting context production rules. Then
we argued that to model the VBC reservation phase
we need random context grammars under a special
kind of leftmost derivation. If we interpret the mod-
elling from an information distribution and coopera-
tion view, then we showed that if VBC relevant in-
formation is distributed over supplier phase, invita-
tion phase and declaration phase and must during the
reservation stage be synchronised and co-ordinated,
the formal grammar needs to be very powerful with
respect to mode of derivation and thus generative ca-
pacity. From a perspective of representing the enter-
prises and the supplier as agents, this model is ad-
equate as the VBC formation is a process in which
several agents cooperate and synchronise informa-
tion. In particular, we need rcgs that work under
a special kind of leftmost restriction and generate
Modelling the Formation of Virtual Buying Cooperatives with Grammars of Regulated Rewriting
53
recursively-enumerable languages (see (Dassow and
P
˘
aun, 1989)).
If we use random permitting context grammars for
all processes, we can only model a VBC formation
during which information is introduced and processed
locally and successively rather than being spread over
the different VBC processes. Thus, supplier phase,
invitation phase, declaration phase and reservation
phase have to be altered and have to be synchronised
in a more local and successive way. In this alternative
model, the supplier is not part of the model, which
may have its benefits, as the enterprises act instead of
react to a supplier offer. A disadvantage is that VBCs
may be formed without making a purchase in the end
(e.g. if the quantity the VBC wants to purchase does
not coincide with the quantity provided by the sup-
plier). Finally, the alternative VBC model discussed
in Section 7 does not achieve that all enterprises are
able to see what is happening and has happened dur-
ing the VBC formation (e.g. the amount of available
goods, the enterprises participating, etc.), which is an
unfavourable position for the very small enterprises
working in isolation.
We see the two main benefits of our approach,
that is, modelling the VBC and the VBC formation
with grammars of regulated rewriting, as the follow-
ing. One is that grammars model generative processes
and the formation of a VBC is a generative process
that involves several enterprises, which can actively
participate in the formation. A model of such a gen-
erative process can shed light on the structural condi-
tions of a VBC and can thus guide an implementation
(as we have shown in this paper).
The second main benefit is that once an adequate
model is found, one can draw many implications from
the rich mathematical theory behind regulated rewrit-
ing. One example is the observation that we showed
in this paper, namely if we restrict the grammar model
we cannot model the four successive phases of a
VBC formation and if we want an adequate model
we have to have more powerful grammars (in terms
of lifting the rewriting mode to a specific leftmost
restriction). Another example is parsing. A pars-
ing algorithm decides first if an input string w is in
a certain formal language L and then assigns a struc-
tural representation to w (i.e. a derivation tree). A
parsing algorithm can be useful in a VBC context
if several enterprises a
1
,. . .a
l
want to form a VBC
(independent of the four successive VBC formation
phases). These enterprises would, for instance, in-
put a string w = a
n
1
1
.. . a
n
l
l
$a
n
1
1
.. . a
n
l
l
in which the
quantity of the items that each participating enter-
prise wants to purchase is represented and let the pars-
ing algorithm decide whether w L (representing the
question whether it is possible for those enterprises
to form that specific VBC). Structural representations
from parsing might give further insights into the VBC
structure. This is a more bottom-up approach differ-
ing from the top-down approach that we described in
this paper. An interesting observation in this context
is that the restricted VBC model, even though it does
not model the four successive phases, might be more
useful due to more efficient parsing algorithms.
Other mathematical properties such as closure
properties for certain formal languages may be use-
ful in situations in which two networks of different
enterprises want to combine into a larger network.
Can we in such a situation use the same grammar for-
malisms? Or does joining two networks and their re-
spective grammars lead beyond the grammar model?
Apart from investigating mathematical properties
relevant for VBCs (e.g. parsing, closure), future work
will also focus on implementations of the two VBC
model approaches presented in this paper and on eval-
uations with respect to efficiency of the VBC forma-
tion process, number of closed deals, and user (i.e.
enterprise) satisfaction. In the context of implementa-
tion, one interesting question is how to translate natu-
ral language text into the respective grammar rules or
sentential forms and vice versa.
REFERENCES
Dassow, J. and P
˘
aun, G. (1989). Regulated Rewrit-
ing in Formal Language Theory, volume 18 of
EATCS Monographs on Theoretical Computer Sci-
ence. Springer-Verlag.
Ewert, S. and Van der Walt, A. (2002). A pumping lemma
for random permitting context languages. Theoretical
Computer Science, 270:959–967.
Horling, B. and Lesser, V. (2005). A survey of multi-agent
organizational paradigms. The Knowledge Engineer-
ing Review, 19(4):281–316.
Mashkov, V., Barilla, J., Simr, P., and Bicanek, J. (2015).
Modeling and simulation of coalition formation. In
Proceedings of the 5th International Conference on
Simulation and Modeling Methodologies, Technolo-
gies and Applications (SIMULTECH 2015), pages
329–336.
Merz, C. (2010). Incubating micro enterprises in rural South
Africa - The use case of virtual buying cooperatives.
In ICT for the Next Five Billion People, pages 35–45,
Berlin, Germany. Springer Berlin Heidelberg.
Merz, C., de Louw, R., and Ullrich, N. (2007). Collabora-
tive working environments for enterprise incubation:
The Sekhukhune rural living lab. In Proceedings of
IST Africa, pages 173–186, Maputo, Mozambique.
Ngassam, E. and Raborife, M. (2013). Virtual Buying
Cooperative: A procurement model for improving
the sustainability of very small retailers in emerging
SIMULTECH 2017 - 7th International Conference on Simulation and Modeling Methodologies, Technologies and Applications
54
economies. In Proceedings of IST Africa, Nairobi,
Kenya.
van der Walt, A. P. J. (1972). Random Context Languages.
Information Processing, 71:66–68.
Xavier, S. (2005). Theory of Automata, Formal Languages
and Computation. New Age International Pvt Ltd
Publishers.
Zetzsche, G. (2010). On erasing productions in random
context grammars. In Automata, Languages and
Programming, 37th International Colloquium, ICALP
2010, Proceedings, Part II, pages 175–186.
Modelling the Formation of Virtual Buying Cooperatives with Grammars of Regulated Rewriting
55