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 | |