Package agents.trader

Class 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<MarginalsAtTime>> sortMarginalsByTimeStamp​(ArrayList<de.dlr.gitlab.fame.communication.message.Message> messages)
        Reads MarginalsAtTime from given messages and sorts them by the time stamp they are valid at
        Parameters:
        messages - containing MarginalsAtTime - to be sorted by time stamp
        Returns:
        a Map of MarginalsAtTime sorted by the TimeStamp they are valid at
      • extractMarginalsAtTime

        protected ArrayList<MarginalsAtTime> extractMarginalsAtTime​(ArrayList<de.dlr.gitlab.fame.communication.message.Message> messages)
        Reads MarginalsAtTime from given messages, assuming they are valid at the same time stamp
        Parameters:
        messages - containing MarginalsAtTime to be extracted
        Returns:
        List of MarginalsAtTime contained in given messages
      • getSortedMarginalList

        protected ArrayList<Marginal> getSortedMarginalList​(ArrayList<MarginalsAtTime> allMarginals)
        Parameters:
        allMarginals - to have their Marginals extracted and then sorted by costs, ascending
        Returns:
        Marginals extracted from given data sorted 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