public class UtilitySpace
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected Domain |
domain |
protected java.lang.String |
fileName |
protected SimpleElement |
fXMLRoot |
protected UTILITYSPACETYPE |
spaceType |
Constructor and Description |
---|
UtilitySpace()
Creates an empty utility space.
|
UtilitySpace(Domain domain)
Creates a new utilityspace of the given domain.
|
UtilitySpace(Domain domain,
java.util.Map<Objective,Evaluator> fEvaluators) |
UtilitySpace(Domain domain,
java.lang.String fileName)
Create new default util space for a given domain.
|
UtilitySpace(UtilitySpace us)
Copies the data from another UtilitySpace.
|
Modifier and Type | Method and Description |
---|---|
Evaluator |
addEvaluator(Objective obj,
Evaluator ev)
Sets an
|
void |
checkReadyForNegotiation(Domain dom)
Check if this utility space is ready for negotiation.
|
java.lang.Double |
discount(double util,
double time)
Computes:
discountedUtil = util * Math.pow(discount, time).
|
static double |
discount(double util,
double time,
double discountFactor)
Computes:
discountedUtil = util * Math.pow(discount, time).
|
boolean |
equals(java.lang.Object obj) |
double |
getDiscountFactor() |
Domain |
getDomain() |
double |
getEvaluation(int pIssueIndex,
Bid bid)
Returns the utility of one issue in the bid.
|
Evaluator |
getEvaluator(int index)
Returns the evaluator of an issue for the given index.
|
java.util.Set<java.util.Map.Entry<Objective,Evaluator>> |
getEvaluators() |
java.lang.String |
getFileName() |
Objective |
getIssue(int index)
Deprecated.
Use getObjective
|
Bid |
getMaxUtilityBid()
Returns the maximum bid in the utility space.
|
Bid |
getMinUtilityBid()
Returns the worst bid in the utility space.
|
int |
getNrOfEvaluators() |
java.lang.Double |
getReservationValue()
The reservation value is the least favourable point at which one will
accept a negotiated agreement.
|
double |
getReservationValueUndiscounted()
Equivalent to
getReservationValue() , but always returns a double
value. |
double |
getReservationValueWithDiscount(double time)
The discounted version of
getReservationValue() . |
double |
getReservationValueWithDiscount(TimeLineInfo timeline)
The discounted version of
getReservationValue() . |
UTILITYSPACETYPE |
getType()
This method returns the type of utility space: either linear or
nonlinear.
|
double |
getUtility(Bid bid) |
double |
getUtilityWithDiscount(Bid bid,
double time) |
double |
getUtilityWithDiscount(Bid bid,
TimeLineInfo timeline)
Let d in (0, 1) be the discount factor.
|
double |
getWeight(int issueID) |
protected SimpleElement |
getXMLRoot() |
boolean |
isDiscounted() |
boolean |
lock(Objective obj)
Place a lock on the weight of an objective or issue.
|
java.util.Set<java.util.Map.Entry<Objective,Evaluator>> |
normalizeChildren(Objective obj)
Normalizes the weights of objectives of the given objective so that they
sum up to one.
|
protected void |
normalizeWeights(Objective currentRoot) |
void |
setDiscount(double newDiscount) |
void |
setReservationValue(double newRV) |
double |
setWeight(Objective objective,
double weight)
Method used to set the weight of the given objective.
|
java.lang.String |
toString() |
SimpleElement |
toXML()
Creates an xml representation (in the form of a SimpleElements) of the
utilityspace.
|
boolean |
unlock(Objective obj)
Clear a lock on the weight of an objective or issue.
|
protected double |
validateDiscount(double df) |
protected Domain domain
protected java.lang.String fileName
protected UTILITYSPACETYPE spaceType
protected SimpleElement fXMLRoot
public UtilitySpace()
public UtilitySpace(Domain domain)
domain
- for which the utilityspace should be specified.public UtilitySpace(Domain domain, java.lang.String fileName) throws java.lang.Exception
domain
- fileName
- to read domain from. Set fileName to "" if no file available,
in which case default evaluators are loaded..java.lang.Exception
- if error occurs, e.g. if domain does not match the util
space, or file not found.public UtilitySpace(UtilitySpace us)
us
- utility space to be cloned.public UTILITYSPACETYPE getType()
protected void normalizeWeights(Objective currentRoot)
public void checkReadyForNegotiation(Domain dom) throws java.lang.Exception
dom
- is the domain in which nego is taking placejava.lang.Exception
- if utility space is incomplete (@see isComplete());protected SimpleElement getXMLRoot()
public final int getNrOfEvaluators()
public final Evaluator getEvaluator(int index)
index
- The IDnumber of the Objective or Issuepublic double getUtility(Bid bid) throws java.lang.Exception
bid
- of which we are interested in its utility.java.lang.Exception
- when bid is incomplete or invalid.public double getUtilityWithDiscount(Bid bid, TimeLineInfo timeline)
Timeline
. We compute the discounted utility
discountedUtility as follows:
discountedUtility = originalUtility * d^t.
For t = 0 the utility remains unchanged, and for t = 1 the original
utility is multiplied by the discount factor. The effect is almost linear
in between. Works with any utility space.bid
- of which we are interested in its utility.timeline
- indicating the time passed in the negotiation.public double getUtilityWithDiscount(Bid bid, double time)
bid
- of which we want to know the utility at the given time.time
- at which we want to know the utility of the bid.#getUtilityWithDiscount(Bid, Timeline)
public static double discount(double util, double time, double discountFactor)
util
- undiscounted utility.time
- at which we want to know the discounted utility.discountFactor
- of the preference profile.public java.lang.Double discount(double util, double time)
public final double getEvaluation(int pIssueIndex, Bid bid) throws java.lang.Exception
pIssueIndex
- of the issue.bid
- java.lang.Exception
- if the bid or value is null.public final Bid getMaxUtilityBid() throws java.lang.Exception
java.lang.Exception
- if there is no bid at all in this util space.public Bid getMinUtilityBid() throws java.lang.Exception
java.lang.Exception
- if there is no bid at all in the util spaceprotected double validateDiscount(double df)
public double getWeight(int issueID)
issueID
- The Issue or Objective to get the weight frompublic double setWeight(Objective objective, double weight)
objective
- of which the weights must be set.weight
- to which the weight of the objective must be set.public final Objective getIssue(int index)
index
- The index of the issue topublic final Domain getDomain()
public final Evaluator addEvaluator(Objective obj, Evaluator ev)
obj
- The Objective to attach an Evaluator to.ev
- The Evaluator to attach.public final java.util.Set<java.util.Map.Entry<Objective,Evaluator>> getEvaluators()
public final boolean lock(Objective obj)
obj
- The objective or issue that is about to have it's weight
locked.true
if successful, false
If the
objective doesn't have an evaluator yet.public final boolean unlock(Objective obj)
obj
- The objective or issue that is having it's lock cleared.true
If the lock is cleared, false
if
the objective or issue doesn't have an evaluator yet.public final java.util.Set<java.util.Map.Entry<Objective,Evaluator>> normalizeChildren(Objective obj)
obj
- of which the weights must be normalized.public SimpleElement toXML() throws java.io.IOException
null
when
there was an error.java.io.IOException
public void setReservationValue(double newRV)
newRV
- new reservation value.public void setDiscount(double newDiscount)
newDiscount
- new discount factor.public java.lang.Double getReservationValue()
#getReservationValueWithDiscount(Timeline)
.public double getReservationValueUndiscounted()
getReservationValue()
, but always returns a double
value. When the original reservation value is null it returns the
default value 0.getReservationValue()
public double getReservationValueWithDiscount(double time)
getReservationValue()
.time
- at which we want to know the utility of the reservation value.public double getReservationValueWithDiscount(TimeLineInfo timeline)
getReservationValue()
.timeline
- specifying the current time in the negotiation.public java.lang.String getFileName()
public boolean isDiscounted()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public final double getDiscountFactor()