CentralizedQLearning

Description

Functions

hashValue

extern void hashValue(uint32_t &value);

https://stackoverflow.com/a/72073933

incorporateHash

extern void incorporateHash(std::size_t& hash,uint32_t value);

https://stackoverflow.com/a/72073933

hashVector

extern std::size_t hashVector(const std::vector<uint32_t>& vector);

virtual std::size_t operator() (const GlobalState& key) const;

virtual std::size_t operator() (const QTableKey& key) const;

getCurrentPosition

virtual double getCurrentPosition() = 0;

Gets the agent's current state

getMaximumPosition

virtual double getMaximumPosition() = 0;

getCollectedPackets

virtual uint32_t getCollectedPackets() = 0;

getMaxCollectedPackets

virtual uint32_t getMaxCollectedPackets() = 0;

applyCommand

virtual void applyCommand(const LocalControl& command) = 0;

Applies a command to the agent

isReady

virtual bool isReady() = 0;

Determines if an agent has already applied the last commant it received

getAwaitingPackets

virtual uint32_t getAwaitingPackets() = 0;

getMaxAwaitingPackets

virtual uint32_t getMaxAwaitingPackets() = 0;

hasBeenVisited

virtual bool hasBeenVisited() = 0;

getSensorPosition

virtual double getSensorPosition() = 0;

getReceivedPackets

virtual uint32_t getReceivedPackets() = 0;

registerAgent

virtual AgentInfo registerAgent(CentralizedQAgent *agent);

Registers the centralized agent "agent"

registerSensor

virtual int registerSensor(CentralizedQSensor *sensor);

Registers a centralized sensor "sensor"

registerGround

virtual void registerGround(CentralizedQGround *ground);

Registers the ground station

initialize

virtual void initialize(int stage) override;

OMNeT++ functions

numInitStages

virtual int numInitStages() const override { return 2; };

handleMessage

virtual void handleMessage(cMessage *msg) override;

finish

virtual void finish() override;

trainIfReady

virtual void trainIfReady();

Training functions

train

virtual void train();

dispatchJointCommand

virtual void dispatchJointCommand();

computeCost

virtual double computeCost(const GlobalState& newState);

decayEpsilon

virtual void decayEpsilon();

initializeQTable

virtual void initializeQTable();

Helpers

exportQTable

virtual void exportQTable();

importQTable

virtual void importQTable();

generateRandomLocalControl

virtual LocalControl generateRandomLocalControl();

generateRandomJointControl

virtual JointControl generateRandomJointControl();

cMessage

cMessage *trainingTimer = new cMessage(nullptr);

Messages used to time the module's execution

registerSignal

simsignal_t trainingCostSignal = registerSignal("trainingCost");

Helper variables Variables for debugging and data collection

registerSignal

simsignal_t epsilonSignal = registerSignal("epsilon");