Changes between Version 201 and Version 202 of WikiStart


Ignore:
Timestamp:
06/26/19 14:42:33 (5 years ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v201 v202  
    212212                                self.progress = self.progress.advance();
    213213
     214
     215
    214216        def getCapabilities(self): # -> Capabilities
    215217                return Capabilities(HashSet([ ProtocolRef(URI("SAOP"))]))
     
    225227                        action = Accept(self.me, self.lastReceivedBid)
    226228                else:
    227                         bidspace = AllBidsList(self._getProfile().getDomain())
    228                         i = self.random.nextInt(bidspace.size()) # warning: jython implicitly converts BigInteger to long.
    229                         action = Offer(self.me, bidspace.get(BigInteger.valueOf(i)))
    230                 self.getConnection().send(action)
    231 
    232    ...
     229                        bidspace = AllPartialBidsList(self.profile.getProfile().getDomain())
     230                        bid = None
     231                        for attempt in range(20):
     232                                i = self.random.nextInt(bidspace.size()) # warning: jython implicitly converts BigInteger to long.
     233                                bid = bidspace.get(BigInteger.valueOf(i))
     234                                if self._isGood(bid):
     235                                        break
     236                        action = Offer(self.me, bid);
     237                        self.getConnection().send(action)
     238
     239        def _isGood(self, bid):
     240                return bid != None and self.profile.getProfile().getUtility(bid).doubleValue() > 0.6;
     241
    233242}}}
    234243