Changeset 53 for bidspace/src/main/java
- Timestamp:
- 12/18/24 13:28:59 (8 days ago)
- Location:
- bidspace/src/main/java/geniusweb/bidspace
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
bidspace/src/main/java/geniusweb/bidspace/BidsWithUtility.java
r52 r53 3 3 import java.math.BigDecimal; 4 4 import java.math.BigInteger; 5 import java.util.Arrays; 5 6 import java.util.Collections; 6 7 import java.util.HashMap; … … 39 40 */ 40 41 private final Map<Tuple<Integer, Interval>, ImmutableList<Bid>> cache = new HashMap<>(); 41 private ImmutableList<Bid> emptylist = new FixedList<>(); 42 private ImmutableList<Bid> emptylist = new FixedList<>( 43 Collections.emptyList()); 42 44 43 45 /** … … 176 178 goal = goal.intersect(getRange(n)); 177 179 if (goal.isEmpty()) { 178 return new FixedList<>( );180 return new FixedList<>(Collections.emptyList()); 179 181 } 180 182 … … 220 222 pbid -> pbid.merge(new Bid(issue, val)), partialbids); 221 223 if (!fullbids.size().equals(BigInteger.ZERO)) 222 fulllist = new JoinedList<Bid>(fullbids, fulllist); 224 fulllist = new JoinedList<Bid>( 225 Arrays.asList(fullbids, fulllist)); 223 226 } 224 227 return fulllist; -
bidspace/src/main/java/geniusweb/bidspace/PartialSpaceFromUtility.java
r52 r53 3 3 import java.math.BigInteger; 4 4 import java.security.SecureRandom; 5 import java.util.Collections; 5 6 import java.util.HashMap; 6 7 import java.util.HashSet; … … 24 25 public class PartialSpaceFromUtility extends DefaultPartialOrdering { 25 26 public PartialSpaceFromUtility(UtilitySpace space, int nRankings) { 26 super(space.getName() + "_" + nRankings, space.getDomain(), space.getReservationBid(),27 pickBetter(space, nRankings));27 super(space.getName() + "_" + nRankings, space.getDomain(), 28 space.getReservationBid(), pickBetter(space, nRankings)); 28 29 } 29 30 30 31 /** 31 * Pick subset of static isbetter rankings. Notice, ShuffledList currently can't 32 * handle really large lists which also limits this. This has to be fixed. 32 * Pick subset of static isbetter rankings. Notice, ShuffledList currently 33 * can't handle really large lists which also limits this. This has to be 34 * fixed. 33 35 * 34 36 * @param space the space to sample from 35 * @param nRankings the number of rankings to be placed in the PartialOrdering. 37 * @param nRankings the number of rankings to be placed in the 38 * PartialOrdering. 36 39 * @return a subset creating a partial profile of the geiven UtilitySpace 37 40 */ 38 private static Map<Bid, Set<Bid>> pickBetter(UtilitySpace space, int nRankings) { 41 private static Map<Bid, Set<Bid>> pickBetter(UtilitySpace space, 42 int nRankings) { 39 43 Map<Bid, Set<Bid>> eqOrBetter = new HashMap<>(); 40 44 41 45 AllBidsList allbids = new AllBidsList(space.getDomain()); 42 ListWithRemove<Tuple<Bid, Bid>> available = new ListWithRemove<>(new Tuples<Bid, Bid>(allbids, allbids)); 46 ListWithRemove<Tuple<Bid, Bid>> available = new ListWithRemove<>( 47 new Tuples<Bid, Bid>(allbids, allbids), Collections.emptySet()); 43 48 for (int n = 0; n < nRankings; n++) { 44 49 BigInteger sel = rnd(available.size()); … … 79 84 80 85 /** 81 * Bit simplistic way to generate random in [0,n>. Simplistic because the mod()82 * operator that we use causes bias in the random numbers.86 * Bit simplistic way to generate random in [0,n>. Simplistic because the 87 * mod() operator that we use causes bias in the random numbers. 83 88 * 84 89 * @param n the maximum value for the random number
Note:
See TracChangeset
for help on using the changeset viewer.