Package jadex.bdi.planlib.protocols
Class ExponentialPriceCalculator
- java.lang.Object
-
- jadex.bdi.planlib.protocols.ExponentialPriceCalculator
-
- All Implemented Interfaces:
IOfferGenerator
public class ExponentialPriceCalculator extends java.lang.Object implements IOfferGenerator
A sample implementation of the IPriceCalculator. Calculates the price for the next round of an english auction.
-
-
Field Summary
Fields Modifier and Type Field Description protected double
base
The base (base^round).protected boolean
increasing
Flag indicating if increasing or decreasing prices are calculated.protected double
limitprice
The limit price.protected double
minstepwidth
The minimum step width.protected java.util.List
prices
The prices.protected int
round
The negotiation round.protected double
startprice
The start price.protected double
variation
The variation.
-
Constructor Summary
Constructors Constructor Description ExponentialPriceCalculator(double startprice, double limitprice, double base)
Create a new exponential price calculator.ExponentialPriceCalculator(double startprice, double limitprice, double base, double variation, double minstepwidth)
Create a new exponential price calculator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Comparable
getCurrentOffer()
Get the price for the current round of this auction.java.lang.Comparable
getLastOffer()
Returns the offer for the last round.java.lang.Comparable
getLimitOffer()
Get the min price.int
getRound()
Get the round.java.lang.Comparable
getStartOffer()
Get the start price.static void
main(java.lang.String[] args)
Main for testing.void
setNextRound()
Increase the round.
-
-
-
Field Detail
-
round
protected int round
The negotiation round.
-
startprice
protected double startprice
The start price.
-
limitprice
protected double limitprice
The limit price.
-
prices
protected java.util.List prices
The prices.
-
variation
protected double variation
The variation.
-
base
protected double base
The base (base^round).
-
minstepwidth
protected double minstepwidth
The minimum step width.
-
increasing
protected boolean increasing
Flag indicating if increasing or decreasing prices are calculated.
-
-
Constructor Detail
-
ExponentialPriceCalculator
public ExponentialPriceCalculator(double startprice, double limitprice, double base)
Create a new exponential price calculator.- Parameters:
startprice
- The start price.limitprice
- The limit price (min or max) for a auction.base
- The base for the exponential function.
-
ExponentialPriceCalculator
public ExponentialPriceCalculator(double startprice, double limitprice, double base, double variation, double minstepwidth)
Create a new exponential price calculator.- Parameters:
startprice
- the start pricelimitprice
- the minimal price for a successful auctionbase
- The base for the exponential function.variation
- The variation in percentage (0->1) for the increment. The increment will be used to adapt the increment by multiplying it with (+/-) a random value that has maximal the variation percentage influence, e.g. setting 0.1 will cause the increment being maximally +/-10% changed.minstepwidth
- The minimum step width (a positive value that describes the minimum price change in each round).
-
-
Method Detail
-
getCurrentOffer
public java.lang.Comparable getCurrentOffer()
Get the price for the current round of this auction.- Specified by:
getCurrentOffer
in interfaceIOfferGenerator
- Returns:
- The price.
-
getLastOffer
public java.lang.Comparable getLastOffer()
Returns the offer for the last round.- Specified by:
getLastOffer
in interfaceIOfferGenerator
- Returns:
- The last offer.
-
getLimitOffer
public java.lang.Comparable getLimitOffer()
Get the min price.- Specified by:
getLimitOffer
in interfaceIOfferGenerator
- Returns:
- The minprice.
-
getStartOffer
public java.lang.Comparable getStartOffer()
Get the start price.- Specified by:
getStartOffer
in interfaceIOfferGenerator
- Returns:
- The startprice
-
getRound
public int getRound()
Get the round.- Specified by:
getRound
in interfaceIOfferGenerator
- Returns:
- The round.
-
setNextRound
public void setNextRound()
Increase the round.- Specified by:
setNextRound
in interfaceIOfferGenerator
-
main
public static void main(java.lang.String[] args)
Main for testing.
-
-