from abc import ABC, abstractmethod from pyson.JsonSubTypes import JsonSubTypes from pyson.JsonTypeInfo import Id, As from pyson.JsonTypeInfo import JsonTypeInfo from geniusweb.inform.Agreements import Agreements from geniusweb.voting.CollectedVotes import CollectedVotes @JsonSubTypes(["geniusweb.voting.votingevaluators.LargestAgreement.LargestAgreement", "geniusweb.voting.votingevaluators.LargestAgreementsLoop.LargestAgreementsLoop"]) @JsonTypeInfo(use=Id.NAME, include=As.WRAPPER_OBJECT) class VotingEvaluator(ABC) : ''' Evaluates the {@link CollectedVotes}, determining the agreements and if the negotiation should continue. Implementations should be immutable and not serialize internal variables (eg @JsonIgnore them). ''' @abstractmethod def create(self, votes:CollectedVotes)->"VotingEvaluator" : ''' This function is the effective constructor. This mechanism serves several purposes: