public class Sample extends Assignment implements java.lang.Comparable<Sample>
map
Constructor and Description |
---|
Sample()
Creates a new, empty weighted sample
|
Sample(Assignment a)
Creates a new sample
|
Sample(Assignment a,
double logWeight,
double utility)
Creates a new sample with an existing weight and utility
|
Modifier and Type | Method and Description |
---|---|
void |
addLogWeight(double addLogWeight)
Adds a logarithmic weight to the current one
|
void |
addUtility(double newUtil)
Adds a utility to the sample
|
int |
compareTo(Sample arg0) |
double |
getUtility()
Returns the utility of the sample
|
double |
getWeight()
Returns the sample weight (exponentiated value, not the logarithmic one!)
|
int |
hashcode() |
void |
setWeight(double weight)
Sets the logarithmic weight to a given value
|
java.lang.String |
toString()
Returns a string representation of the weighted sample
|
addAssignment, addPair, addPair, addPair, addPair, addPair, addPair, addPairs, addPrimes, clear, consistentWith, consistentWith, containContinuousValues, contains, containsOneVar, containsPair, containsVar, containsVars, copy, createDefault, createDefault, createFromString, createOneValue, equals, filterValues, generateXML, getEntrySet, getPairs, getPruned, getTrimmed, getTrimmed, getValue, getValues, getValues, getVariables, hashCode, intersect, isDefault, isEmpty, removeAll, removePair, removePairs, removePrimes, removeValues, renameVar, size, trim
public Sample()
public Sample(Assignment a)
a
- the existing assignmentpublic Sample(Assignment a, double logWeight, double utility)
a
- the assignmentlogWeight
- the logarithmic weightutility
- the utilitypublic void addLogWeight(double addLogWeight)
addLogWeight
- the weight to addpublic void setWeight(double weight)
weight
- the value for the weightpublic double getWeight()
public void addUtility(double newUtil)
newUtil
- the utility to addpublic double getUtility()
public java.lang.String toString()
toString
in class Assignment
public int compareTo(Sample arg0)
compareTo
in interface java.lang.Comparable<Sample>
public int hashcode()