Package jadex.bdi.planlib.protocols
Class ProposalEvaluator
- java.lang.Object
- 
- jadex.bdi.planlib.protocols.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 SummaryFields Modifier and Type Field Description protected booleanascendingFlag indicating if evaluations are rated ascending (the higher the better) or the other way round.static java.lang.StringEVALUATION_ACCEPTABLEEvaluation value indicating an acceptable proposal that should be considered in further negotiation rounds.protected java.util.Comparatorevaluation_comparatorA comparator used for comparing evaluations.static java.lang.StringEVALUATION_INACCEPTABLEEvaluation value indicating an inacceptable proposal that should be excluded.protected java.lang.Objectevaluation_limitLimit determining the acceptability of an evaluation.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedProposalEvaluator()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.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectevaluateProposal(java.lang.Object cfp, java.lang.Object cfp_info, NegotiationRecord[] history, ParticipantProposal proposal)Evaluate the given proposal.ParticipantProposal[]evaluateProposals(java.lang.Object cfp, java.lang.Object cfp_info, NegotiationRecord[] history, ParticipantProposal[] proposals)Evaluate the given proposals and determine winning proposals.protected booleanisProposalAcceptable(java.lang.Object cfp, java.lang.Object cfp_info, NegotiationRecord[] history, ParticipantProposal proposal)Check if a proposal is acceptable.protected ParticipantProposal[]orderAcceptables(java.lang.Object cfp, java.lang.Object cfp_info, NegotiationRecord[] history, ParticipantProposal[] proposals)Order acceptable proposals by preference.
 
- 
 - 
- 
Field Detail- 
EVALUATION_INACCEPTABLEpublic static final java.lang.String EVALUATION_INACCEPTABLE Evaluation value indicating an inacceptable proposal that should be excluded.- See Also:
- Constant Field Values
 
 - 
EVALUATION_ACCEPTABLEpublic 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_comparatorprotected java.util.Comparator evaluation_comparator A comparator used for comparing evaluations.
 - 
evaluation_limitprotected java.lang.Object evaluation_limit Limit determining the acceptability of an evaluation.
 - 
ascendingprotected boolean ascending Flag indicating if evaluations are rated ascending (the higher the better) or the other way round.
 
- 
 - 
Constructor Detail- 
ProposalEvaluatorprotected ProposalEvaluator() Create a default proposal evaluator. This (empty) constructor cannot be used directly, as it requires at least the isProposalAcceptable() method to be overwritten.
 - 
ProposalEvaluatorpublic 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.
 
 - 
ProposalEvaluatorpublic 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- 
evaluateProposalspublic 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:
- evaluateProposalsin 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.
 
 - 
evaluateProposalprotected 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.
 
 - 
isProposalAcceptableprotected 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.
 
 - 
orderAcceptablesprotected 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.
 
 
- 
 
-