Package agents.trader

Class Trader

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Trader.Products
      Products of Traders
      • Nested classes/interfaces inherited from class de.dlr.gitlab.fame.agent.Agent

        de.dlr.gitlab.fame.agent.Agent.WarmUpStatus
    • Constructor Summary

      Constructors 
      Constructor Description
      Trader​(de.dlr.gitlab.fame.agent.input.DataProvider dataProvider)
      Creates a Trader
    • Constructor Detail

      • Trader

        public Trader​(de.dlr.gitlab.fame.agent.input.DataProvider dataProvider)
        Creates a Trader
        Parameters:
        dataProvider - provides input from config
    • Method Detail

      • sortMarginalsByTimeStamp

        protected TreeMap<de.dlr.gitlab.fame.time.TimeStamp,​ArrayList<de.dlr.gitlab.fame.communication.message.Message>> sortMarginalsByTimeStamp​(ArrayList<de.dlr.gitlab.fame.communication.message.Message> messages)
        Parameters:
        messages - to sort by time stamp
        Returns:
        a Map of Messages with MarginalCost sorted by the TimeStamp they are valid at
      • saveGet

        protected ArrayList<de.dlr.gitlab.fame.communication.message.Message> saveGet​(TreeMap<de.dlr.gitlab.fame.time.TimeStamp,​ArrayList<de.dlr.gitlab.fame.communication.message.Message>> marginalsByTimeStamp,
                                                                                      de.dlr.gitlab.fame.time.TimeStamp timeStamp)
        Ensures that the given TreeMap returns an ArrayList at given time; if no value is present at the given time, an empty array is returned
        Parameters:
        marginalsByTimeStamp - time-indexed TreeMap to search for key
        timeStamp - time at which the key is required
        Returns:
        either present value at given key or (if not present) a newly added empty array
      • getSortedMarginalList

        protected ArrayList<MarginalCost> getSortedMarginalList​(ArrayList<de.dlr.gitlab.fame.communication.message.Message> messages)
        Parameters:
        messages - to sort by marginal cost
        Returns:
        List of MarginalCost extracted from given Messages in ascending order of their marginal cost
      • getMatchingContract

        protected de.dlr.gitlab.fame.communication.Contract getMatchingContract​(List<de.dlr.gitlab.fame.communication.Contract> contracts,
                                                                                long agentId)
        Parameters:
        contracts - whose receivers are searched for given agentId
        agentId - to search for
        Returns:
        first matching contract from given list of Contracts where the given agentID is receiver