Class MRVMWorld
- java.lang.Object
-
- org.spectrumauctions.sats.core.model.World
-
- org.spectrumauctions.sats.core.model.mrvm.MRVMWorld
-
- All Implemented Interfaces:
java.io.Serializable,GenericWorld
public final class MRVMWorld extends World implements GenericWorld
- Author:
- Michael Weiss
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMODEL_NAME
-
Constructor Summary
Constructors Constructor Description MRVMWorld(MRVMWorldSetup worldSetup, RNGSupplier rngSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.math.BigDecimalc(MRVMRegionsMap.Region r, java.util.Set<MRVMLicense> bundle)Defines the c-function, i.e., c(r,x) = sum_{b\in B} cap(b,r,x) [as explained in the paper]static java.math.BigDecimalcapOfBand(MRVMBand band, int numberOfLicenses)Returns the capacity for having numberOfLicenses manyMRVMLicenseinMRVMBandbandjava.util.List<MRVMBidder>createPopulation(java.util.Collection<MRVMLocalBidderSetup> localSetups, java.util.Collection<MRVMRegionalBidderSetup> regionalSetups, java.util.Collection<MRVMNationalBidderSetup> nationalSetups, RNGSupplier rngSupplier)java.util.List<MRVMBidder>createPopulation(MRVMLocalBidderSetup localSetup, MRVMRegionalBidderSetup regionalSetup, MRVMNationalBidderSetup nationalSetup, RNGSupplier rngSupplier)java.util.List<MRVMGenericDefinition>getAllGenericDefinitions()java.util.Set<MRVMBand>getBands()GenericGoodgetGenericDefinitionOf(License license)java.util.List<MRVMLicense>getLicenses()static java.util.Map<MRVMBand,java.util.Set<MRVMLicense>>getLicensesPerBand(java.util.Set<MRVMLicense> bundle)Sorts the licenses of a bundle into subbundles by their band.static java.util.Map<MRVMBand,java.util.Set<MRVMLicense>>getLicensesPerBand(java.util.Set<MRVMLicense> bundle, MRVMWorld world)Sorts the licenses of a bundle into subbundles by their band.static java.util.Map<MRVMRegionsMap.Region,java.util.Set<MRVMLicense>>getLicensesPerRegion(java.util.Set<MRVMLicense> bundle)Sorts the licenses of a bundle into subbundles by their region.java.math.BigDecimalgetMaximumRegionalCapacity()Calculates the maximum capacity any region can have.intgetNumberOfGoods()MRVMRegionsMapgetRegionsMap()static java.util.Map<MRVMBand,java.lang.Integer>quantitiesPerBand(java.util.Set<MRVMLicense> bundle)Counts the number of licenses for each band.static java.util.Map<MRVMBand,java.lang.Integer>quantitiesPerBand(java.util.Set<MRVMLicense> bundle, MRVMWorld MRVMWorld)Counts the number of licenses for each band.voidrefreshFieldBackReferences()Some of the members of the World (e.g.java.util.List<? extends SATSBidder>restorePopulation(long populationId)Restore serializedSATSBidderinstances via population id-
Methods inherited from class org.spectrumauctions.sats.core.model.World
equals, getId, getModelName, hashCode, openNewPopulation, restorePopulation, restorePopulation, store
-
-
-
-
Field Detail
-
MODEL_NAME
public static final java.lang.String MODEL_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MRVMWorld
public MRVMWorld(MRVMWorldSetup worldSetup, RNGSupplier rngSupplier)
-
-
Method Detail
-
getNumberOfGoods
public int getNumberOfGoods()
- Specified by:
getNumberOfGoodsin classWorld- See Also:
World.getNumberOfGoods()
-
getBands
public java.util.Set<MRVMBand> getBands()
-
getLicenses
public java.util.List<MRVMLicense> getLicenses()
- Specified by:
getLicensesin classWorld- See Also:
World.getLicenses()
-
restorePopulation
public java.util.List<? extends SATSBidder> restorePopulation(long populationId)
Description copied from class:WorldRestore serializedSATSBidderinstances via population id- Specified by:
restorePopulationin classWorld- Parameters:
populationId- the population id- Returns:
- the deserialized bidders
- See Also:
World.restorePopulation(long)
-
refreshFieldBackReferences
public void refreshFieldBackReferences()
Description copied from class:WorldSome of the members of the World (e.g. licenses) have circular references back to the world.
As the used gsonSerializer cannot handle this yet, the circular references are not serialized and have to be restored after deserialization by calling this method.
This method will be removed in a later version and the problem be solved during deserialization.- Specified by:
refreshFieldBackReferencesin classWorld- See Also:
World.refreshFieldBackReferences()
-
getRegionsMap
public MRVMRegionsMap getRegionsMap()
-
getLicensesPerBand
public static java.util.Map<MRVMBand,java.util.Set<MRVMLicense>> getLicensesPerBand(java.util.Set<MRVMLicense> bundle)
Sorts the licenses of a bundle into subbundles by their band. The returned map contains all bands of the world as keys, even such which are not present with any licenses in the bundle.- Parameters:
bundle- Must be nonempty
-
getLicensesPerBand
public static java.util.Map<MRVMBand,java.util.Set<MRVMLicense>> getLicensesPerBand(java.util.Set<MRVMLicense> bundle, MRVMWorld world)
Sorts the licenses of a bundle into subbundles by their band. The returned map contains all bands of the world as keys, even such which are not present with any licenses in the bundle.
-
quantitiesPerBand
public static java.util.Map<MRVMBand,java.lang.Integer> quantitiesPerBand(java.util.Set<MRVMLicense> bundle)
Counts the number of licenses for each band. The returned map contains all bands of the world as keys, even such which are not present with any licenses in the bundle.- Parameters:
bundle- Must be nonempty
-
quantitiesPerBand
public static java.util.Map<MRVMBand,java.lang.Integer> quantitiesPerBand(java.util.Set<MRVMLicense> bundle, MRVMWorld MRVMWorld)
Counts the number of licenses for each band. The returned map contains all bands of the world as keys, even such which are not present with any licenses in the bundle.- Parameters:
bundle- Must be nonempty
-
c
public static java.math.BigDecimal c(MRVMRegionsMap.Region r, java.util.Set<MRVMLicense> bundle)
Defines the c-function, i.e., c(r,x) = sum_{b\in B} cap(b,r,x) [as explained in the paper]
-
getMaximumRegionalCapacity
public java.math.BigDecimal getMaximumRegionalCapacity()
Calculates the maximum capacity any region can have. The result is cached, hence, calling the method multiple time is not costly.
-
capOfBand
public static java.math.BigDecimal capOfBand(MRVMBand band, int numberOfLicenses)
Returns the capacity for having numberOfLicenses manyMRVMLicenseinMRVMBandband
-
getLicensesPerRegion
public static java.util.Map<MRVMRegionsMap.Region,java.util.Set<MRVMLicense>> getLicensesPerRegion(java.util.Set<MRVMLicense> bundle)
Sorts the licenses of a bundle into subbundles by their region.- Returns:
- map that contains all regions of the world as keys, even such which are not present with any licenses in the bundle.
-
createPopulation
public java.util.List<MRVMBidder> createPopulation(MRVMLocalBidderSetup localSetup, MRVMRegionalBidderSetup regionalSetup, MRVMNationalBidderSetup nationalSetup, RNGSupplier rngSupplier)
-
createPopulation
public java.util.List<MRVMBidder> createPopulation(java.util.Collection<MRVMLocalBidderSetup> localSetups, java.util.Collection<MRVMRegionalBidderSetup> regionalSetups, java.util.Collection<MRVMNationalBidderSetup> nationalSetups, RNGSupplier rngSupplier)
-
getAllGenericDefinitions
public java.util.List<MRVMGenericDefinition> getAllGenericDefinitions()
- Specified by:
getAllGenericDefinitionsin interfaceGenericWorld
-
getGenericDefinitionOf
public GenericGood getGenericDefinitionOf(License license)
- Specified by:
getGenericDefinitionOfin interfaceGenericWorld
-
-