Creating Your Own Agency Algorithm

It's quite possible to add your own algorithm with Agency.

NOTE: Below is technical information for Python programmers

Create a new file in the Agents folder of your Agency installation. Name it 'agent_your_algorithm_name.py'.

Paste in the code below, which is an example of a very simple 'window' algorithm that returns False if the value is inside a given window, and True if it's outside.

class Agent:
    def __init__(self):      
        #Initialisation Here
        pass

    def Initialise(self,config):
        #Load configuration from the 'config' dictionary here.
        inputs = []
        outputs = []
        self.min = float(config['min'])
        self.max = float(config['max'])        
        return (inputs,outputs)

    def Execute(self,inputs,environment):
        #Execute the actual task here
        for i in inputs:
              if i < self.min or i > self.max:
                    return [True]
        return [False]

def createInstance():
    return Agent()

You can then update the code to perform your task by updating the content of Initialise and Execute.