Changes between Version 200 and Version 201 of WikiStart
- Timestamp:
- 06/26/19 14:37:31 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiStart
v200 v201 121 121 if (info instanceof Settings) { 122 122 Settings settings = (Settings) info; 123 profileint = getProfile(settings.getProfile().getURI()); 123 this.profileint = ProfileConnectionFactory 124 .create(settings.getProfile().getURI(), getReporter()); 124 125 this.me = settings.getID(); 125 126 this.progress = settings.getProgress(); … … 141 142 142 143 private void myTurn() { 143 if (lastReceivedBid != null && profileint.getProfile()144 .getUtility(lastReceivedBid).doubleValue() > 0.6) {144 Action action; 145 if (isGood(lastReceivedBid)) { 145 146 action = new Accept(me, lastReceivedBid); 146 147 } else { … … 148 149 AllPartialBidsList bidspace = new AllPartialBidsList( 149 150 profileint.getProfile().getDomain()); 150 long i = random.nextInt(bidspace.size().intValue()); 151 action = new Offer(me, bidspace.get(BigInteger.valueOf(i))); 151 Bid bid = null; 152 for (int attempt = 0; attempt < 20 && !isGood(bid); attempt++) { 153 long i = random.nextInt(bidspace.size().intValue()); 154 bid = bidspace.get(BigInteger.valueOf(i)); 155 } 156 action = new Offer(me, bid); 152 157 } 153 158 getConnection().send(action); 154 159 } 160 161 private boolean isGood(Bid bid) { 162 return bid != null 163 && ((LinearAdditiveUtilitySpace) profileint.getProfile()) 164 .getUtility(bid).doubleValue() > 0.6; 155 165 } 156 166