Changeset 53 for bidspace/src/main/java


Ignore:
Timestamp:
12/18/24 13:28:59 (8 days ago)
Author:
ruud
Message:

All TimeDependent parties now support the nonlinear SumOfGroupsUtilitySpace. Example Nonlinear space in the computer domain

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  
    33import java.math.BigDecimal;
    44import java.math.BigInteger;
     5import java.util.Arrays;
    56import java.util.Collections;
    67import java.util.HashMap;
     
    3940         */
    4041        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());
    4244
    4345        /**
     
    176178                goal = goal.intersect(getRange(n));
    177179                if (goal.isEmpty()) {
    178                         return new FixedList<>();
     180                        return new FixedList<>(Collections.emptyList());
    179181                }
    180182
     
    220222                                        pbid -> pbid.merge(new Bid(issue, val)), partialbids);
    221223                        if (!fullbids.size().equals(BigInteger.ZERO))
    222                                 fulllist = new JoinedList<Bid>(fullbids, fulllist);
     224                                fulllist = new JoinedList<Bid>(
     225                                                Arrays.asList(fullbids, fulllist));
    223226                }
    224227                return fulllist;
  • bidspace/src/main/java/geniusweb/bidspace/PartialSpaceFromUtility.java

    r52 r53  
    33import java.math.BigInteger;
    44import java.security.SecureRandom;
     5import java.util.Collections;
    56import java.util.HashMap;
    67import java.util.HashSet;
     
    2425public class PartialSpaceFromUtility extends DefaultPartialOrdering {
    2526        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));
    2829        }
    2930
    3031        /**
    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.
    3335         *
    3436         * @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.
    3639         * @return a subset creating a partial profile of the geiven UtilitySpace
    3740         */
    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) {
    3943                Map<Bid, Set<Bid>> eqOrBetter = new HashMap<>();
    4044
    4145                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());
    4348                for (int n = 0; n < nRankings; n++) {
    4449                        BigInteger sel = rnd(available.size());
     
    7984
    8085        /**
    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.
    8388         *
    8489         * @param n the maximum value for the random number
Note: See TracChangeset for help on using the changeset viewer.