Centro de Investigación en Computación
www.jesusolivares.com
The Knowledge Portal

mail@jesusolivares.com

XI CO
idioma
Español
 
 
 
Portal

Introduction

MIA Model

LIA Language

Mixed Ontologies

SEA System

User Manual

Publications

Contacts

Interaction among Agents
Agent Interaction Language

The Interaction among Agents Language (Lenguaje de Interacción entre Agentes (LIA)) let the user to define environments containing Agents and Scripts (Interactions) where the agents interact among them to reach its purposes.

The Environment is modeled using global and regional variables. The global variables are those that any agent's thread have access to read and write. The regional variables are visible for access to those agents that declare them explicitly. Example of global and regional variables:

global {  // GLOBAL VARIABLES
    int Reloj ;
    port pcliente ; // PORT WHERE A CLIENT RECEIVE MESSAGES
    port pprovedor ; // PORT WHERE A PROVIDER RECEIVE MESSAGES
    char id_msg[30] ;
    int duracion, lectores ;
}
regional { // REGIONAL VARIABLES
     float localidad ;
     char  sucursal[40] ;
}
NOTE: Comments are written after the slashes (//)

The Agents are declared with its regional, internal variable, that represent its resources and characteristics, its purposes, the unexpected events that afect to it, the actions that are used to deal with that events, and the inital roles that the agent starts when it is created. An example of an agent:

agent Cliente {  // AGENT
    regional { 
      localidad ;
    }
    internal { // AGENT INTERNAL VARIABLES
       char tiene[30], dinero[30], comidaAporta[30], 
            obtiene[30], quiere[30], desea[30], 
            ofrece[30], alimento[30]  ;
       char articulo[100] ; int comprar_a ;
    }
    purpose { // AGENT'S PURPOSES
        vacaciones_cancun ; // INTERPRETED LIKE vacaciones(cancun)
     }
    percieve { // UNEXPECTED EVENTS THAT PERCEIVE THE AGENT
       lluvia, terremoto, caida  ;
    }
    action { // ACTIONS TO DEAL WITH UNEXPECTED EVENTS
       pedirAyuda  ;
    }
    initial { // INITIAL ROLES
       esperar  ;
    }
}

The LIA scripts are declared using the reserved word interaction. Each interaction contains the roles that compose to it. Each role has indicated the resources that are used in it and the number of active instances of it when in execution, for example, president of a corporation exists only 1, but worker in a factory exist 40 or more. Within each role are indicated the resources or characteristic that must fulfil an agent to occupy it, also the positive and negative effects in the agent that produces when it is executed. The sintax of the effects is predicate_value that is interpreted as predicate(value). A role also contains their local variables and the instructions that form it. Example:

    interaction Buscando {
    role buscador(producto, oferta)[instances 1] {
    requisite {
      ofrece_oferta, dinero_oferta, desea_producto, alimento_producto ;
    }
    positive {
     quiere_producto ;
    }
    negative {
      ofrece_oferta ;
    }
    local  {
       char logro[100] ;
       char linea[100] ;
       int encontro ;
    }
   
   linea := "Buscando ";
   append(linea, articulo);
   print(linea);
   mensaje := "( BUY ARTICULO ";
   append(mensaje ,articulo);
   tmp := " )";
   append(mensaje ,tmp);
   id_msg := "mensaje1";
   lectores = 10;
   duracion = 120; // EN SEGUNDOS
   // ISSUE A MESSAGE CONTAINING CUSTOMER DESIRES
   out(pcte, id_msg, mensaje, lectores, duracion);
   // WAIT A TIME IN ORDER THE SELLER AGENTS KNOW ABOUT CUSTOMER DESIRES
   wait(10);
   encontro = 0;
   while( encontro == 0 )  { 
      // ACCEPT A BID
      id_msg := "acuerdo";
      espera = 100;
      accept(pcte, id_msg, linea, espera);
      // CHECK IF IT CAN BE SATISFIED
      dato:= "ARTICULO";
      extract(solicitud, dato, cual);
      compare(cual, articulo, resultado);
      // IF IT CAN BE SATISFIED
      if( resultado == 1 )  { 
          encontro = 1;
      }
   }   
   logro := "quiere_";
   append(logro, desea); // 'ARTICULO'
   goal(logro);  // INDICATE THAT AN ARTICLE HAS BEEN OBTAINED
                 // IT THE ARTICLE IS THE DESIRED THEN THE GOAL WAS REACHED
  }
}

LIA instructions of the current version are:

INSTRUCTION

DESCRIPTION

if

this instruction is to control the execution flow when a condition is evaluated to true or false. When true is the result then the instructions set of the if are executed.

while

this instruction is to control the execution flow when a set of instructions is repeated while a condition is evaluated to true

print

display the contents of a variable or a constant string

addagent

it is used to create instances of an agent. Requires the agent class to create an instance, the name of the new agent, purposes of this agent and initial values to their internal variables. It is used only in main

addinteract

it is used to create instances of an interaction. Requires the interaction class to create an instance, and the name of the created interaction. It is used only in main

goal

indicates when a purpose has been reached, the predicate is sought in an agent purposes and cause that the subsequent papers of the plan generated for that purpose become canceled even if they are in execution.

out

puts an agent's message into a port

accept

lets an agent to take a message from a port

deletemessage

deletes a message that the same agent has placed into a port

append

concatenates a constant string at the end of another constant string. The first one is added to the end of the second one

extract

extracts the value of a string using as a prefix the contents of other string

compare

indicates the result when compares two strings

wait

pauses the execution of the thread during the seconds indicated

arithmetic expressions

assigns the result of an arithmetic expression to a variable

string expression

operates string expressions

Any LIA environmet contains a main section that starts the execution of the system. Here instances of the first agents and scripts are created. An example:

main() 
{
   print("Industria del Maíz");
   // INTERACTION CREATION
   addinteract(Casa ,casaAntonio );
   addinteract(Mercado,CentralAbasto);
   addinteract(Buscando, Buscar);
   // AGENTS CREATION
   addagent(Cliente , Antonio, // ANTONIO IS A CLIENTE AGENT
         obtiene_energia,  // MORE PURPOSES ARE ADDED
         ofrece := "dinero"; // INTERNAL VARIABLES ARE ASSIGNED INITIAL VALUES
         desea := "tortillas"; alimento := "tortillas"; 
         dinero := "dinero"; comidaAporta := "energia"; 
         articulo := "MAIZ-SEMILLA";
         ontology := "cliente" ); // ONTOLOGY USED BY THE AGENT

   addagent(Provedor, Rafael, 
         gana_dinero,  
         ofrece := "maíz"; desea := "dinero"; recurso := "dinero";
         persona := "humano"; capta := "humano";  
         producto := "MAIZ-SEMILLA-BLANCO"; precio := "80.00"; 
         id := "1"; ontology := "provedor" );

   addagent(Provedor, Juan, 
         gana_dinero,  
         ofrece := "maíz"; desea := "dinero"; recurso := "dinero";
         persona := "humano"; capta := "humano"; 
         producto := "MAIZ-JARABE"; precio := "15.00"; id := "2";
         ontology := "provedor" );

   addagent(Provedor, Esteban, 
         gana_dinero, 
         ofrece := "maíz"; desea := "dinero"; recurso := "dinero";
         persona := "humano"; capta := "humano"; 
         producto := "MAIZ-FRUCTUOSA"; precio := "12.00"; id := "3";
         ontology := "provedor" );
}

<< MIA Model >> Mixed Ontologies

© Adolfo Guzmán, Jesús Olivares, Carmen Domínguez Last update june 2003 mail@jesusolivares.com México