BWAPI
|
00001 /* 00002 * Arbitrator.h - Used to redistribute Units and allocate newly created Units 00003 */ 00004 #pragma once 00005 00006 #include "Managers/Manager.h" 00007 00008 class Arbitrator 00009 { 00010 std::set<Manager> managers; // Bidding Managers 00011 std::set<Agent> agents; // Agents to provide 00012 00013 public: 00014 /* 00015 * update - Update calls resolve() until newly created 00016 * Units are assigned, and MWTP from Managers is at equillibrium 00017 */ 00018 void update(); 00019 00020 private: 00021 /* 00022 * resolve - Transfers available Agents to Managers with highest 00023 * willingness to pay. 00024 */ 00025 bool resolve(); 00026 00027 /* 00028 * findNewUnits() - Creates Agents for each newly produced Unit, 00029 * and adds them to the set of managed Agents. 00030 */ 00031 void findNewUnits(); 00032 00033 }; 00034 00035