Package jadex.bdi.planlib.protocols
Class LinearPriceCalculator
- java.lang.Object
- 
- jadex.bdi.planlib.protocols.LinearPriceCalculator
 
- 
- All Implemented Interfaces:
- IOfferGenerator
 
 public class LinearPriceCalculator extends java.lang.Object implements IOfferGenerator A sample implementation of the IPriceCalculator. Calculates the price for the rounds of an english auction.
- 
- 
Field SummaryFields Modifier and Type Field Description protected booleanincreasingFlag indicating if increasing or decreasing prices are calculated.protected doublelimitpriceThe limit price.protected doubleminstepwidthThe minimum step width.protected java.util.ListpricesThe prices.protected introundThe negotiation round.protected doublestartpriceThe start price.protected doublestepwidthThe base (base^round).protected doublevariationThe variance.
 - 
Constructor SummaryConstructors Constructor Description LinearPriceCalculator(double startprice, double limitprice, double base)Create a new linear price calculator.LinearPriceCalculator(double startprice, double limitprice, double stepwidth, double variation, double minstepwidth)Create a new linear price calculator.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ComparablegetCurrentOffer()Get the current price.java.lang.ComparablegetLastOffer()Returns the offer for the last round.java.lang.ComparablegetLimitOffer()Get the min price.intgetRound()Get the round.java.lang.ComparablegetStartOffer()Get the start price.static voidmain(java.lang.String[] args)Main for testing.voidsetNextRound()Increase the round.
 
- 
- 
- 
Field Detail- 
roundprotected int round The negotiation round.
 - 
startpriceprotected double startprice The start price.
 - 
limitpriceprotected double limitprice The limit price.
 - 
pricesprotected java.util.List prices The prices.
 - 
variationprotected double variation The variance.
 - 
stepwidthprotected double stepwidth The base (base^round).
 - 
minstepwidthprotected double minstepwidth The minimum step width.
 - 
increasingprotected boolean increasing Flag indicating if increasing or decreasing prices are calculated.
 
- 
 - 
Constructor Detail- 
LinearPriceCalculatorpublic LinearPriceCalculator(double startprice, double limitprice, double base)Create a new linear price calculator.- Parameters:
- startprice- The start price.
- limitprice- The minimal price for a successful auction.
- base- The base for the exponential function, should be positive for english and negative for dutch auctions.
 
 - 
LinearPriceCalculatorpublic LinearPriceCalculator(double startprice, double limitprice, double stepwidth, double variation, double minstepwidth)Create a new linear price calculator.- Parameters:
- startprice- the start price
- limitprice- the minimal price for a successful auction
- stepwidth- The normal increment/decrement value.
- 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.
 
 
- 
 - 
Method Detail- 
getCurrentOfferpublic java.lang.Comparable getCurrentOffer() Get the current price.- Specified by:
- getCurrentOfferin interface- IOfferGenerator
- Returns:
- The current price.
 
 - 
getLastOfferpublic java.lang.Comparable getLastOffer() Returns the offer for the last round.- Specified by:
- getLastOfferin interface- IOfferGenerator
- Returns:
- The last offer.
 
 - 
getLimitOfferpublic java.lang.Comparable getLimitOffer() Get the min price.- Specified by:
- getLimitOfferin interface- IOfferGenerator
- Returns:
- The minprice.
 
 - 
getStartOfferpublic java.lang.Comparable getStartOffer() Get the start price.- Specified by:
- getStartOfferin interface- IOfferGenerator
- Returns:
- The startprice
 
 - 
getRoundpublic int getRound() Get the round.- Specified by:
- getRoundin interface- IOfferGenerator
- Returns:
- The round.
 
 - 
setNextRoundpublic void setNextRound() Increase the round.- Specified by:
- setNextRoundin interface- IOfferGenerator
 
 - 
mainpublic static void main(java.lang.String[] args) Main for testing.
 
- 
 
-