Changeset 2 for exampleparties/randompartypy/src/main
- Timestamp:
- 08/28/19 11:35:52 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
exampleparties/randompartypy/src/main/resources/RandomParty.py
r1 r2 23 23 import geniusweb.party.DefaultParty as DefaultParty 24 24 import geniusweb.profile.Profile as Profile 25 import geniusweb.profile.PartialOrdering as PartialOrdering 25 26 import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace as LinearAdditiveUtilitySpace 26 27 import geniusweb.references.ProfileRef as ProfileRef … … 29 30 import geniusweb.profileconnection.ProfileInterface as ProfileInterface 30 31 import geniusweb.progress.ProgressRounds as ProgressRounds 32 31 33 32 34 import com.fasterxml.jackson.databind.ObjectMapper as ObjectMapper … … 92 94 93 95 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.