Implementation of an agent-based model for studying the acquisition of language systems of logical constructions
Abstract
Este proyecto analiza algunos experimentos de lingüística evolutiva y propone una implementación básica de un modelo basado en agentes existente para el estudio de la adquisición de sistemas de lenguaje sobre construcciones lógicas que puede ser usada por otros investigadores.
Full text
Implementation of an agent-based model for studying the acquisition of language systems of logical constructions by Joan Ginés i Ametllé Submitted to Facultat d’Informàtica de Barcelona (FIB) Universitat Politècnica de Catalunya (UPC) ·BarcelonaTech in partial fulfilment of the requirements for the Bachelor’s Degree in Informatics Engineering Major in Computing Director: Dr. María Josefina Sierra Santibáñez Department of Computer Science 1st July 2015
A la meva família i amics, que d’alguna manera o altra m’ajuden a arribar més lluny, sempre més lluny.
Abstract Within the broad field of linguistics, the emergence and evolution of human languages remain matters without generally consensed theories. Nevertheless, and during recent years, the gradual introduction of agent-based models has provided a tool for hypothesis-validation which is accelerating the progress being made. In this project we review some influential experiments in evolutionary linguistics and implement a basic form of an existing agent-based model for studying the acquisition of language systems of logical constructions. The model here presented has been built using the Prolog programming language and designed around a series of reusable modules, so that it can be employed by external researchers of related fields in conducting future studies.
Resum Dins de l’ampli camp de la lingüística, l’origen i l’evolució dels llenguatges humans és manté com una qüestió sobre la qual no s’ha arribat a formular teories àmpliament acceptades. Tot i així, durant els últims anys, la introducció gradual de models basats en agents com a una eina per a validar hipòtesis ha accelerat notablement el progrés d’aquests estudis. Aquest projecte analitza alguns experiments influents de lingüística evolutiva i presenta una implementació bàsica d’un model basat en agents existent per a l’estudi de l’adquisició de sistemes lingüístics sobre construccions lògiques. El model en qüestió ha estat construït utilitzant el llenguatge de programació conegut com a Prolog i dissenyat al voltant d’una sèrie de mòduls reutilitzables. L’objectiu final és que pugui ser emprat per altres investigadors de camps relacionats en futurs estudis que es duguin a terme. Resumen Dentro del amplio campo de la lingüística, el origen y la evolución de los lenguajes humanos se mantiene como una cuestión aún sin explicaciones ampliamente aceptadas. Sin embargo, la introducción de modelos basados en agentes durante los últimos años como herramienta para la comprobación de hipótesis, ha propiciado el progreso de dichos estudios. Este proyecto analiza algunos experimentos influyentes de lingüística evolutiva y propone una implementación básica de un modelo basado en agentes existente para el estudio de la adquisición de sistemas de lenguaje sobre construcciones lógicas. El modelo en cuestión ha sido construido utilizando el lenguaje de programación Prolog y diseñado entorno a una serie de módulos reutilizables. El objetivo final es que pueda ser empleado por otros investigadores de campos relacionados en futuros estudios llevados a cabo.
Acknowledgements The work done in this project would not have seen the light were it not for the patient and model guidance of my director María Josefina Sierra Santibáñez. Beyond teaching and explaining the academic topics and articles contained herein, she inculcated in me the academic rigour needed to finally consummate this project. Please accept my deepest appreciation and my most humble gratitude.
Contents 1. Introduction and objectives 1 1.1. Scopeoftheproject .................................. 2 1.2. Working methodology and validation . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3. Actorsandstakeholders ................................ 4 1.4. Resourcesandimpact ................................. 4 2. Agent-based models 6 2.1. Languagesystems ................................... 7 2.2. Examples in the literature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.1. Compositional structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.2. Agreementsystems............................... 13 2.2.3. Verbtenseaspect................................ 17 3. A model to study logical constructions 21 3.1. A language system for expressing logical constructions . . . . . . . . . . . . . . . 21 3.1.1. Conceptualsystem............................... 21 3.1.2. Linguisticsystem................................ 22 3.2. Languagegame..................................... 23 3.3. Cognitivecapabilities.................................. 24 3.3.1. Generation and invention . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.3.2. Interpretation and adoption . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.3.3. Induction .................................... 26 3.3.4. Adaptation ................................... 27 3.4. This project in the literature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4. The Prolog programming language 30 4.1. Fundamentals and logic programming . . . . . . . . . . . . . . . . . . . . . . . . 30 4.2. Definite Clause Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.2.1. Extension of the grammar formalism . . . . . . . . . . . . . . . . . . . . . 36 4.3. Structureinspection .................................. 37 4.4. Meta-logical predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4.5. Extra-logical predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.6. Second-order programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5. Specification: modules and their interaction 42 5.1. Simulation........................................ 43 5.1.1. Module language_game ............................ 43 5.1.2. Module population .............................. 46 5.2. Conceptualsystem................................... 47 5.2.1. Module conceptual_sys ........................... 47 5.3. Generation and invention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 5.3.1. Module generation .............................. 49 5.4. Interpretation and adoption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.4.1. Module interpretation ........................... 53 5.5. Adaptation ....................................... 56 5.5.1. Module adaptation .............................. 56 5.6. Induction ........................................ 58 5.6.1. Module induction ............................... 58 5.7. Agents.......................................... 59 5.7.1. Module agent ................................. 59 5.7.2. Module agent_params ............................. 62 5.8. Generalfunctionality.................................. 64 5.8.1. Module utils ................................. 64 6. Case studies and experimental results 66 6.1. Emergence of a language system . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 6.2. Transmission of a language system . . . . . . . . . . . . . . . . . . . . . . . . . . 69 7. Planning 73 7.1. Project Management Course (GEP) . . . . . . . . . . . . . . . . . . . . . . . . . 73 7.2. Deviations and corrections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 8. Budget and sustainability 76 8.1. Budgetestimation ................................... 76 8.1.1. Hardwareresources............................... 76 8.1.2. Softwareresources ............................... 76 8.1.3. Humanresources................................ 77 8.1.4. Indirectcosts.................................. 78 8.1.5. Unforeseencosts ................................ 78 8.1.6. Cumulativebudget............................... 79 8.2. Budgetcontrol ..................................... 79 8.3. Sustainability of the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 8.3.1. Economic sustainability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 8.3.2. Social sustainability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 8.3.3. Environmental sustainability . . . . . . . . . . . . . . . . . . . . . . . . . 81
9. Conclusions 82 10.Future work 83 Bibliography 84 A. User manual 86 B. Applicable laws and regulations 87
1 INTRODUCTION AND OBJECTIVES 1. Introduction and objectives During recent years, we have witnessed an increasing amount of interest towards the origin and evolution of human languages. However, we are still lacking widely accepted theories to explain these phenomena and many crucial questions are still unanswered. In this context, agent-based models and simulations have gained importance, as they provide an interesting balance between theorizing and formal mathematical modelling. This project builds on an existing agent-based model for studying the emergence and evolution of language systems of logical constructions [ SSn14 ]. We attempt to generalise the implementation of this model in order to provide a set of software modules that allow the construction of new agent-based models which can be adapted to study language systems of logical constructions, using different language strategies and potentially other types of language systems. The present work differs from other agent-based models reported in the literature in the specific type of language system studied, which focuses on the expression of logical constructions, and in the programming language and approach used to implement it, which is Prolog and in general logic programming. In order to achieve the overall aim of this project, we can stablish four different subgoals, which build on the results of the previous ones and are the object of the different sections of this document. The first subgoal was to identify the main software modules that should be part of our implementation and to understand the functionalities they should provide. This was done by analysing a significant number of agent-based models proposed in the literature to study the emergence and evolution of language systems associated with different aspects of grammar, such as compositionality, verb tense aspect or agreement, and by comparing these systems to the agent-based model proposed in [SSn14]. Once a generic and sufficient set of modules had been designed, the second subgoal was to address the main issues associated with their implementation in Prolog. This required, among other things, being able to synchronise the behaviour of the agents in the population, which interact with each other playing language games, to monitor the overall simulation, and to use appropriate data-structures and algorithms to implement the cognitive abilities needed by the agents to engage in linguistic interactions, learn from each other, and adapt their behaviour to the widespread conventions among the population. 1
2 AGENT-BASED MODELS The conceptual system includes pragmatic and semantic distinctions that are expressible in a language system and can therefore be used as building blocks for conceptualisation. The linguistic system includes all the syntactic and morphological categories and grammatical constructions needed to turn a conceptualisation into a concrete utterance [Ste11b]. A given language, such as Catalan, English or Spanish, comprises many language systems, which are closely integrated. Linguists call the approach underlying a language system a language strategy . They refer to relative-clause formation strategies or coordination strategies for combining nouns. Agent-based experiments aim to provide explanations of the processes by which concrete language systems may emerge and evolve using a particular language strategy. 2.2. Examples in the literature We summarise below some studies of different types of language systems that are described in the origins and evolution of language literature and use agent-based models as a tool. This serves the purpose of familiarising with the different techniques used by researchers, but also to introduce concepts which will relate later on to the model developed in this project. 2.2.1. Compositional structure Compositionality and recursion are two of the most distinctive features present in humanspoken languages [ Kir02 ]. A particular expression is compositional when its meaning can be defined in terms of the meaning of its parts and how they are glued together. Expressions where this does not hold are referred to as holistic expressions . On the other hand, recursion occurs when a certain part of an expression can contain a constituent of the same category. The emergence of compositional structures has been investigated using the observational game, the guessing game and a particular type of agent-based models known as iterated learning models . In this type of agent-based models some agents assume the role of teachers (speakers) and others the role of learners (hearers), and simulations can be carried out using a simple population of two agents (with a single teacher and a learner) or more. One example of an iterated learning model can be found in [ Kir02 ]. Kirby shows that the compositionality and recursion properties emerge over the time with social transmission as the sole trigger for the process. To understand his experiments, we need to define two concepts: -I-language: The knowledge of a language possessed by each user of that language. -E-language : The language represented in the utterances produced by the population of speakers of a language. 8
2 AGENT-BASED MODELS The model proposed by Kirby consists of only two agents who play language games. One of the agents takes always the role of teacher and the other one the role of hearer. The teacher is first given a meaning to express, which it attempts to transform into an utterance by means of its I-language. This utterance is later used as an input for the learner, who tries to understand it. After repeating this process a certain number of times generation shift occurs: the learner becomes the new teacher, the old teacher is discarded and a new learner is created with an empty knowledge of the language. Figure 2.2: Transmission of language over time in a teacher-learner chain (an image from [ Kir02 ]). Utterances in this model are pairs consisting of a meaning and a string of characters representing it. To construct those meanings, the agents use a series of atoms representing nouns or verbs and combine them to form predicates which take a number of arguments and can have hierarchical structure. The complete range of available atoms is known and shared by all agents before the first language game is played. Some illustrative examples can be found next: - Atoms: cat,dog,food,eats,fight,fears. - Predicates: eats(dog, food),fears(cat, fight(cat, dog)). - Utterances: [’dogeatsfood’, eats(dog, food)]. Each agent uses an initially-empty context-free grammar which allows them to represent their knowledge of the language. Once an utterance is heard by an agent and not understood, the agent incorporates the simplest possible rule that generates the utterance, which is a holistic rule. Taking [’dogeatsfood’, eats(dog,food)] as an example of an utterance, this would produce a rule of the form S/eats(dog, food)→dogeatsfood. 9
2 AGENT-BASED MODELS Rule induction is applied then to the agents’ grammars. This is a process which aims to obtain higher-level rules by looking for ways to generate similar expressions and generalising the associated rules. For example, given the two rules: S/eats ( dog, food ) →dogeatsfood and S/eats ( cat, food ) →cateatsfood , we can generalize the concepts cat and dog by doing S/eats ( x, food ) →N/x eatsfood . Note that now a new syntactic category Nmust appear in order for the two resulting grammars to be equivalent, and also two more rules of the form N/cat →cat and N/dog →dog need to be added. Let us review now the simulation cycle in [Kir02]: 1. The speaker is given a meaning to express, and tries to communicate it using its knowledge of the language. Should this not be possible, it invents an expression taking advantage of rules which can be used to express parts of the meaning. 2. The learner tries to parse the utterance. If this is not possible, then it adds the minimal rule necessary to parse the utterance and applies rule induction. 3. Steps 1 and 2 are repeated a number of times inferior to the cardinality of the meaning space (the reason for this is discussed later). Next, the teacher is deleted, the learner becomes the new teacher and a new agent with no knowledge of the language becomes the new learner. By using this model, Kirby is able to demonstrate that as the simulation goes on, the grammars of the agents decrease in size and allow them to express a higher number of meanings. In fact, those grammars are able to evolve into a complex compositional syntax where nominal and verbal categories appear, together with different sentence orders such as (Subject - Verb - Object) or (Object - Verb - Subject). If the meaning space is infinite, that is predicates can take other predicates as arguments, then recursion also appears in the obtained rules, representing subordinate sentences. Kirby argues that this evolution occurs because more general rules allow the expression of a wider range of meanings and thus, these rules have a higher change of appearing in the E-language from the I-language, constituting a better replicator (this also allows convergence towards shorter grammars, because the generality of the rules in them is higher). Finally, it is argued that holistic languages cannot survive because the E-language used by hearers to learn only allows the observation of part of the speaker’s language. This occurs due to the number of meanings selected before changing the agents being always less than the count of all possible meanings. The difference between the set of all possible meanings and the subset of meanings selected for communication is commonly referred in the literature as a transmission bottleneck and pointed as the main factor that pressures the appearance of compositional languages. 10
2 AGENT-BASED MODELS Another study similar to the previous is conducted in [ Vog05 ]. It also studies the emergence of compositional structures, but with a few notable differences. First, it assumes that syntactic structures co-evolve with semantic ones, instead of being given from the start. More precisely, the following is stated: - The emergence of compositional linguistic structures is constrained by semantic structures and based on exploiting regularities in expressions. - The emergence of combinatorial semantic structures and how words are modified by others is constrained by compositional structures and based on the regularities shown while interacting. The former model has a strong basis on the Talking Heads experiment [ Ste99 ]. In the Talking Heads model, a group of agents observe a scene composed of a blackboard which contains plain figures of different colours and shapes. The goal of the population as a whole it to evolve a lexicon to refer to them individually. Objects can have four features in Vogt’s model: level of red, green and blue (rgb colouring) and shape. These four features are the basic building blocks for constructing meanings (also known as categories). In turn, categories are represented as points in a high-dimensional space, where each dimension accounts for a single feature. For simplicity, meanings need to cover all dimensions, either as a holistic space or as a composition of non-overlapping spaces. Each agent maintains its own ontology and uses it to produce and parse utterances. Such an ontology contains a set of categorical features, represented as points along one particular dimension in the feature space. The agents use it for extracting features and combine them into categories. This process is known as a discrimination game , and succeeds if the category obtained for a given object is distinctive and fails otherwise. Similarly to the previous model by Kirby, the agents also maintain their own grammar, which allows them to construct utterances for a particular category and to parse them. The terminal slots of these grammars however, represent points in the feature space. For example, the rule N/rgb →blue/ [0 , 0 , 1] means that a terminal slot in the rgb space will be uttered as the string “blue” if its meaning is [0 , 0 , 1] (no red nor green components in the rgb space). With this example, it also becomes clear than the meaning of a rule can be formed from the categorical features listed in square brackets. Additionally, each rule has an inherent weight value which determines how effective it has been in past language games. Categorical features also have a weight value associated to them. If a rule contains terminals, its score is computed as the product of its own weight and the average weight among terminals. This score will become valuable later on as a tool allowing the population to agree on the same structures for meanings, a process known as self-organisation. 11
2 AGENT-BASED MODELS Given the communicative context, we now discuss the particular type of linguistic interactions used in this model, which are known as the observational game and the guessing game: 1. The speaker is given a a certain object to talk about, a topic , and then extracts the distinctive features that describe the object properties. 2. The speaker non-verbally informs the hearer about the topic selected in the observational game. In the guessing game no information is given. 3. Both agents form a category that distinguishes the topic from the rest of objects in the context. If this category can not be obtained using the agents’ ontologies, a new category is created using discrimination games (in the guessing game all objects in the context are considered as potential topics). 4. The speaker produces an utterance, obtained using the combination of grammar rules with highest score that match the chosen meaning. 5. The hearer tries to decode the utterance produced by the speaker. To do so, it creates a set of rule compositions that decode the utterance, and then extracts the ones not matching the topic (observational game) or the ones not matching any of the objects existing in the context (guessing game). Finally, the hearer generates a meaning which allows to discriminate the topic by selecting the composition of rules with highest score. If this composition can not be found, the hearer fails. Note that in Vogt’s model, two different types of language games are considered. In the observational game , the speaker communicates its topic to the speaker, and thus both share joint attention to a particular object in the scene. However, in the guessing game , this communication is not present, and the hearer has to guess which object the speaker is trying to refer to. It is only after this process that the hearer receives feedback on whether the guessed topic was right or not. A language game may fail when the speaker is unable to produce an utterance or the hearer fails to interpret the utterance. In the first one of the situations, the speaker needs to invent new rules using similarities with existing rules in the same way as previously seen in the Kirby’s model. When the hearer is not able to decode an utterance, it starts a process known as induction , which allows it to derive new grammatical structures. Hearers can operate using the following: -Incorporation: add a holistic rule. -Exploitation : take advantage of an existing rule capable of decoding part of the sentence and add a new rule covering the remaining parts. 12
2 AGENT-BASED MODELS -Chunking : split a holistic expression and create new rules in the grammar, based on the largest common chunk and provided the utterance is not parseable, but aligned with some previous holistic rules. Along language games, there is an adaptation process which increases the weight of the rules used and decreases the weight of competing ones in both the speaker and hearer. More formally refereed to as lateral inhibition , this serves as a competitive selection mechanism and allows agents to unlearn certain rules and to self-organise, an issue not addressed in the previous model by Kirby. Rule generalisation and merging are present as explained in Kirby’s model. Experimental results confirm the previous findings claiming that the transmission bottleneck triggers the emergence of compositional rules. Nevertheless, Vogt is also able to create compositional rules even without introducing such a bottleneck, although the proportion of compositional expressions is fairly unstable, and can eventually collapse in a holistic language. Compositionally emerges in this case because of the high statistically recurring structures in both utterances and meanings. The guessing game seems to be more stable with different populations sizes, and this is expected, because there is more pressure to disambiguate the language, as the hearer does not know the original intended meaning of the speaker and has to guess from the utterance. The size of the bottleneck also plays an important role, being smaller bottlenecks a more fertile ground for compositionality. 2.2.2. Agreement systems Grammatical agreement occurs when features associated with one linguistic unit, such as number or gender, become associated with another unit. Typically this association is made explicit by using some kind of morphological marker which shows the dependencies between words. Beuls and Steels [ BS13 ] present an agent-based model and a series of experiments that show how agreement systems could arise, and which cognitive and cultural traits intervene in the overall process. It is hypothesised in their work that agreement systems are motivated by the need to minimise combinatorial search and semantic ambiguity when parsing. As we have seen in previous examples, the Beuls-Steels model uses a set of objects present in the situation with various properties that are observable and known by the agents. Each object has a number of features that are expressed using predicates such as green ( oi ), meaning the object oi is green. A population of 10 agents is initialised with a predefined vocabulary, in the form of associations between a set of properties and a word. For instance, the word “jubope” could mean green(x)and small(x), where xcan be bound to an object. 13
2 AGENT-BASED MODELS Apart from vocabulary, each agent has also a grammar which allows them to construct and parse expressions. Both vocabulary and grammar are implemented using Fluid Construction Grammar, which is not explained in detail here. We encourage the reader to look up the technical details appearing in [BS13]. Agents in the Beuls-Steels model play what is called game of reference, also known as naming game . In this particular language type of linguistic interactions, the topic can be composed of either one or more objects. The overall process is as follows: 1. The speaker selects a set of objects as a topic to communicate. 2. The speaker looks for distinctive properties for each object in the topic. Note that each object is of a certain type, which defines the possible attributes and values of its instances. 3. The speaker retrieves the set of words to express these properties. Words can cover more than one property, but all properties must be true for the objects associated with the word. 4. The speaker utters the words in random order. 5. The hearer tries to reconstruct the set of properties from the words uttered by the speaker. 6. The hearer identifies which objects satisfy these properties, and succeeds if this set of objects is the same as the one chosen by the speaker. 7. The game fails if the interpretation is ambiguous or the set of inferred objects differs. This language game can be viewed as a simple interaction, but in fact, the hearer does not know the number of objects the speaker is referring to or which words refer to which object or objects. Thus the hearer must try all possible combinations of objects, which are exponential with respect to the number of words. While this ambiguity and exponentiation indeed exists in real human interactions, we can use some strategies to help reduce it. We humans know as a matter of fact that some attributes are not possible for certain objects (the sky can be blue, but this is not a natural property to describe an idea). Selection restrictions are implemented in the agents by giving them access to an ontology defining the different types of objects and their possible attributes and values. The other mechanism used to reduce ambiguity is the application of constraints that arise from the situation model. That is, because the speaker is referring to a topic in the situation, we can assume that a certain attribute must be linked to an object in the situation which has the same value for that attribute. This is used for pruning some hypothesis in the model. Nevertheless, in order to reduce the hypothesis space drastically, some kind of agreement system is needed. This is initially presented in the form of markers, which are associated to uttered words that refer to the same object in the topic. 14
2 AGENT-BASED MODELS The first language strategy implemented in [ BS13 ] attempts to simulate the rise of marker systems. To do this the speaker tries to detect the difficulties that the hearer may encounter when parsing the words by trying to the parsing job itself, a process known as re-entering . If the speaker notices combinatorial complexity or some ambiguities, it adds a marker to each word (syntactically represented as a suffix) that introduces properties of the same object. Markers are stored in private inventories that the agents possess and are used in subsequent games, even if not needed. The hearer undergoes a similar process than the speaker, uses markers in subsequent communications and is now able to instantly identify which words refer to the same objects, even if it is the first time seeing a marker invented by the speaker. Regardless, there is still an issue because agents need to agree globally on markers, through a process of self-organisation. This is done with using lateral inhibition, which we have already seen in Vogt’s model from the previous section. Weights are set for each marker and when a marker is used, its weight increases while decreasing the weights of competing markers. When choosing which marker to use, the speaker prefers the marker that has the highest score and has not yet used in the current utterance. The model at this point is able to show that marker systems indeed emerge and get transmitted culturally. Occasionally some new markers appear, but get damped because of lateral inhibition. Still in real human languages, we tend to prefer markers which are not formal, but carry some kind of meaning or connotation. To simulate, Beuls and Steels propose a second language strategy in which an inventory of associations between a feature matrix conveying semantic information, a marker and a score is kept by each agent. When the speaker decides to use a marker for a word referring to a particular object, it first searches the inventory fo find one not used in the same utterance, and whose feature matrix fits the feature matrix of the word used to refer to the object. In cases where no such marker is found, the speaker tries to find an attribute which is distinctive for words used to refer to the different objects in the utterance and creates new markers for each distinctive attribute-value pair. On the other side of the coin, whenever the hearer encounters new markers, it treats them as formal, and constructs and adds a feature matrix by using the same induction process as the speaker. This strategy leads to a self-organisation where the agents share which markers they prefer but also the feature matrices associated to them. Markers that express a single feature dominate, because they can be applied to a wider range of situations. However, more modifications to the model are still possible in order to resemble more the strategies used by humans to create agreement systems. 15
2 AGENT-BASED MODELS Linguists have observed that markers in real life are derived from existing words such as pronouns or classifiers. This is actually preferred by humans because it is less ambiguous and does not require uncertain guesses when new markers are encountered. Rather than inventing a random string when a new marker is needed, the speaker will now take an existing word that expresses one or several features of the topic and use that as a marker. Again, an agreement system self-organises, but this time with even fewer variations between markers, which are more quickly discarded. Once a marker system efficient enough takes off, it is hardly challenged. Another observation made by linguists is that markers erode. This happens because of an increase of articulatory efficiency, and because parsing takes less effort if we use a new shorter form of the word rather than the original one associated to the marker, which is most likely to appear in other situations. This process is simulated by adding a tendency for optimizing on top of the aforementioned reuse strategy. The word used is simplified with a certain probability, and parsing in the hearer becomes now flexible enough so as to recognise such variations as the original word and still remain coherent. This mechanism leads to a problem: the alteration cannot become a norm because of the lateral inhibition process, which quickly discards it. In order to correct this, the new variant of the word and the original word are stored, and both words are used randomly when selecting a marker. If the marker is encountered a second time, then it becomes the norm and the older word is discarded for this agent. Experiments performed show that forms become continuously reduced. Figure 2.3: Humans build agreement systems by reusing existing words. The form of those words erodes and their meaning becomes more abstract, with purely conventional semantic features (an image from [BS13]). 16
2 AGENT-BASED MODELS Finally, the authors address the phenomenon of coercion. Markers in real life are applied to situations which do not fit the original meaning and features become conventional. This is what happens with gender in most languages, being arbitrarily assigned to inanimate objects while originally meant for male/female distinction. The explanation is that having a large number of markers makes it difficult to learn. Us humans take the ones which are more general (semantic bleaching) and recategorize a word to assign more agreement features, even though the previous word did not have this feature. To include coercion in the model, the differentiation between controller and target words is introduced. Controllers determine the agreement features of targets. In the Beuls-Steels implementation, some words at the beginning of the simulation are initialised as controllers. Then an extra step is added to the invention of a marker by the speaker, who will now assign by convention the values of a partial marker to the controller if the controller is undecided on those features. This automatically makes the controller compatible with the marker. Lateral inhibition is also used in this case as a way to self-organise the population, storing a score for each feature matrix of each controller, and increasing it when used and decreasing it when not. Additionally, agents are now initialised with a minimum marker system as well for convenience. By running this experiment, a reduction in the number of markers is observed. It shows that some feature matrices denoting a certain meaning become dominant over others associated with the same marker. This research as a whole is, according to their authors, another example which supports the idea that the structure of language is a consequence of its function and usage in communication, operating within the processing constraints of human cognition and physical characteristics. 2.2.3. Verb tense aspect Another study by Gerasymova et al. [ GSB12 ] deals with the parsing, production and learning of an aspect system. To do so, it employs an existing system of aspect markers found in the Russian language as a model. Consider the sentences “Pieter wrote a thesis” and “Pieter has been writing a thesis”. It is true that both of them express the action of writing. However, while in the first sentence the action was completed in the past (perfective aspect), in the second one the process of writing is still ongoing (imperfective aspect). Aspectual distinctions such as this one allow speakers to highlight the whole or a specific part of an event and thus increase their expressiveness and communicative success. 17
3 A MODEL TO STUDY LOGICAL CONSTRUCTIONS The particular type of language game used in this model consists of the following steps. First of all, the speaker chooses a boolean formula referring to a subset of the objects present in the context of the language game. After this, it generates or invents a sentence to express this formula, and then utters that sentence for the hearer to interpret. The hearer tries to parse the sentence the speaker communicated using its lexicon and grammar. The game succeeds if the hearer can parse the sentence uttered by the speaker and the meaning interpreted by the hearer is logically equivalent to the meaning the speaker had in mind. Otherwise, the language game fails, and in such a case the speaker communicates the boolean formula it had in mind to the hearer, so that the hearer can adopt an association between the formula and the sentence used by the speaker. At this moment it might be useful to clarify which aspects of the language system of logical constructions studied by the agent-based model proposed in [ SSn14 ] are present in the agents at the beginning of the simulation, which elements of that language system they should construct during simulations and which cognitive abilities allow them to do so. The agent-base model described in [ SSn14 ] assumes the agents initially have a common vocabulary for basic categories and the ability to construct complex meanings combining one or two basic categories with a single boolean function. It also supposes that the agents initially do not have a vocabulary for boolean functions nor grammatical constructions. They should construct these elements of their linguistic system during the simulations and do it in a coordinated manner. To achieve this, they can employ some general purpose cognitive abilities for invention, adoption, induction and adaptation. In the following section, we explain briefly how these abilities are used in during the simulations. 3.3. Cognitive capabilities 3.3.1. Generation and invention At the beginning of a simulation run the agents cannot use their internal grammars to express most meanings, because they initially do not have a vocabulary for boolean functions nor grammatical constructions. In order to form a common language, agents are allowed to invent new sentences for those meanings they cannot express using their grammars. 24
3 A MODEL TO STUDY LOGICAL CONSTRUCTIONS Invention is performed as follows. If a given formula is atomic, then invention is not necessary (there is already an existing word in the lexicon which uniquely expresses it). In the remaining situations, where the formula consists of a boolean function followed by one or two arguments, a sequence of random letters from the alphabet is chosen to invent a word for the boolean function. A word is generated for each propositional symbol and the two or three words, depending on the type of formula, are concatenated in random order. As the agents play language games, they learn associations between expressions and meanings, and include those in their individual grammars in the form of rules. Eventually, an agent will be able to express a meaning using only its grammar. In this case, no invention is needed, and the agents generate the sentence with highest score out of the ones they can form to express that meaning. The score of a sentence is computed combining the scores of the grammar rules used in its generation, using the arithmetic expressions on the right hand side of these rules [Vog05]. As an example, we will consider the generation of the sentence “arroizq” for expressing the meaning [or,up,left] using the rules 1 to 4 from the previous section. The score of the sentence is computed by multiplying the scores of each one of the compositional grammar rules used to generate this sentence and the score of the grammatical rule itself. Therefore the score of “arroizq” is 0.7 ·0.5 ·0.25 ·0.1. 3.3.2. Interpretation and adoption In the second step of a language game, the hearer tries to interpret the sentence communicated by the speaker using its own grammar. Again, at an early stage of a simulation run the hearers will not be able to parse most of the sentences communicated by the speakers, because of the lack of grammatical constructions. When this happens, the speaker communicates the formula F it had in mind to the hearer, and the latter adopts an association between this formula and the sentence E used by the speaker, adding a rule of the form s ( F, S ) −→ E, {S is 0 . 1 } to its grammar, where 0.1 is the initial score of the grammar rules created by the agents. Once the agents can parse a sentence using their own grammar, they select the meaning with the highest score from the set of all the meanings they can obtain for that sentence. Sometimes it will occur that the grammars of speaker and hearer are not compatible, and the interpretation the hearer produces is far away from what the speaker intended to communicate. 25
3 A MODEL TO STUDY LOGICAL CONSTRUCTIONS The strategy used to coordinate the grammars of both agents in this situation is to decrease the scores of the grammar rules used by the hearer to obtain its interpretation of the sentence, striving for an agreement between all agents, who play in different pairs each turn; and to communicate the meaning the speaker had in mind, so that the hearer can adopt an association between the meaning and the sentence used by the speaker. 3.3.3. Induction Invention and adoption allow the agents to construct and learn associations between sentences and meanings. However, the agents are also able to extract generalisations from the rules they have learnt so far and induce grammatical constructions and lexical entries that can be incorporated to their grammars and used in subsequent language games to generate and interpret other sentences. Induction is applied whenever the agents invent or adopt an association between a sentence and a meaning, to avoid redundancy and increase generality in their grammars. Two distinct induction processes can be found in [ Kir02 ], called chunk and simplification . The induction mechanisms used in this project are based only on the latter, but adapted to grammar rules containing scores as a mechanism of self-organisation. As outlined in [ SS07 , SSn14 ], the following definition holds: Assume a pair of grammar rules r1 and r2 such that the semantic argument on the left-hand side of r1 comprises a subterm m1 , r2 is of the form n ( m1, S ) →e1,{S is C1} , and e1 is a substring of the terminals of r1 . Simplification can be applied to r1 and a simplified rule is obtained. This new rule is identical to r1except for the facts that: 1. The subterm m1 is replaced with a new variable X in the semantic argument on the left-hand side. 2. The substring e1is replaced with n(X, S)on the right-hand side. 3. The arithmetic expression {R is E ·C2} on the right-hand side is replaced with a new arithmetic expression of the form {R is E ·S· 0 . 1 } , where C1 and C2 are constants in the range [0,1], and E is the product of the score variables that appeared on the right hand side of r1. The process of simplification can perhaps become clearer with an example. Assume an agent’s grammar containing the rules 6 and 7. Suppose now that this agent plays a language game with another agent and invents rule 8. 26
3 A MODEL TO STUDY LOGICAL CONSTRUCTIONS p(light, S)→claro,{S is 0.50}(6) p(right, S)→derecha,{S is 0.30}(7) s([and,light,right], S)→claroyderecha,{S is 0.1}(8) Simplification could be applied to rule 8 using rule 7 and obtain rule 9 as follows: s([and, light, R], S)→claroy, p(R, SR),{S is SR·0.1}(9) s([and, Q, R], S)→p(Q, SQ), y, p(R, SR),{S is SQ·SR·0.1}(10) Now rule 9 could be simplified again, this time using rule 6, to obtain rule 10. Note that in this last rule, the connective is located at the corresponding position within the sentence. If now the agent invents or adopts a rule that associates the formula [or,light,right] with the sentence “clarooderecha” and applies simplification, then its grammar will contain the rule: s([or, Q, R], S)→p(Q, SQ), o, p(R, SR),{S is SQ·SR·0.1}(11) 3.3.4. Adaptation There is one more feature we will need to implement in our model which is commonly referred to as adaptation. This mechanism is a way to ensure that the agents’ grammars are coordinated. It is likely to happen that different agents refer to the same boolean function in distinct ways, or that two agents choose to concatenate the expressions associated with the components of a given formula in different orders. Coordination is achieved through a process of self-organisation of the agents’ linguistic interactions that takes place when the agents adapt their preferences for vocabulary and grammatical constructions to those they observe are used more often by other agents. At the last step of a language game, when the speaker communicates its intended meaning to the hearer, the agents adapt the scores of their grammar rules. This happens only when the speaker can generate at least one sentence for the meaning it is trying to communicate and the hearer can parse the sentence produced by the speaker. In a language game only the agent playing the role of hearer adapts the scores of its grammar rules. However, all agents are fated (probabilistically speaking) to take both roles eventually, and thus have chances to adapt their grammars. 27
3 A MODEL TO STUDY LOGICAL CONSTRUCTIONS Whenever a game succeeds, the hearer takes the interaction as a positive instance and adjusts the scores of its grammar rules, both at interpretation and generation levels. The hearer also increases the scores of the rules it used to obtain the meaning that the speaker had in mind and decreases the scores of the grammar rules that generate competing meanings. After that, the hearer tries to express the meaning the speaker intended to communicate using its own grammar rules, and it increases the scores of the rules that generate the sentence chosen by the speaker and decreases the scores of the rules that generate competing sentences. The process of adjusting the scores at the level of interpretation reduces ambiguity and discourages homonym sentences from appearing. The adjustment at generation level means reducing ambiguity and discouraging a phenomenon similar to synonymy of sentences. In any case, the scores of the grammar rules used by the hearer to obtain the meaning the speaker had in mind are increased only once. If the meaning interpreted by the hearer is not logically equivalent to the meaning the speaker had in mind, the game fails, and the hearer decreases the scores of the grammar rules it used for obtaining the wrong meaning for the sentence uttered by the speaker. 3.4. This project in the literature The project developed in this work belongs, as previously stated, to the evolutionary linguistics branch. More precisely, it fits more appropriately into the set of experiments that study grammar acquisition [ BS13 , GSB12 , Vog05 , vT12 , SBK03 , Kir02 ] rather than lexicon acquisition [Ste95, SB05]. It is worth noticing that word order plays a vital role in our experiments. This is because in the experiments described in [ SSn14 ], which constitute the basis of the present work, the position of each sub-expression in a sentence determines how it is semantically related to the rest of sub-expressions. Kirby [ Kir02 ] also studies the emergence of word-order based grammar, but without addressing the problem of negotiation, as the population he uses consists only of two individuals. In the experiments described in [ SSn14 ], however, the population consists of 10 agents, which need to reach consensus on how to order the expressions associated with the constituents of each different type of boolean formula to construct a sentence. In the present project we wish to generalise this model so that it can use an arbitrary number of agents. 28
3 A MODEL TO STUDY LOGICAL CONSTRUCTIONS Another difference between the agent-based model described in [ SSn14 ], on which the present work is based, and Kirby’s work [ Kir02 ] is the manner in which communicative success is evaluated. While Kirby considers syntactic equality as an indicator of mutual understanding, [ SSn14 ] uses logical equivalence. As a result of this, the grammars constructed by the agents in the experiments described in [ SSn14 ] do not impose a strict order between the expressions associated with the arguments of commutative boolean functions. Beuls and Steels [ BS13 ] also study grammar acquisition, but they use agreement markers instead of word order as the syntactic means for semantic disambiguation. Similarly to [ SSn14 ], they perform simulations with software agents, initialise them with a predefined vocabulary for basic properties and use a language game in which the topic consists of several objects. The differing point is that the meanings constructed by the agents in [ BS13 ] consist of a set of distinctive properties in which each property refers to a single object of the topic. Moreover, the role of agreement markers is to indicate which properties of the distinctive set refer to the same object. Therefore, the set of meanings the agents can construct in the agent-based model proposed in [ BS13 ] are only conjunctions of basic properties, whereas the agents in [ SSn14 ] and those we intend to use in the present project conceptualise the topic by constructing a discriminating logical formula. These logical formulas can be a composition of basic properties through conjunction, disjunction, negation or any other boolean function which is true for every object in the topic and false for the rest of the objects in the context. Finally, taking as a starting point the Prolog implementation of the agent-based model for studying the acquisition of a language system of logical constructions used in the experiments reported in [ SSn14 ], we will build a set of Prolog software modules that allow implementing different types of agent-based models and conduct language evolution experiments with these models. These modules will be different from the Lisp simulation and grammar processing systems [ Ste11a ] used in most agent-based simulation experiments described in the literature [GSB12, Vog05, PH12, SB05, Ste95, Ste11a, vT12, SS12, BS13, Ste99]. 29
4 THE PROLOG PROGRAMMING LANGUAGE 4. The Prolog programming language Before revealing the implementation details of the model developed in this project, it might be useful to give a brief overview of the Prolog programming language. To this effect, this chapter wants to discuss the basic terminology and concepts in Prolog and also the advanced techniques featured in the model. Nevertheless, this chapter is not a detailed explanation of all features in Prolog, and we strongly encourage the reader to refer to some suitable references in case necessary [ CM03 , SS94 , Bra90 ]. Also, note that various of the technical aspects below explained have been inspired by [SS00]. 4.1. Fundamentals and logic programming To begin with, Prolog is a general purpose and logical programming language which has its roots in first-order logic. It is for this reason that writing Prolog programs can turn out to be a very different process compared to what one may encounter in other programming languages. Here, the user needs to specify which relationships and objects occur in the problem and which relationships are true about the desired solution. Therefore, the process is more about describing the problem as logical axioms rather than giving the sequential steps to solve it. These kind of programs can be executed by providing the system with a problem, formalized as a logical statement and called the goal statement . The execution is an attempt to prove the goal statement, given the assumptions in the logic program. For example, when we say “Sarah owns the laptop” we are declaring a relation of ownership between the objects “Sarah” and “laptop”. In contrast, when we ask the question “Does Sarah own the laptop?” we are trying to find out whether or not that relation of ownership exists. Thus, we are always working with a set of statements, and each statement is either a fact about given information or a rule about how the solution may relate to or be inferred from the given facts. In more technical terms, writing a Prolog program consists of specifying some of the following types of statements: -Facts asserting that a relationship holds between objects. -Queries asking whether or not a relationship holds between objects. -Rules defining high-level relationships between objects. 30
4 THE PROLOG PROGRAMMING LANGUAGE Out of the former, facts are the simplest form of statements, and are all collected in a database maintained by Prolog. We now consider a small database containing the following facts, which relate 2 objects each: likes(john,mary). likes(john,book). likes(mary,john). The first fact states that an individual called John likes another individual called Mary. Names of individuals or objects are known as atoms and must always begin with a lowercase letter. Note that atoms can refer to any kind of objects and that the relationships are not reflexive (the first and third facts are not equivalent). As a remark for later, it is also common to use the term predicate to refer to relationships. The second most simple form of statement in a logic program is a query. Queries are used to find whether a particular relationship exists and look exactly the same as facts (but can be easily told apart by the context). Answering a query means satisfying a goal and determining whether the query is a logical consequence of the program. In the examples shown next, Prolog will search the database for each formulated question and come up with an answer, which can either be positive or negative: ?- likes(john,money). no ?- likes(mary,john). yes The no answer means that nothing unifies with the question. In our former case, it becomes clear that there is no such fact in the database that contains john and money as its arguments. In contrast, when a yes answer is returned, then there is a fact which has the arguments provided and in the same order. Prolog however, can do much more that answering yes or no questions, and it provides ways to make inferences from one fact to another. This implies that, for example, we can find out which objects does John like, instead of just recovering the same information we input beforehand. To do this, we will need introduce the concept of logical variable . A logical variable stands for objects that we are unwilling or unable to name. This conception is opposed to the idea of a constant , which denotes a particular object such as an integer or an atom. Variables in Prolog are distinguishable from constants because they start with an uppercase letter. 31
4 THE PROLOG PROGRAMMING LANGUAGE A query containing a variable asks whether there is a value for the variable that makes the query a logical consequence of the program. This creates questions that look like “Does John like X ?”, X being a logical variable. We refer to a variable as instantiated when there is an object that the variable stands for, and as not instantiated when what the variable stands for is not yet known. The question considered in this paragraph will produce two answers, resulting from Prolog searching through all its facts to find an object that the variable could stand for and unifying the variable with it: ?- likes(john,X). X = mary; X = book; no After introducing variables, it is a good moment to discuss what is a term , the single and broad data structure used in Prolog. To this effect, we provide the following recursive definition, appearing in [SS00]: 1. Constants and variables are terms. 2. An expression of the form f ( t1, ..., tn )is a term if f is a functor of arity n and each one of the ti is a term. Functors are structures characterised by its name and the number of arguments they accept, known as arity . The combination is conventionally indicated with the notation f/n. Queries, goals and terms where no variables occur are called ground terms . If a goal or query contains variables, those are existentially quantified. A query Q with the set of variables {X1, ..., Xn} is asking whether there are values for each one of the Xi such that the query holds (note that this may lead to several solutions, or even an infinite number of solutions). If Q had been a fact instead, then the meaning of the fact would hold for any possible combination of values in each Xi(and thus, the variables are implicitly universally quantified). It is also possible in Prolog to form a conjunctive query , which is a conjunction of goals Q1, ..., Qn separated by commas. If any variable occurs in more than one of those goals, we refer to it as a shared variable . Conjuctive queries are a logical consequence of the program if each one of the goals Qi is also a consequence of the program and the shared variables are instantiated to the same values in all goals. 32
4 THE PROLOG PROGRAMMING LANGUAGE Finally, the third and most important statement is the rule, which allows to define new relations in terms of existing relations. Rules in Prolog contain a sequence of one or more goals (or as we have already seen, a conjunctive query). For instance, if we consider a rule of the form H :- B,C. , then H is syntactically the same as a literal and it is referred to as the rule head , and the literals B,C form the rule body . The symbol :- is the functor denoting a rule. This structure can be more informally read as H is true if B and C are also true. Note that facts are rules with a sequence of 0 goals, or in other words, no rule body. To finish with the fundamentals of the Prolog programming language, we briefly explain the computational model of logical programs, which is based on a process called unification . A unifier of 2 terms (or clauses) is a substitution of all variables Xi present with a term tj such that it holds that every Xidoes not occur in any of the tj. In the query likes(john,X) that we previously asked, when the literal mary is found, X becomes unifies with the atom mary . Prolog marks the place in the database where a unifier is found, in order to continue the search later on if necessary. Should the user or the program require more solutions, Prolog will resume the search from where it left the place marker to find another possible answer to the question. Returning to our example, book is the next literal in the database fulfilling the conditions. At some point, it will not be possible to re-satisfy the goal any more, and then the search stops and the question fails. When succeeding, the program provides a proof which gives the solution verifying the query. The computation progresses via goal reduction . At each stage there is some resolvent, that is a conjunction of goals to be proven. Prolog chooses a goal in the resolvent and a clause head that unifies with it from the logic program. A new resolvent is obtained by replacing the chosen goal with the body of the chosen clause and applying a unifier obtained from the head of the clause and the goal. Termination happens when the resolvent is empty. Nevertheless, this backtracking behaviour of Prolog described can be altered, something that is necessary in various situations and also used to increase efficiency. This can be achieved by introducing the symbol ! , known as cut . Suppose that now we define the following rule in order to list all the objects that a certain individual likes, but we include a cut by mistake: likings(X) :- likes(X,Y), write(Y), nl, !, fail. ?- likings(john). mary no 33
4 THE PROLOG PROGRAMMING LANGUAGE In this project the predicates clause , assertz and retract are used, because the agents are building and refining their grammars during the execution as they play language games. The use of assertions is justified in the sense that the (dynamic) grammar rules added are the result of induction processes from rules already present in the agent’s grammar. The retracting operation is also justified by the fact that the only grammar rules removed are the ones subsumed by more general rules added as a result of induction processes to the grammar. 4.6. Second-order programming Prolog also includes some predicates that, instead of producing a single solution, provide sets of solutions as a solution. Finding all the instances of a query that are implied by a program is a not a first, but a second-order question, since it asks for the set of all the elements with a certain property. This is also not pure Prolog because in the logical paradigm all information about a certain branch of the computation is lost on backtracking. Predicates that return all the instances of a query are called all-solutions predicates . Next, we describe two all-solutions predicates provided by Prolog [SS00]. The predicate findall(Term,Goal,Sols) is true if and only if Sols unifies with the list of values to which a variable X , not occurring in Term or Goal , would be bound by successive re-satisfaction of the conjunctive goal call(Goal), X = Term . Of course, this only makes sense if Term and Goal share some variables. Procedurally, findall(Term,Goal,Sols) creates an empty list L , renames Goal to a goal G , and executes G . For each successful execution G , and until the predicate G fails, a copy of Term is appended to the list L. Finally, Sols is unified with L. A similar predicate, bagof(Term,G,Sols) , behaves like findall except that if there are variables in G that do not occur in Term it returns through backtracking a list of solutions for each possible value of these variables. If there is no solution for G in the goal bagof(Term,G,Sols) , then the goal bagof(Term,G,Sols) simply fails. The difference between findall and bagof is that in calls to findall(Term,Goal,Sols) all the instances of Term that represent solutions to Goal are collected together, regardless of possible different solutions for variables in Goal that are not shared with Term . Also, if there is no instance of Term that satisfies Goal , then the goal findall(Term,Goal,Sols) will succeed with Sols = []. 40
4 THE PROLOG PROGRAMMING LANGUAGE In short, first-order logic allows quantification over individuals. Second-order logic further allows quantification over predicates and uses rules with goals whose predicate names are variables. Thus, predicate names become “first-class” data objects that can be manipulated and modified. From an operational perspective, this implies that goals are constructed dynamically during the computation. We have already seen methods to deal with this in Prolog, such as the predicate univ, which can be used to construct a goal of the form Goal =..[P|Xs], Goal, where a variable representing a predicate Pis applied to a list of arguments Xs. Second-order all-solutions predicates are used to compute the sets of competing sentences and competing meanings that the agents require in order to adapt their preferences for vocabulary and grammar to those of the other agents, taking into account the results of the language games in which they participate during a simulation. Dynamic goal construction also plays an important role in the implementation of the induction operation of simplification, where parts of a grammar rule are reconstructed in terms of others. 41
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5. Specification: modules and their interaction During the process of writing a program, the necessity to provide a certain degree of documentation soon becomes self-evident. This is specially true when considering Prolog programs. One would like to provide enough hints so that external users can comfortably use the program without having to understand the implementation details. At the same time, other individuals wanting to dwell in the implementation and potentially improve it, may require some help to understand the underlying mechanisms. One traditional manner of confronting this problem is providing comments in the very same code [ Bra90 ]. Those comments should first explain what the program is, how to use it, and only then give details about the programming methods employed. In Prolog we are specially interested in discerning the top-level predicates and knowing their inputs and meaning, among other things. With the name specification, we denote a document that explains the behaviour of a program sufficiently to achieve the former goals. This chapter provides a specification for the different modules of the model developed, following the method suggested in [ SS94 ], which consists in covering the following items for each predicate: – A procedure declaration stating the name and the arity. –Type declarations of its arguments. – A relation scheme , that is a precise statement written in English or another language that explains the relation computed by the predicate. – Details about usage modes . Because of Prolog unification it is possible to define predicates that can be used in multiple manners. The specification needs to guarantee which uses are correct. –Multiplicity of solutions , which states the number of solutions of the predicate for each possible usage. In addition to this information, the documented predicates will be grouped according to the modules in which they appear in, and we will also detail the interface of each module, in a similar way as the documentation of the Ciao system [ BCC+06 ]. This information should enable the user to combine the modules when necessary and also use them independently. Different modes are available in standard Prolog to describe the arguments of a predicate [ SS94 ][ BCC+06 ]. The convention is to use the symbol + for an instantiated argument (input value), the symbol - for an uninstanciated one (output value), ? for either and @ for an argument which is not further instantiated (not an output value). 42
5 SPECIFICATION: MODULES AND THEIR INTERACTION It is worth noticing that different usages of the same predicate have arguments with different modes. For example, the standard predicate append(Xs,Ys,Zs) for concatenating the lists Xs and Ys to produce Zs, can either be used as (+,+,-),(-,+,+) and even more variants. 5.1. Simulation 5.1.1. Module language_game The language_game module is the one in charge of controlling the flow of the execution. For each language game to play, it randomly chooses two agents and a meaning to communicate. After the game is played, both speaker and hearer make modifications to their own grammars and statistics are collected. At the end of the simulation then, we are able keep track of the agents taking part in each game, the meanings communicated, the sentences used by the speaker, the hearer’s interpretation of such sentences and whether there is agreement between the two. 5.1.1.1. Usage and interface •Library usage: :- use_module(language_game). •Predicates: – Exported predicates: main/1, roles_to_ports/4, report_ind/5 – Other relevant predicates: last_resultS/1, last_resultC/1 •Other modules used: – System library modules: dec10_io [tell/1, told/0], format [format/2], random [srandom/1, random/3], read [read/2], sockets [connect_to_socket/3, socket_shutdown/2], system [current_host/1], write [write_canonical/2, write/1] – Model modules: agent [ag_socket_port/2, write_stream/2], conceptual_sys [meaning/1], population [players/3, ini_players/1, population_size/1], utils [rnd_select/3, atom_and_number/2] 43
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.1.1.2. Documentation on relevant predicates main/1 PREDICATE main(X) X is a list of atoms of length 3 and of the form X = [NGames, NAgents, Step] . The first element stands for the number of games in this particular simulation, and the second for the number of agents that will be used in it. The predicate runs the simulation using the specified number of rounds and agents, displaying the results and progression along the way. Step is the numerical distance between points in the graphical representations produced, and therefore determines the rate at which statistics are collected. Usage 1: main(+X) - Description: Should X be instantiated to a list of atoms of length 3, then the first element is assumed to be the number of games and the second element is assumed to be the number of agents. This goal performs a simulation according to the parameters given and writes the results upon ending. If X is instantiated to any other kind of term this predicate fails. - The following properties should hold at call time: X must be instantiated to a compound term, this being a list of atoms of length 3. - The following properties should hold upon exit: A simulation with the specified number of rounds and agents is executed. last_resultS/1, last_resultC/1 DATA PREDICATE last_resultS(NS), last_resultC(NC) NS and NC are integer numbers. Usage 1: last_resultS(-NS), last_resultC(-NC) - Description: NS and NC indicate the number of times any two agents participating in a certain window of past language games achieved communicative success and coherence respectively. These predicates are updated dynamically and counters are set to 0 every Step language games (please refer to main/1 of this module). They are used to report statistical information at the end of the simulation. - The following properties should hold upon exit: Both NS and NC are instantiated to integer numbers representing the number of language games played with communicative success and coherence between agents among the past Step games. 44
5 SPECIFICATION: MODULES AND THEIR INTERACTION roles_to_ports/4 PREDICATE roles_to_ports(Speaker, Hearer, SPort, HPort) Speaker and Hearer are integer numbers which act as identifiers for particular agents. This predicate, provides the port numbers Sport and Hport that allow to communicate with the speaker and hearer in a language game. Usage 1: roles_to_ports(+Speaker, +Hearer, -SPort, -HPort) - Description: Sport and Hport are the port numbers associated with the speaker and the hearer respectively. They can be used to exchange messages with the corresponding agent. - The following properties should hold at call time: Both Speaker and Hearer are instantiated to integer numbers. - The following properties should hold upon exit: SPort is instantiated to the port number used by Speaker, and HPort to the port number used by Hearer. report_ind/5 PREDICATE report_ind(Game, NGames, NA, Host, Step) This predicate is used to collect statistics during the execution. All arguments are integers, except Host . Game represents the current game, NGames the total number of games, NA the number of agents and Step the distance between plot points. Host is the qualified name of the current host in which the program is run. Usage 1: report_ind(+Game, +NGames, +NA, +Host, +Step) - Description: This predicate sends a message to all agents in the simulation via a socket connection, provided that Step games have passed since the last time the same message was send. Upon receiving this signal, the agents report the number of adoptions and inventions and write the values in appropriate files, accessible after the simulation has finished. - The following properties should hold at call time: All arguments need to be instantiated to ground terms. 45
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.1.2. Module population This module is responsible for choosing which agents should participate in an arbitrary language game. To do so, it maintains the number of times each pair of agents have played together, and uses that information to select the 2 most suitable individuals. Selection is carried out at random, but enforcing that all agents speak approximately the same number of times to each other. Therefore, after selecting a speaker, the hearer candidates who have not spoken with that speaker many times have a higher chance of being picked. 5.1.2.1. Usage and interface •Library usage: :- use_module(population). •Predicates: – Exported predicates: ini_players/1, players/3, population_size/1 •Other modules used: – System library modules: random [random/3] – Model modules: utils [rnd_select/3] 5.1.2.2. Documentation on relevant predicates ini_players/1 PREDICATE ini_players(N) Nis an integer number. Usage 1: ini_players(+N) - Description: This predicate initialises an individual counter for each agent which monitors the amount of times that the agent has participated with each other agent in a language game. At the beginning, all the values are set to 0. - The following properties should at call time: N is instantiated to the number of agents in the simulation. 46
5 SPECIFICATION: MODULES AND THEIR INTERACTION players/3 PREDICATE players(N, Speaker, Hearer) N is an integer type representing the T-F game of the simulation, where T is the total number of games and F the number of games already played. The predicate unifies the integers Speaker and Hearer with the identifiers of the two agents who will take part in the next language game, playing the roles of speaker and hearer respectively. Usage 1: players(+N, -Speaker, -Hearer) - Description: First of all, the integer N is used to select a speaker number Speaker in a rotational fashion, so that if the total population of agents is P , each agent acts as a speaker every P games. After choosing the speaker, this goal finds another number Hearer such that the represented hearer is the agent to which Speaker has spoken less times. -The following properties should hold at call time: Nmust be instantiated. - The following properties should hold upon exit: Speaker and Hearer are instantiated to integer numbers. - Multiplicity of solutions: It can happen that there are several agents to which Speaker has spoken to less times. In such situations, one of them is chosen at random as Hearer. population_size/1 DATA PREDICATE population_size(P) Pis an integer number. Usage 1: population_size(-P) - Description: This predicate can be used to obtain the population size, that is the number of agents Ptaking part in the simulation - The following properties should hold upon exit: P is instantiated to an integer number. 5.2. Conceptual system 5.2.1. Module conceptual_sys This module is the one in charge of defining and producing the logical formulas, or meanings, that the agents try to communicate when playing language games. 47
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.2.1.1. Usage and interface •Library usage: :- use_module(conceptual_sys). •Predicates: – Exported predicates: alphabet/1, connectives/1, commutative_conns/1, meaning/1 new_exp/1, propositions/1 •Other modules used: – System library modules: random [random/3] – Model modules: utils [rnd_select/3] 5.2.1.2. Documentation on relevant predicates meaning/1 PREDICATE meaning(SM) The term SM is a list of 2 or 3 atoms representing a logical formula in prefix notation. Usage 1: meaning(-SM) - Description: This predicate generates a random meaning SM out of all the possible obtainable by combining the provided logical connectives, connectives(C) and prepositions propositions(A) . The new meaning can be then used in the current language game. - The following properties should hold at call time: The facts propositions(A) and connectives(C) should exist in the database. 48
5 SPECIFICATION: MODULES AND THEIR INTERACTION - The following properties should hold upon exit: SM is instantiated to a list of 2 or 3 elements, depending on the number of arguments of the logical connective chosen. The first element is an atom representing a logical connective out of the ones provided, and the other elements are atoms representing propositions. -Multiplicity of solutions: This predicate succeeds only once. new_exp/1 PREDICATE new_exp(E) E is a list of atoms which are all single characters and represents a random expression. Usage 1: new_exp(-E) - Description: This predicate generates an expression using the symbols in the alphabet provided, which is listed in alphabet(Z). - The following properties should hold at call time: The fact alphabet(Z) should exist in the database. - The following properties should hold upon exit: E becomes instantiated to a list of 3 to 6 elements, each one an atom representing a particular character. -Multiplicity of solutions: This predicate succeeds only once. 5.3. Generation and invention 5.3.1. Module generation The generation module implements functionalities that allow agents acting as speakers in a language game to construct expressions which can be effectively communicated to the hearing agents. This is achieved using Prolog’s parsing mechanism for Definite Clause Grammars, which on backtracking can be used to generate sentences from a given grammar. The present module also contains predicates that check the grammatical equivalence of two sentences expressing the same meaning with respect to a particular linguistic system and its associated conceptual system. 49
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.5. Adaptation 5.5.1. Module adaptation The agent acting as hearer learns from the outcomes of the languages games and modifies the rules in its grammar in order to be more successful in the future. This process is achieved by altering the weights of certain grammar rules involved in the parsing of the expression or competing rules with the ones used, as described in chapter 3. The overall process and functionality is implemented in this module. 5.5.1.1. Usage and interface •Library usage: :- use_module(adaptation). •Predicates: – Exported predicates: repair_scores/5 •Other modules used: – System library modules: dynamic [dynamic/1] – Model modules: conceptual_sys [commutative_conns/1, propositions/1], generation [generates/5], utils [clean_body/2] 5.5.1.2. Documentation on relevant predicates repair_scores/5 PREDICATE repair_scores(Exp, HMeaning, Rest, CanUnd, Agree) Exp is a list of characters representing the expression used by the speaker. HMeaning is a list of atoms which represents a non-recursive propositional logic formula constructed from a fixed set of propositions and one boolean function of one or two arguments or a proposition by itself. 56
5 SPECIFICATION: MODULES AND THEIR INTERACTION This expression is the one the hearer interpreted from Exp using its grammar rules. Rest is a list of other possible interpreted meanings. CanUnd is a boolean value that indicates whether or not the hearer could infer a meaning for Exp by itself or not. Agree is a boolean value that indicates if the meaning HMeaning inferred by the hearer is correct, that is, it is logically equivalent to the meaning the speaker had in mind. Usage 1: repair_scores(+E,+HMeaning,+RMeaning,+CanUnd,+Agree), - Description: This goal succeeds with no effect in case HMeaning is a propositional formula because the agents already have a common vocabulary for propositional symbols or basic categories. When HMeaning is a more complex formula, and in case CanUnd and Agree are both true, then this predicate reinforces the grammar rules that the hearer used to obtain HMeaning . It also discourages grammar rules used to obtain competing meanings. Next, it also discourages rules in the hearer’s grammar that generate competing sentences different from Efor expressing HMeaning. Finally, when Agree is false, then this predicate only discourages the rules used by the hearer to obtain the meaning HMeaning . In case there is no agree nor coherence nothing happens. Adaptation is done by altering the scores inherent to the affected rules, encouraging following the update S = S· (1 −µ ) + µ and discouraging S = S· (1 −µ ), where S is the score of the rule in question. The parameter µ controls the speed at which adaptation occurs, and it is called the alignment rate. In our case, it takes the value 0.1 by default. - The following properties should hold at call time: All variables need to be instantiated to ground terms. - The following properties should hold upon exit: Rules are updated and feedback written in the user interface, according to the behaviour given in the description of this goal. -Multiplicity of solutions: This goal succeeds with a deterministic result. 57
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.6. Induction 5.6.1. Module induction This module is responsible for implementing the induction capabilities of the agents. With those, the different participants in language games are able to effectively learn and generalise their rules. Induction is applied when an agent invents a new rule or adopts one from another agent. In our case, we only use the simplification operator as described in chapter 3. 5.6.1.1. Usage and interface •Library usage: :- use_module(induction). •Predicates: – Exported predicates: simplify/1 •Other modules used: – System library modules: dcg, dcg_expansion, dynamic, terms, write – Model modules: agent_params [new_rule_id/1], utils [clean_body/2] 5.6.1.2. Documentation on relevant predicates simplify/1 PREDICATE simplify(R) R is a well-formed Prolog grammar rule which has been recently invented by an agent or adopted by an agent from another agent. 58
5 SPECIFICATION: MODULES AND THEIR INTERACTION Usage 1: simplify(+R) - Description: This predicate tries to generalise the given rule by creating a new one which introduces variables to represent propositional symbols. This is done using the simplification mechanism already discussed. Given two different rules R and r 2with r 2being propositional and provided that the expression in r 2is a substring of the expression in R , then simplification can be applied to R by replacing the symbol in the meaning with a free variable, and replacing the substring in Rwith a non-terminal. - The following properties should hold at call time: R is instantiated to a grammar rule. - The following properties should hold upon exit: If simplification could be applied to the rule R provided, then R is replaced by the simplified rule in the agent’s grammar. 5.7. Agents 5.7.1. Module agent The agent module is the one in charge of simulating the behaviour of each agent participating in the simulation. It implements predicates which allow the agents to respond to incoming messages when acting as hearers and to speak to other agents when acting as speakers. This module is also responsible for collecting various information, such as the number of inventions and adoptions per agent or the agent’s inner grammar. This information is used at the end of the simulation to produce some statistics indicators of the overall process. 59
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.7.1.1. Usage and interface •Library usage: :- use_module(agent). •Predicates: – Exported predicates: main/1, ag_socket_port/2, write_stream/2 •Other modules used: – System library modules: concurrency [concurrent/1, eng_call/3], dynamic [dynamic/1], format [format/2], random [srandom/1], read [read/2], sockets [bind_socket/3, socket_accept/2], system [current_host/1], write [write/2, write_canonical/2] – Model modules: adaptation [repair_scores/5], agent_params [games_played/1, update_games_played/0, ... ... initialise/0], generation [generates/5, coherence/4], interpretation [understands/7], utils [atom_and_number/2, clean_atom/2, clean_body/2] 5.7.1.2. Documentation on relevant predicates main/1 PREDICATE main(X) X is a list of 2 arguments of the form X = [AgentNumber, Seed] . Here, AgentNumber is a single integer and it is understood as the identifier of the agent. Seed is an integer used as a seed for the random Prolog generator (in our case, it is computed automatically). Generally speaking, the behaviour of this predicate is to load the agent’s initial rules for expressing propositions and prepare the agent to read and respond to messages. Usage 1: main([+AgentNumber]) - Description: This predicate tries to satisfy in a separated engine stack (potentially a new thread) a routine that reacts to messages sent to this agent in either the roles of speaker or hearer. As a speaker, the expression generated to communicate a certain logical formula is sent back and to the agent acting as a hearer. 60
5 SPECIFICATION: MODULES AND THEIR INTERACTION As a hearer, the agent tries to interpret the expression received and updates its rules accordingly, depending on whether the inferred formula agrees with the one the speaker intended to communicate or not. This predicate also initialises the common vocabulary for each agent and data predicates needed for invention and adoption statistics. - The following properties should hold at call time: Agent number must be instantiated to a ground term. ag_socket_port/2 PREDICATE ag_socket_port(Port, NA) Both arguments are integers. Port indicates the number of the port associated to the agent with identifier NA. Usage 1: ag_socket_port(+Port, -NA) -Description: Obtain the identifier NA of the agent linked to port Port. - The following properties should hold at call time: Port is instantiated to a ground term. - The following properties should hold upon exit: NA is instantiated to an integer representing the agent associated to the port. Usage 2: ag_socket_port(-Port, +NA) -Description: Obtain the port number Port linked to the agent with identifier NA. - The following properties should hold at call time: NA is instantiated to a ground term. - The following properties should hold upon exit: Port is instantiated to an integer representing the port associated to the agent. write_stream/2 PREDICATE write_stream(Stream, Term) Stream is a Prolog stream and Term is any term to write in it. Usage 1: write_stream(+Stream, +Term) -Description: The term Term is written to the Stream. - The following properties should hold at call time: Both arguments are instantiated at call time. 61
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.7.2. Module agent_params This module defines several parameters that are part of the implementation of each agent in the population. The actual values of these parameters however, should be maintained individually by each agent, because they depend on the interaction history of each agent, which is different from the interaction histories of the rest of the agents in the population. First, it monitors the current number of the game being played by a particular agent. It also maintains the identifiers of past grammar rules created by this agent, so that the agent can select an appropriate identifier when adding new rules or inducing. Finally, it also implements a predicate that needs to be called prior to the start of the simulation and loads the rules for the propositional vocabulary and the initial variables needed. 5.7.2.1. Usage and interface •Library usage: :- use_module(agent_params). •Predicates: – Exported predicates: games_played/1, initialise/0, new_rule_id/1, update_games_played/0 •Other modules used: – System library modules: dcg_expansion [dcg_translation/2], dynamic[dynamic/1] – Model modules: conceptual_sys [new_exp/1, propositions/1] 5.7.2.2. Documentation on relevant predicates games_played/1 DATA PREDICATE games_played(N) Nis an integer value. 62
5 SPECIFICATION: MODULES AND THEIR INTERACTION Usage 1: games_played(-N) - Description: This is a changing data predicate which provides the number of games played by a particular agent at a certain point. - The following properties should hold at call time: The fact games_played(N) should exist in the database. - The following properties should hold upon exit: N is the number of the last game played. -Multiplicity of solutions: This predicate succeeds only once. initialise/0 PREDICATE initialise. This predicate describes an initialisation process conducted by all agents prior to the start of the simulation itself. Usage 1: initialise. - Description: Upon calling, the rules that allow the agents to express the common vocabulary for basic categories (which is assumed to be agreed on before starting the simulation) are created. The predicate also initialises the data predicates counting the number of rules created, its date and the number of games. - The following properties should hold upon exit: Data predicates representing number of games, rule identifiers and rule dates are added to the database, together with the initial grammar rules on basic propositions. The agent is in an appropriate state to start the simulation. new_rule_id/1 PREDICATE new_rule_id(Id) Id is an integer number representing the identifier that must be hold by the next rule asserted during the simulation. Usage 1: new_rule_id(-Id) - Description: Id is instantiated to the integer of the next rule identifier to be used, the one after the last rule created. This goal also sets the date of this new rule to the number of the current game. 63
5 SPECIFICATION: MODULES AND THEIR INTERACTION - The following properties should hold at call time: The data predicates rule_id/1 and games_played/1 must exist in the database. Their arguments should be integers representing the first free identifier for a rule and the number of games played respectively. - The following properties should hold upon exit: The fact rule_id(Id) is retracted and a new fact rule_id(Id1) is added, Id1 being Id+1 . A fact rule_date(Id,D) is also added, where Dis the number of the current game. 5.8. General functionality 5.8.1. Module utils This module implements various predicates that are of general interest. Typically, these are used by various modules and provide certain operations on data structures. Those predicates are not relevant to the user and not necessary to understand how the present model works, but we decided to list them here regardless for reference. 5.8.1.1. Usage and interface •Library usage: :- use_module(utils). •Predicates: – Exported predicates: atom_and_number/2, clean_body/2, flatten/2, insert_at/4 remove_at/4, rnd_permu/2, rnd_select/3, subseq_rest/4 •Other modules used: – System library modules: random [random/3] 64
5 SPECIFICATION: MODULES AND THEIR INTERACTION 5.8.1.2. Documentation on relevant predicates clean_body/2 PREDICATE clean_body(Body, BodyC) Body is instantiated to the body of a Prolog grammar rule. BodyC is of the same form but without the module prefixes added by the Ciao system. Usage 1: clean_body(+Body, -Body2) - Description:: This predicate strips the prefixes ’dao_chunk:’, ’multifile:’, ’lists:’ and ’iso_misc:’ from Body . To clean a rule body we first separate each literal in it. A literal representing the score constructed with the infix operator ’is’ needs no cleaning. For all other literals, we isolate the functor and keep stripping the prefixes added to it until there are none remaining. - The following properties should hold at call time: Body must be instantiated to the right-hand side of a Prolog grammar rule. - The following properties should hold upon exit: BodyC is instantiated with the same content and structure as Body , but stripping any prefixes of the form ’dao_chunk:’, ’multifile:’, ’lists:’ or ’iso_misc:’. 65
6 CASE STUDIES AND EXPERIMENTAL RESULTS We also observed the former reduction of adoptions in the previous transmission experiment, but now the change is more noticeable, and the number of adoptions drops from 56 in the third generation to 25 in the last one. This is explained because of the increase in the population, which allows more speaker-hearer combinations and thus contributes to sky-rocketing the number of adoptions in the first few generations. We can see that in fact, the number of adoptions in the last generation displayed (with a partially consolidated language) is more comparable to the one in the experiment with a population of 10 agents. Figure 6.4: Language system transmission experiment with a population of 50 agents playing 19200 language games. Generation shifts occur every 3800 language games. The results are averaged over 10 executions and using a step of 200 games. 72
7 PLANNING 7. Planning This project has been developed during the Spring semester of the academic year 2014-2015. More precisely, it began on the 14 th of February and will finish on the 24 th of June, when the submission deadline is set. The current chapter briefly explains the initial planning build during the initial and mandatory Project Management Course (GEP) and analyses the deviations encountered along the process. 7.1. Project Management Course (GEP) According to the university regulations, this document must be submitted a week before the date of the defense, which in our case is the 1 st of July. Those regulations also define a set of deadlines which were met successfully: -20th February 2015: Deliverable 1 (scope of the project). -25th February 2015: Deliverable 2 (temporal planning). -3rd March 2015: Deliverable 3 (budget and sustainability). -8th March 2015: Deliverable 4 (initial presentation). -15th Match 2015: Deliverable 5 (contextualisation and bibliography). -22nd March 2015: Deliverable 6 (computing specific module). -22nd March 2015: Deliverable 7 (presentation and final document). -28th April 2015: Progress meeting and report. -22nd June - 27th June 2015: Delivery of the final document. -1st July 2015: Defense. Our original schedule (previous to the start of development) and the different tasks in which the project was divided by then are represented in the Gantt chart shown below. The estimated duration for each task is also stated in the diagram. Assuming that 4.5 hours are dedicated to the project per day, the total amount of hours after combining all the tasks is of 550. This number makes it feasible to complete the project, given the appropriate amount of dedication. Note that a darker task colour in the Gantt chart denotes a task which is more difficult to complete than the rest. 73
7 PLANNING Figure 7.1: Gantt chart of initial tasks within the project and their durations and dependencies. 7.2. Deviations and corrections The initial planning of this work, shown in the previous section and derived from the GEP course, was general to a certain extend, owing to the research nature of this project. At the time of planning, some details about the implementation or the most appropriate course of action to solve possible problems were not well defined or known. Similarly, the experiments we would perform after successfully implementing the model were not established. Despite this imprecision, we have accomplished the original planning to a great extend, but with some alterations. During the development of the project minor difficulties have risen, and these have introduced some delay in the overall process and forced us to reconsider certain aspects. The initial research and familiarisation with the model took longer than expected, which caused delays in the successive implementation of each one of the modules. This implementation also took a bit longer than originally estimated to complete. 74
7 PLANNING A scenario like the former was already foreseen and accounted for. Because of this, we were able to simplify the implementation of some parts of the project, still achieving functionality and maintaining the original objectives. In particular, we used a simpler induction module which does not feature chunking for rule simplification. Also we cut the number of experiments planned from three to two, covering only language emergence and transmission. Still, with these we are providing good examples of how to use and customise the modules while obtaining relevant results. In economic terms there is not a significant change either. Unforeseen costs were calculated in case more hours were needed for unavoidable complications. However, given the simplifications we introduced in the model and the pruning of one of the planned experiments, the costs remain stable. 75
8 BUDGET AND SUSTAINABILITY 8. Budget and sustainability This last chapter covers the budget of the current project and its sustainability, taking into account the scope and planning previously defined. First of all, we find a description of the costs, both material and human. It follows an analysis of possible deviations and their potential affectation. Finally, the project is viewed from the economical, social and environmental perspectives. 8.1. Budget estimation We will now consider the required budget in order to complete the project. Expenses are divided in three different sections, depending on the nature of the resources considered: hardware, software and human. At the end, all sections are combined in a comprehensive table covering the global cost of the project. It is worth noticing that the depreciations presented are computed based on the estimated lifetime for each product and the assumption that the project is going to last 4 months. 8.1.1. Hardware resources Hardware resources are described in Table 2. The project itself can be completed using only one computer, and no other machinery is required. This computer can be an average model with no particular requirements and will be used in all tasks, from the initial research and planning to the final presentation and document. Therefore hardware costs are considered general. Product Price Estimated lifetime Time used Depreciation Laptop (with peripherals) e1000.00 4 years 4 months e84.00 Total e1000.00 - - e84.00 Table 2: Hardware budget components. 8.1.2. Software resources Table 3 shown below summarises the costs of the necessary software to develop our project. The VirtualBox software and the Debian operating system will mainly be used during development and testing, and the other tools will be used in all tasks. Software costs are also regarded as general costs. 76
8 BUDGET AND SUSTAINABILITY Product Price Estimated lifetime Time used Depreciation Microsoft Windows 8.1 e120.00 4 years 4 months e10.00 Debian 6.0 Free 4 years 3 months - Oracle VM VirtualBox 4.3.28 Free 4 years 3 months - Ciao Prolog 1.10#8 Free 4 years 4 months - Emacs 23.4 Free 4 years 4 months - L A T EX(TexStudio 2.8.8) Free 4 years 4 months - Dropbox Free 4 years 4 months - Total e120 - - e10.00 Table 3: Software budget components. 8.1.3. Human resources This project could be executed by 3 individuals with differentiated roles. Table 4 describes the cost of the human resources needed in this case. Because human resources are considered direct costs, Table 5 summarises the distribution of the expenses among the project tasks given in figure 7.1. Role Estimated time Amount per hour Cost Project manager (M) 130 h e40 e5200.00 Computer Science researcher (R) 356 h e25 e8900.00 Model tester (T) 72 h e20 e1440.00 Total 558 e28.33 e15540.00 Table 4: Human resources budget. As it can be observed, the project manager will be responsible for general planning, supervising and resolving any logistical issues that may arise. However, the development process will be completed entirely by the researcher, who needs to implement the model itself. Finally, the tester is the person who will perform the final tests and validate the model. The latter will also take part in the development process, as a good amount of the tests need to be performed after the completion of certain modules. Therefore, because of the iterative and incremental developing methodology used in this project, the researcher and the tester need to work together. 77
8 BUDGET AND SUSTAINABILITY Task Days Hours per day Resource Cost General planning 29 4.5 M e5200.00 Initial research 23 4.5 R e2587.50 Implementation and documentation 50 4.5 R, T e5400.00 Experiments 7 4.5 R,T e755.00 Documentation of use cases 9 4.5 R e1012.50 Model validation and analysis 3 4.5 T e270.00 Finalisation 3 4.5 R,T e303.75 Table 5: Human resources budget split among tasks in figure 7.1. 8.1.4. Indirect costs We also need to consider some indirect cost derived from using the previous resources and from tools such as internet or printers. Those are summarised in Table 6. Component Cost Electricity (0.1 kW / 600 hours) e15.00 Internet e40.00 Paper and printing e20.00 Total e75.00 Table 6: Summary of indirect costs. 8.1.5. Unforeseen costs It is necessary to account for some non-predicted circumstances that may cause the project to be more expensive than previously planned as well. For example, it may be possible that more working hours are required in order to complete the project because the development did not proceed as expected. Another possibility is that our computer becomes unusable at some point during the project due to a software or hardware error. Table 7 summaries those costs and the reserved amount considered, which is proportional to the probability of an unforeseen circumstance occurring. 78
8 BUDGET AND SUSTAINABILITY Component Risk Cost Amount reserved Laptop crash 0.05 e800.00 e40.00 Extended project time 0.25 e4000.00 e1000.00 Total e1040.00 Table 7: Summary of unforeseen costs. 8.1.6. Cumulative budget Using data from the previous tables, this section summarises all costs within the project. Here, some additional contingency amount has been added for impediments, amounting to a 10% of the total budget. The results are displayed in Table 8 below. Component Cost Hardware resources e84.00 Software resources e10.00 Human resources e15540.00 Indirect costs e75.00 Contingency item (10%) e1572.10 Unforeseen costs e1040.00 Total e18321.10 Table 8: Final complete budget. 8.2. Budget control It is possible that the development of the project does not fit the a priori established plan. This is due to the limited amount of time and the complexity associated to the model. Nevertheless, in the event of any difficulty, it is certain that we will not need any additional software or hardware resources, as only technical difficulties can arise. Also, if there were any problems with the software before mentioned, we could use a free alternative available on the market. To sum up, the hardware and software budgets will most likely remain stable. 79
8 BUDGET AND SUSTAINABILITY The development process is divided in various modules and takes a great portion of the total time, involving the researcher and the tester in it. We need to take into account that if the complexity of the project scales, we may require them to work more hours and consequently, to be paid more. Hiring additional workers will not help in this situation, because it is very complicated for a newcomer to make useful contributions to a partially finished model. The cost that such a circumstance may incur has already been considered as an unforeseen cost in our estimations. To keep track of the discrepancies between the real cost of the project and the cost here computed, we will maintain the real amount expended for each one of the completed tasks in a file. At the end of a task then, we will be able to compute the deviation between the real and the hypothetical cost. Using this strategy we can quickly detect those deviations, identify where and why they occurred and calculate the additional cost necessary. 8.3. Sustainability of the project 8.3.1. Economic sustainability This is a research-oriented project and its aim is not to build a product that may be directly purchased by customers. While in the future it may help to develop or improve other systems, at the moment is not integrated to any bigger project. The salaries of the employees comprise nearly all the budget established for this project. In contrast, the hardware and software is cheap and constitutes a very small portion of the total cost. The total amount is very reduced and adapted to a project of this size and character. Finally, I would like to remark that it is not possible to replicate this project in significantly less time, unless code of a previous similar implementation is recycled. In the same fashion, the whole model implemented, or parts of it, may be included in other programs or products. We will regard this project as completely viable from the economic point of view, for its price is very affordable and it does not require using expensive equipment or working in large teams. 80
8 BUDGET AND SUSTAINABILITY 8.3.2. Social sustainability With this project, we want to investigate human communicative processes and language evolution. Even though the topic is closely related to humans, the project does not directly provide any immediate benefit to the society. Similarly, and because no product is built, there is not any improvement in the consumer’s quality of life or any harm to a particular individual or collective. In the future, some other investigations or ideas may use the result of this project to aid them in developing new products that may actually be useful. This is, in part, one of the objectives of conducting this research. This project however, does not contribute to enhancing the quality of life of any member of the society nor user. The model implemented does not directly nor necessarily unfold any enhancement in this regard. Nevertheless, it provides a tool for other researchers to further investigate in the area of language origin and evolution, which may eventually report some benefits. 8.3.3. Environmental sustainability It is within general understanding that, after completing the project, a computer is a product that can be used for a broad range of tasks, deprecating its own cost. Since the other resources needed are mainly software, the only non environmentally friendly resource is the electricity needed to run the computer. However, even this is not an important amount compared to what a typical student would use. We can compute an estimation of the CO 2 produced based on electricity consumption. According to governmental sources, the energy mix in Spain is approximately 267g of CO2per kWh. Using this data, and assuming a computer with 100W of power working an average of 5 hours per day, the carbon footprint of this project is around 15kg of CO2. For the aforementioned reasons, we consider this project to be very low resource-consuming, since it only requires software products and a simple computer, and the electricity consumption and carbon emissions are kept in a low level. The materials employed in building the computer and manufacturing the software are certainly complicated to estimate, but at any rate, not likely to be particularly harmful. 81