Ignore:
Timestamp:
08/28/19 11:35:52 (5 years ago)
Author:
bart
Message:

Added new parties : linear, hardliner, conceder, boulware

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exampleparties/randompartypy/src/main/resources/RandomParty.py

    r1 r2  
    2323import geniusweb.party.DefaultParty as DefaultParty
    2424import geniusweb.profile.Profile as Profile
     25import geniusweb.profile.PartialOrdering as PartialOrdering
    2526import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace as LinearAdditiveUtilitySpace
    2627import geniusweb.references.ProfileRef as ProfileRef
     
    2930import geniusweb.profileconnection.ProfileInterface as ProfileInterface
    3031import geniusweb.progress.ProgressRounds as ProgressRounds
     32
    3133
    3234import com.fasterxml.jackson.databind.ObjectMapper as ObjectMapper
     
    9294
    9395        def _isGood(self, bid):
    94                 return bid != None and self.profile.getProfile().getUtility(bid).doubleValue() > 0.6;
     96                if bid == None:
     97                        return false
     98                profile = self.profile.getProfile()
     99                if isinstance(profile, LinearAdditiveUtilitySpace):
     100                        return profile.getUtility(bid).doubleValue() > 0.6;
     101                if isinstance(profile, PartialOrdering):
     102                        return profile.isPreferredOrEqual(bid, profile.getReservationBid())
     103                raise Exception("Can not handle this type of profile")
Note: See TracChangeset for help on using the changeset viewer.