Gerenciamento de Contratos em Sistemas Multi-Agentes Abertos Cynthia Luiza Rigo Moisés Roteiro • Introdução • Fase Atual • Estudo de Caso • Trabalho Futuro • Referências © LES/PUC-Rio Introdução • Definição: – A software system is viewed as a set of communicating components whose interaction is based on precisely defined specifications of mutual obligation – Contracts [Meyer, 1992] – Cada participante espera alguns benefícios do contrato e se propõe a cumprir com algumas obrigações para consegui-los. © LES/PUC-Rio Introdução • O contrato protege ambas partes: – Protege o cliente especificando o quanto deve ser feito: o cliente é intitulado a receber um determinado resultado. – Protege o contratado especificando o mínimo aceitável: o contratado não deve ser responsável por tarefas fora do escopo especificado. • Contratos baseiam-se na noção de serviços oferecidos e requisitados. © LES/PUC-Rio Fase atual • Estudando como modelar contratos de componentes para MAS • Artigo base: – Des composants aux services, une approche par contrats. H. Belhaouari, F. Peschanski, J. Malenfant. Journées.. Canet en Roussillon, France, October 2006. – Apresenta a plataforma Tamago, associando o conceito de interfaces de componentes (modelo proposto por Fractal) e a teoria de Design by Contract. © LES/PUC-Rio Estudo de Caso • Supply Chain Management © LES/PUC-Rio Estudo de Caso • Tamago define 4 tipos de contratos: – Contrato de Serviço – Contrato de Componentes – Contrato de Assembly – Contrato de Composição © LES/PUC-Rio Estudo de Caso © LES/PUC-Rio Estudo de Caso Contrato de Serviço service RawMaterialSupplyService { property read boolean cpuDelivered ; property read boolean motherboardDelivered ; property read boolean memoryDelivered ; property read boolean driveDelivered ; method motherboardDelivery { pre ¬motherboardDelivered fail “MotherBoard already delivered” ; post motherboardDelivered fail “MotherBoard should be delivered” ; } ... } © LES/PUC-Rio Estudo de Caso Contrato de Componente component Manufacturer { provide ManufactureService; require RawMaterialSupplyService as supplier, TransportationService as distributor; property read boolean pcAssembled ; method assemblePC { pre supplier.cpuDelivered supplier.motherboardDelivered supplier.memoryDelivered supplier.driveDelivered ¬pcAssembled; Post pcAssembled; } method sendPCToRetail { pre pcAssembled; post distributor.pcDeliveryConcluded; } } © LES/PUC-Rio Estudo de Caso Contrato de Assembly assembly SupplyChain { use Retailer as retailer1; use ProductionCenter as prodCenter; bind service ManufacturerService client retailer1 provider prodCenter.manufacture1; } © LES/PUC-Rio Estudo de Caso Contrato de Composição composite ProductionCenter { use Manufacturer as manufacturer1; use Supplier as supplier1; use Distributor as distributor1; bind service RawMaterialSupplyService client manufacture1.supplier provider supplier1; bind service TransportationService client manufacture1.distributor provider distributor1; export ManufacturerService by manufacture1; export TransportationService by distributor1; } © LES/PUC-Rio Estudo de Caso Contrato de Serviço com Comportamento service RetailerProductService { provide RetailProductService; require ManufactureService as manufacture, TransportationService as distributor; property boolean waitingNewOrder ; property boolean receivedOrder ; property boolean concludedProduction ; method receiveOrder {} method orderProduction {} method deliveryOrderToCustomer {} behavior { ... } } © LES/PUC-Rio Estudo de Caso Contrato de Serviço com Comportamento – Continuação... behavior { default waitingNewOrder; state waitingNewOrder { allow action receiveOrder {}; } state receivedOrder { allow action orderProduction {}; } state concludedProduction { allow action deliveryOrderToCustomer{}; } transition from waitingNewOrder to receivedOrder with receiveOrder transition from receivedOrder to concludedProduction with orderProduction transition from concludedProduction to waitingNewOrder with deliveryOrderToCustomer } © LES/PUC-Rio Trabalhos Futuros • Definir uma terminologia para a representação de contratos – Normas x Asserções x Estruturas de Verificação • Estudar outros tipos de contratos: – [Beugnard et al] classifica contratos entre componentes em 4 tipos: básico, comportamental,de sincronização e quantitativo • Estudar o conceito de refinamento de contratos • Estudar um Modelo de Coordenação • Implementação de um Estudo de Caso © LES/PUC-Rio Bibliografia • • • • • • • • • • [1] H. Belhaouari, F. Peschanski, J. Malenfant. Journées. Des composants aux services, une approche par contrats. Canet en Roussillon, France, October 2006. [2] B. Meyer, Applying 'Design by Contract'. Interactive Software Engineering. October 1992, pages 40--52. [3] Beugnard, Antoine; Jézéquel, Jean-Marc; Plouzeau, Noel; Watkins, Damien.Making Components Contract Aware; [4] Object-Oriented Software Construction. Second Edition. Betrand Meyer. Prentice Hall, 1988. [5] J. Ferber et O. Gutknecht, Admission of Agents in Groups as a Normative and Organizational Problem. Workshop on Norms and Institutions in MultiAgent Systems, ACM Press, 2000. [6] J. Ferber et O. Gutknecht, A Meta-Model for the Analysis and Design of Organizations in Multi-Agent Systems. 3rd International Conference on MultiAgent Systems. (ICMAS'98), Paris, 1998, pages 128--135. [7] Dignum, Virginia; Dignum, Frank; Sonenberg, Liz. Towards Dynamic Reorganization of Agent Societies [8] Ranjit Nair; Milind Tambe ; Stacy Marsella. Role Allocation and Reallocation in Multiagent Teams: Towards A Practical Analysis. [9] A. Drogoul et A. Collinot, Applying an Agent-Oriented Methodology to the Design of Artificial Organisations: a Case Study in Robotic Soccer, Journal of Autonomous Agents and Multi-Agent Systems (JAAMAS),Springer-Verlag, 1998 © LES/PUC-Rio Bibliografia • • • • • • • • [10] The Eiffel Language. http://archive.eiffel.com/ [11] Collet (P.) et Rousseou (R.), Confract : un modèle de contrat pour la plateforme fractal, 2004. [12] J. C. Laprie, J. Arlat, J. P. Blanquart, A. Costes, Y. Crouzert, Y. Deswarte, J. C. Fabre, H. Guillermain, M. Kaâniche, K. Kanoun, C. Mazet, D. Powel, C. Rabéjac, and P. Thévenod. Dependability Handbook (2nd edition) Cépaduès – Éditions, 1996. (ISBN 2- 85428-341-4) (in French). [13] Algirdas Avizienis, Jean-Claude Laprie, Brian Randell: Dependability and its threats - A taxonomy. IFIP Congress Topical Sessions 2004: 91-120. [14] Silva, Viviane Torres da; Lucena, Carlos José Pereira de. Classifying and Describing Agent Contracts and Norms. In: Agents, Norms and Institutions for Regulated Multiagent Systems (ANIREM), 2005, Utrecht, The Netherlands. [15] von Staa, Arndt. Programação modular : desenvolvendo programas complexos de forma organizada e segura. Rio de Janeiro: Campus , 2000. [16] Collet, P.; Deveaux, D.; Rousseau, R.; “Contract-based Testing: from Objects to Components”; Proceedings of the IWoTA 2004 First International Workshop on Testability Assessment; Los Alamitos, CA: IEEE Computer Society; 2004; pags 5-14. [17] Frison, P.; Jézéquel, J-M.; “Increase Software Trustability with SelfTestable Classes in Java”; Proceedings of the ASWEC 2001 Australian Software Engineering Conference; Los Alamitos, CA: IEEE Computer Society; 2001; section 0003. © LES/PUC-Rio