Class ProposalEvaluator

  • All Implemented Interfaces:
    IProposalEvaluator

    public class ProposalEvaluator
    extends java.lang.Object
    implements IProposalEvaluator
    A default implementation of the proposal evaluator interface. The implementation determines acceptable proposals by comparing proposals or evaluations to a given limit value.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean ascending
      Flag indicating if evaluations are rated ascending (the higher the better) or the other way round.
      static java.lang.String EVALUATION_ACCEPTABLE
      Evaluation value indicating an acceptable proposal that should be considered in further negotiation rounds.
      protected java.util.Comparator evaluation_comparator
      A comparator used for comparing evaluations.
      static java.lang.String EVALUATION_INACCEPTABLE
      Evaluation value indicating an inacceptable proposal that should be excluded.
      protected java.lang.Object evaluation_limit
      Limit determining the acceptability of an evaluation.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ProposalEvaluator()
      Create a default proposal evaluator.
        ProposalEvaluator​(java.lang.Object evaluation_limit, boolean ascending)
      Create a default proposal evaluator with a given limit value.
        ProposalEvaluator​(java.util.Comparator evaluation_comparator, java.lang.Object evaluation_limit, boolean ascending)
      Create a default proposal evaluator with a given limit value.
    • Field Detail

      • EVALUATION_INACCEPTABLE

        public static final java.lang.String EVALUATION_INACCEPTABLE
        Evaluation value indicating an inacceptable proposal that should be excluded.
        See Also:
        Constant Field Values
      • EVALUATION_ACCEPTABLE

        public static final java.lang.String EVALUATION_ACCEPTABLE
        Evaluation value indicating an acceptable proposal that should be considered in further negotiation rounds.
        See Also:
        Constant Field Values
      • evaluation_comparator

        protected java.util.Comparator evaluation_comparator
        A comparator used for comparing evaluations.
      • evaluation_limit

        protected java.lang.Object evaluation_limit
        Limit determining the acceptability of an evaluation.
      • ascending

        protected boolean ascending
        Flag indicating if evaluations are rated ascending (the higher the better) or the other way round.
    • Constructor Detail

      • ProposalEvaluator

        protected ProposalEvaluator()
        Create a default proposal evaluator. This (empty) constructor cannot be used directly, as it requires at least the isProposalAcceptable() method to be overwritten.
      • ProposalEvaluator

        public ProposalEvaluator​(java.lang.Object evaluation_limit,
                                 boolean ascending)
        Create a default proposal evaluator with a given limit value. This constructor can be used without overwriting any methods, if the proposal objects are comparable to each other and the limit value. Otherwise, the evaluateProposal() method should be overwritten to provide comparable evaluation values for the proposal objects.
        Parameters:
        evaluation_limit - The limit specifying which proposals are acceptable.
        ascending - Sort order, which specifies that all evaluations below or equal (true) or above or equal (false) to the limit are acceptable.
      • ProposalEvaluator

        public ProposalEvaluator​(java.util.Comparator evaluation_comparator,
                                 java.lang.Object evaluation_limit,
                                 boolean ascending)
        Create a default proposal evaluator with a given limit value. This constructor can be used without overwriting any methods, if the proposal objects are comparable to each other and the limit value using the given comparator. Otherwise, the evaluateProposal() method should be overwritten to provide comparable evaluation values for the proposal objects.
        Parameters:
        evaluation_comparator - A comparator used to compare proposal evaluations.
        evaluation_limit - The limit specifying which proposals are acceptable.
        ascending - Sort order, which specifies that all evaluations below or equal (true) or above or equal (false) to the limit are acceptable.
    • Method Detail

      • evaluateProposals

        public ParticipantProposal[] evaluateProposals​(java.lang.Object cfp,
                                                       java.lang.Object cfp_info,
                                                       NegotiationRecord[] history,
                                                       ParticipantProposal[] proposals)
        Evaluate the given proposals and determine winning proposals.
        Specified by:
        evaluateProposals in interface IProposalEvaluator
        Parameters:
        cfp - The original call-for-proposal object.
        cfp_info - Local meta information associated to the interaction.
        history - The history of negotiation rounds.
        proposals - The received proposals.
        Returns:
        The winners among the proposals.
      • evaluateProposal

        protected java.lang.Object evaluateProposal​(java.lang.Object cfp,
                                                    java.lang.Object cfp_info,
                                                    NegotiationRecord[] history,
                                                    ParticipantProposal proposal)
        Evaluate the given proposal. An implementation may use the defined constants for specifying evaluation results, but custom evaluation values are also allowed. This default implementation justs uses the proposal object itself as its evaluation, as long as it is comparable in itself or with a given comparator.
        Parameters:
        cfp - The original call-for-proposal object.
        cfp_info - Local meta information associated to the interaction.
        history - The history of negotiation rounds.
        proposal - A received proposal.
        Returns:
        The proposal evaluation.
      • isProposalAcceptable

        protected boolean isProposalAcceptable​(java.lang.Object cfp,
                                               java.lang.Object cfp_info,
                                               NegotiationRecord[] history,
                                               ParticipantProposal proposal)
        Check if a proposal is acceptable. This default implementation checks for one of the evaluation constants and otherwise tries to use the given evaluation limit (if any) and compares it to the proposals evaluation value. Proposals without evaluation or which are not comparable are deemed inacceptable by default.
        Parameters:
        cfp - The original call-for-proposal object.
        cfp_info - Local meta information associated to the interaction.
        history - The history of negotiation rounds.
        proposal - A received proposal.
        Returns:
        The proposal evaluation.
      • orderAcceptables

        protected ParticipantProposal[] orderAcceptables​(java.lang.Object cfp,
                                                         java.lang.Object cfp_info,
                                                         NegotiationRecord[] history,
                                                         ParticipantProposal[] proposals)
        Order acceptable proposals by preference. This default implementation tries to compare the proposal evaluations directly or using the given comparator. If some proposal evaluations are not comparable, these are returned in the original order (after comparable proposals, if any).
        Parameters:
        cfp - The original call-for-proposal object.
        cfp_info - Local meta information associated to the interaction.
        history - The history of negotiation rounds.
        proposals - The acceptable proposals.
        Returns:
        The ordered acceptable proposals.