multi-agent machine learning - buch.de · multi-agent machine learning a reinforcement approach...

15

Upload: dinhbao

Post on 13-Aug-2019

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University
Page 2: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University
Page 3: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Multi-Agent MachineLearning

Page 4: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University
Page 5: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Multi-Agent MachineLearning

A Reinforcement Approach

Howard M. SchwartzDepartment of Systems and Computer Engineering

Carleton University

Page 6: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Copyright © 2014 by John Wiley & Sons, Inc. All rights reserved

Published by John Wiley & Sons, Inc., Hoboken, New JerseyPublished simultaneously in Canada

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form orby any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except aspermitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the priorwritten permission of the Publisher, or authorization through payment of the appropriate per-copy fee tothe Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978)750-4470, or on the web at www.copyright.com. Requests to the Publisher for permission should beaddressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030,(201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts inpreparing this book, they make no representations or warranties with respect to the accuracy orcompleteness of the contents of this book and specifically disclaim any implied warranties ofmerchantability or fitness for a particular purpose. No warranty may be created or extended by salesrepresentatives or written sales materials. The advice and strategies contained herein may not be suitablefor your situation. You should consult with a professional where appropriate. Neither the publisher norauthor shall be liable for any loss of profit or any other commercial damages, including but not limited tospecial, incidental, consequential, or other damages.

For general information on our other products and services or for technical support, please contact ourCustomer Care Department within the United States at (800) 762-2974, outside the United States at (317)572-3993 or fax (317) 572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print maynot be available in electronic formats. For more information about Wiley products, visit our web site atwww.wiley.com.

Library of Congress Cataloging-in-Publication Data:

Schwartz, Howard M., editor.Multi-agent machine learning : a reinforcement approach / Howard M. Schwartz.

pages cmIncludes bibliographical references and index.ISBN 978-1-118-36208-2 (hardback)

1. Reinforcement learning. 2. Differential games. 3. Swarm intelligence. 4. Machine learning. I. Title.Q325.6.S39 2014519.3–dc23

2014016950

Printed in the United States of America

10 9 8 7 6 5 4 3 2 1

Page 7: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Chapter 1 A Brief Review of Supervised Learning . . . . . . . . . 1

1.1 Least Squares Estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Recursive Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.3 Least Mean Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.4 Stochastic Approximation . . . . . . . . . . . . . . . . . . . . . . . . . 10

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Chapter 2 Single-Agent Reinforcement Learning . . . . . . . . . . 12

2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.2 n-Armed Bandit Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.3 The Learning Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.4 The Value Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.5 The Optimal Value Functions . . . . . . . . . . . . . . . . . . . . . . . 18

2.5.1 The Grid World Example . . . . . . . . . . . . . . . . . . . . . 202.6 Markov Decision Processes . . . . . . . . . . . . . . . . . . . . . . . . 23

2.7 Learning Value Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 25

2.8 Policy Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

2.9 Temporal Difference Learning . . . . . . . . . . . . . . . . . . . . . . 28

2.10 TD Learning of the State-Action Function . . . . . . . . . . 30

v

Page 8: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

vi Contents

2.11 Q-Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

2.12 Eligibility Traces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Chapter 3 Learning in Two-Player Matrix Games . . . . . . . . . . 38

3.1 Matrix Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

3.2 Nash Equilibria in Two-Player Matrix Games . . . . . . . 42

3.3 Linear Programming in Two-Player Zero-Sum Matrix

Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

3.4 The Learning Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

3.5 Gradient Ascent Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 47

3.6 WoLF-IGA Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

3.7 Policy Hill Climbing (PHC) . . . . . . . . . . . . . . . . . . . . . . . . . 52

3.8 WoLF-PHC Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

3.9 Decentralized Learning in Matrix Games . . . . . . . . . . . 57

3.10 Learning Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

3.11 Linear Reward–Inaction Algorithm . . . . . . . . . . . . . . . . . 59

3.12 Linear Reward–Penalty Algorithm . . . . . . . . . . . . . . . . . . 60

3.13 The Lagging Anchor Algorithm . . . . . . . . . . . . . . . . . . . . . 60

3.14 LR−I Lagging Anchor Algorithm . . . . . . . . . . . . . . . . . . . . 62

3.14.1 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Chapter 4 Learning in Multiplayer Stochastic Games . . . . . . 73

4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

4.2 Multiplayer Stochastic Games . . . . . . . . . . . . . . . . . . . . . . 75

4.3 Minimax-Q Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

4.3.1 2 × 2 Grid Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804.4 Nash Q-Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

4.4.1 The Learning Process . . . . . . . . . . . . . . . . . . . . . . . . . 954.5 The Simplex Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

4.6 The Lemke–Howson Algorithm . . . . . . . . . . . . . . . . . . . . 100

4.7 Nash-Q Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

4.8 Friend-or-Foe Q-Learning . . . . . . . . . . . . . . . . . . . . . . . . . . 111

4.9 Infinite Gradient Ascent . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

Page 9: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Contents vii

4.10 Policy Hill Climbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

4.11 WoLF-PHC Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

4.12 Guarding a Territory Problem in a Grid World . . . . . . 117

4.12.1 Simulation and Results . . . . . . . . . . . . . . . . . . . . . . . 1194.13 Extension of LR−I Lagging Anchor Algorithm to

Stochastic Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

4.14 The Exponential Moving-Average Q-Learning

(EMA Q-Learning) Algorithm . . . . . . . . . . . . . . . . . . . . . . . 128

4.15 Simulation and Results Comparing EMA

Q-Learning to Other Methods . . . . . . . . . . . . . . . . . . . . . . 131

4.15.1 Matrix Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1314.15.2 Stochastic Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

Chapter 5 Differential Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

5.2 A Brief Tutorial on Fuzzy Systems . . . . . . . . . . . . . . . . . 146

5.2.1 Fuzzy Sets and Fuzzy Rules . . . . . . . . . . . . . . . . . . . 1465.2.2 Fuzzy Inference Engine . . . . . . . . . . . . . . . . . . . . . . . 1485.2.3 Fuzzifier and Defuzzifier . . . . . . . . . . . . . . . . . . . . . . 1515.2.4 Fuzzy Systems and Examples . . . . . . . . . . . . . . . . . . 152

5.3 Fuzzy Q-Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

5.4 Fuzzy Actor–Critic Learning . . . . . . . . . . . . . . . . . . . . . . . 159

5.5 Homicidal Chauffeur Differential Game . . . . . . . . . . . . . 162

5.6 Fuzzy Controller Structure . . . . . . . . . . . . . . . . . . . . . . . . . 165

5.7 Q(𝝀)-Learning Fuzzy Inference System . . . . . . . . . . . . . 166

5.8 Simulation Results for the Homicidal Chauffeur . . . . 171

5.9 Learning in the Evader–Pursuer Game with Two

Cars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

5.10 Simulation of the Game of Two Cars . . . . . . . . . . . . . . . 177

5.11 Differential Game of Guarding a Territory . . . . . . . . . . . 180

5.12 Reward Shaping in the Differential Game

of Guarding a Territory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

5.13 Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

5.13.1 One Defender Versus One Invader . . . . . . . . . . . . . 1855.13.2 Two Defenders Versus One Invader . . . . . . . . . . . . 191References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

Page 10: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

viii Contents

Chapter 6 Swarm Intelligence and the Evolutionof Personality Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

6.2 The Evolution of Swarm Intelligence . . . . . . . . . . . . . . . 200

6.3 Representation of the Environment . . . . . . . . . . . . . . . . 201

6.4 Swarm-Based Robotics in Terms

of Personalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

6.5 Evolution of Personality Traits . . . . . . . . . . . . . . . . . . . . . 206

6.6 Simulation Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

6.7 A Zero-Sum Game Example . . . . . . . . . . . . . . . . . . . . . . . . 208

6.7.1 Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2086.7.2 Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

6.8 Implementation for Next Sections . . . . . . . . . . . . . . . . . . 216

6.9 Robots Leaving a Room . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

6.10 Tracking a Target . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

6.11 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

Page 11: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Preface

For a decade I have taught a course on adaptive control. The course focused onthe classical methods of system identification, using such classic texts as Ljung[1, 2]. The course addressed traditional methods of model reference adaptivecontrol and nonlinear adaptive control using Lyapunov techniques. However,the theory had become out of sync with current engineering practice. As such,my own research and the focus of the graduate course changed to include adap-tive signal processing, and to incorporate adaptive channel equalization andecho cancellation using the least mean squares (LMS) algorithm. The coursename likewise changed, from “Adaptive Control” to “Adaptive and LearningSystems.”My research was still focused on system identification and nonlinearadaptive control with application to robotics. However, by the early 2000s, Ihad started work with teams of robots. It was now possible to use handy robotkits and low-cost microcontroller boards to build several robots that couldwork together. The graduate course in adaptive and learning systems changedagain; the theoretical material on nonlinear adaptive control using Lyapunovtechniques was reduced, replaced with ideas from reinforcement learning. Awhole new range of applications developed. The teams of robots had to learnto work together and to compete.

Today, the graduate course focuses on system identification using recursiveleast squares techniques, some model reference adaptive control (still usingLyapunov techniques), adaptive signal processing using the LMS algorithm,and reinforcement learning using Q-learning. The first two chapters of thisbook present these ideas in an abridged form, but in sufficient detail to demon-strate the connections among the learning algorithms that are available; howthey are the same; and how they are different. There are other texts that coverthis material in detail [2–4].

ix

Page 12: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

x Preface

The research then began to focus on teams of robots learning to work together.The work examined applications of robots working together for search andrescue applications, securing important infrastructure and border regions. Italso began to focus on reinforcement learning and multiagent reinforcementlearning. The robots are the learning agents. How do children learn how toplay tag? How do we learn to play football, or how do police work togetherto capture a criminal? What strategies do we use, and how do we formulatethese strategies? Why can I play touch football with a new group of peopleand quickly be able to assess everyone’s capabilities and then take a particularstrategy in the game?

As our research team began to delve further into the ideas associated withmultiagent machine learning and game theory, we discovered that the pub-lished literature covered many ideas but was poorly coordinated or focused.Although there are a few survey articles [5], they do not give sufficient detailsto appreciate the different methods. The purpose of this book is to introducethe reader to a particular form of machine learning. The book focuses onmultiagent machine learning, but it is tied together with the central theme oflearning algorithms in general. Learning algorithms come in many differentforms. However, they tend to have a similar approach. We will present the dif-ferences and similarities of these methods.

This book is based onmy ownwork and the work of several doctoral andmas-ters students who have worked under my supervision over the past 10 years. Inparticular, I would like to thank Prof. Sidney Givigi. Prof. Givigi was instru-mental in developing the ideas and algorithms presented in Chapter 6. Thedoctoral research of Xiaosong (Eric) Lu has also found its way into this book.The work on guarding a territory is largely based on his doctoral dissertation.Other graduate students who helped me in this work include Badr Al Faiya,Mostafa Awheda, Pascal De Beck-Courcelle, and Sameh Desouky. Withoutthe dedicated work of this group of students, this book would not have beenpossible.

H. M. SchwartzOttawa, CanadaSeptember, 2013

References

[1] L. Ljung, System Identification: Theory for the User. Upper Saddle River, NJ: Prentice Hall,2nd ed., 1999.

Page 13: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Preface xi

[2] L. Ljung and T. Soderstrom, Theory and Practice of Recursive Identification. Cambridge,Massachusetts: The MIT Press, 1983.

[3] R. S. Sutton and A. G. Barto, Reinforcement learning: An Introduction. Cambridge, Mas-sachusetts: The MIT Press, 1998.

[4] Astrom, K. J. and Wittenmark, B., Adaptive Control. Boston, Massachusetts:Addison-Wesley Longman Publishing Co., Inc., 2nd ed., 1994, ISBN = 0201558661.

[5] L. Busoniu and R. Babuška, and B. D. Schutter, “A comprehensive survey of multiagentreinforcement learning,” IEEETrans. Syst.Man Cybern. Part C, Vol. 38, no. 2, pp. 156–172,2008.

Page 14: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University
Page 15: Multi-Agent Machine Learning - Buch.de · Multi-Agent Machine Learning A Reinforcement Approach Howard M. Schwartz Department of Systems and Computer Engineering Carleton University

Chapter 1

A Brief Review of Supervised Learning

There are a number of algorithms that are typically used for system identi-fication, adaptive control, adaptive signal processing, and machine learning.These algorithms all have particular similarities and differences. However, theyall need to process some type of experimental data. How we collect the dataand process it determines the most suitable algorithm to use. In adaptive con-trol, there is a device referred to as the self-tuning regulator. In this case, thealgorithmmeasures the states as outputs, estimates the model parameters, andoutputs the control signals. In reinforcement learning, the algorithms processrewards, estimate value functions, and output actions. Although one may referto the recursive least squares (RLS) algorithm in the self-tuning regulator as asupervised learning algorithm and reinforcement learning as an unsupervisedlearning algorithm, they are both very similar. In this chapter, we will presenta number of well-known baseline supervised learning algorithms.

1.1 Least Squares Estimates

The least squares (LS) algorithm is a well-known and robust algorithm forfitting experimental data to a model. The first step is for the user to definea mathematical structure or model that he/she believes will fit the data. Thesecond step is to design an experiment to collect data under suitable conditions.“Suitable conditions” usually means the operating conditions under which the

Multi-Agent Machine Learning: A Reinforcement Approach, First Edition. Howard M. Schwartz.© 2014 John Wiley & Sons, Inc. Published 2014 by John Wiley & Sons, Inc.

1