ramShop.core
Class Optimization

java.lang.Object
  |
  +--ramShop.core.Optimization

public class Optimization
extends java.lang.Object

Ordering of supplies optimization class. A computer shop orders \a d units of RAM at fixed times t=1..N. The supply \a d is optimized when demand \a w is unknown.


Constructor Summary
Optimization()
          Constructor.
 
Method Summary
 float getAlpha()
          Returns wholesale price lognormal distribution shape parameter.
 int getB()
          Returns saturation demand.
 float getBeta()
          Returns demand exponential distribution elasticity parameter.
 float getCr()
          Returns retail price.
 float getCw()
          Returns wholesale price.
 int getCwRange()
          Returns wholesale integration range rule.
 float getCwStep()
          Returns wholesale price integration step.
 int getCwStepCount()
          Returns number of steps, used to integrate wholesale price.
 boolean getCwUncertain()
          Returns true, if wholesale price is uncertain, false otherwise.
 int getD()
          Returns shop warehouse size.
 float getGamma()
          Returns wholesale price lognormal distribution scale parameter.
 float getL()
          Returns loss due to short supply.
 int getLamda()
          Returns expected RAM demand.
 boolean getMarketElastic()
          Returns true, if market is elastic, false otherwise.
 int getMaxCr()
          Returns maximal retail price.
 float getMaxCw()
          Returns maximal wholesale price.
 int getMinCr()
          Returns minimal retail price.
 float getMinCw()
          Returns minimal wholesale price.
 int getN()
          Returns number of time stages.
 long getTableSize()
          Calcutales estimated size of optimiztion tables.
 int getW()
          Returns maximal RAM demand.
 Solution optimalDecision(int currentQ, float currentCw)
          Returns optimal decision.
 Solution optimalDecision(int currentQ, float currentCw, int stage)
          Returns optimal decision in given stage.
 void refreshTables()
          (Re)calculates optimal decisions.
 void setAlpha(float alpha)
          Sets wholesale price lognormal distribution shape parameter.
 void setB(int b)
          Sets saturation demand.
 void setBeta(float beta)
          Sets demand exponential distribution elasticity parameter.
 void setCr(float cr)
          Sets retail price.
 void setCw(float cw)
          Sets wholesale price.
 void setCwRange(int cwRange)
          Sets wholesale integration range rule.
 void setCwStep(float cwStep)
          Sets wholesale price integration step.
 void setCwUncertain(boolean cwUncertain)
          Sets if wholesale price is uncertain.
 void setD(int D)
          Sets shop warehouse size.
 void setGamma(float gamma)
          Sets wholesale price lognormal distribution scale parameter.
 void setL(float L)
          Sets loss due to short supply.
 void setLamda(int lamda)
          Sets expected RAM demand.
 void setMarketElastic(boolean marketElastic)
          Sets if market is elstic.
 void setMaxCr(int maxCr)
          Sets maximal retail price
 void setMinCr(int minCr)
          Sets minimal retail price
 void setN(int N)
          Sets number of time stages.
 void setProgressBar(javax.swing.JProgressBar progressBar)
          Sets progress bar, used to indicate table calculation progress.
 void setW(int W)
          Sets maximal RAM demand.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Optimization

public Optimization()
             throws BadParamException
Constructor. Creates optimization class with default parameters.

Method Detail

getCw

public float getCw()
Returns wholesale price.

Returns:
wholesale price of one RAM unit.

setCw

public void setCw(float cw)
           throws BadParamException
Sets wholesale price.

Parameters:
cw - wholesale price of one RAM unit.
BadParamException

getCr

public float getCr()
Returns retail price.

Returns:
retail price of one RAM unit.

setCr

public void setCr(float cr)
           throws BadParamException
Sets retail price.

Parameters:
cr - retail price of one RAM unit.
BadParamException

getN

public int getN()
Returns number of time stages.

Returns:
number of time stages.

setN

public void setN(int N)
          throws BadParamException
Sets number of time stages.

Parameters:
N - number of time stages.
BadParamException

getL

public float getL()
Returns loss due to short supply.

Returns:
loss due to short supply of one RAM unit.

setL

public void setL(float L)
          throws BadParamException
Sets loss due to short supply.

Parameters:
L - loss due to short supply of one RAM unit.
BadParamException

getD

public int getD()
Returns shop warehouse size.

Returns:
shop warehouse size in RAM units.

setD

public void setD(int D)
          throws BadParamException
Sets shop warehouse size.

Parameters:
D - shop warehouse size in RAM units.
BadParamException

getW

public int getW()
Returns maximal RAM demand.

Returns:
maximal RAM demand.

setW

public void setW(int W)
          throws BadParamException
Sets maximal RAM demand.

Parameters:
W - maximal RAM demand.
BadParamException

getLamda

public int getLamda()
Returns expected RAM demand.

Returns:
expected RAM demand.

setLamda

public void setLamda(int lamda)
              throws BadParamException
Sets expected RAM demand.

Parameters:
lamda - expected RAM demand.
BadParamException

getCwUncertain

public boolean getCwUncertain()
Returns true, if wholesale price is uncertain, false otherwise.

Returns:
wholesale price uncertainty.

setCwUncertain

public void setCwUncertain(boolean cwUncertain)
Sets if wholesale price is uncertain.

Parameters:
cwUncertain - wholesale price uncertainty.

getAlpha

public float getAlpha()
Returns wholesale price lognormal distribution shape parameter.

Returns:
lognormal distribution shape parameter.

setAlpha

public void setAlpha(float alpha)
              throws BadParamException
Sets wholesale price lognormal distribution shape parameter.

Parameters:
alpha - lognormal distribution shape parameter.
BadParamException

getGamma

public float getGamma()
Returns wholesale price lognormal distribution scale parameter.

Returns:
lognormal distribution scale parameter.

setGamma

public void setGamma(float gamma)
              throws BadParamException
Sets wholesale price lognormal distribution scale parameter.

BadParamException

getCwStep

public float getCwStep()
Returns wholesale price integration step.

Returns:
wholesale price integration step.

setCwStep

public void setCwStep(float cwStep)
               throws BadParamException
Sets wholesale price integration step.

Parameters:
cwStep - wholesale price integration step.
BadParamException

getCwRange

public int getCwRange()
Returns wholesale integration range rule.

Returns:
wholesale integration range rule (2 or 3).

setCwRange

public void setCwRange(int cwRange)
                throws BadParamException
Sets wholesale integration range rule.

Parameters:
cwRange - wholesale integration range rule (2 or 3 are allowed now, 3 means increased precision).
BadParamException

getMarketElastic

public boolean getMarketElastic()
Returns true, if market is elastic, false otherwise.

Returns:
market elasticity.

setMarketElastic

public void setMarketElastic(boolean marketElastic)
Sets if market is elstic.

Parameters:
marketElastic - market elsticity.

getB

public int getB()
Returns saturation demand.

Returns:
saturation demand.

setB

public void setB(int b)
          throws BadParamException
Sets saturation demand.

Parameters:
b - saturation demand.
BadParamException

getBeta

public float getBeta()
Returns demand exponential distribution elasticity parameter.

Returns:
exponential distribution elasticity parameter.

setBeta

public void setBeta(float beta)
             throws BadParamException
Sets demand exponential distribution elasticity parameter.

Parameters:
beta - exponential distribution elasticity parameter.
BadParamException

getMinCr

public int getMinCr()
Returns minimal retail price.

Returns:
minimal retail price.

setMinCr

public void setMinCr(int minCr)
              throws BadParamException
Sets minimal retail price

Parameters:
minCr - minimal retail price
BadParamException

getMaxCr

public int getMaxCr()
Returns maximal retail price.

Returns:
maximal retail price.

setMaxCr

public void setMaxCr(int maxCr)
              throws BadParamException
Sets maximal retail price

Parameters:
maxCr - maximal retail price
BadParamException

refreshTables

public void refreshTables()
                   throws BadParamException
(Re)calculates optimal decisions. (Re)calculates decisions tables using current optimization parameters. Results are stored in optimization tables.

BadParamException

optimalDecision

public Solution optimalDecision(int currentQ,
                                float currentCw)
Returns optimal decision. Returns optimal supply and retail price with resulting utility, given the number of unslod RAM units \a currentQ from previous time stage and wholesale price \a currentCw.

Parameters:
currentQ - number of unsold units (>=0 and <=shop warehouse size).
currentCw - wholesale price (must be in wholesale price interval that was used to optimize).
Returns:
optimal decision.
See Also:
optimalDecision(int, float, int)

optimalDecision

public Solution optimalDecision(int currentQ,
                                float currentCw,
                                int stage)
Returns optimal decision in given stage. Returns optimal supply and retail price with resulting utility in time stage \a stage, given the number of unslod RAM units \a currentQ from previous stage and wholesale price \a currentCw.

Parameters:
currentQ - number of unsold units (>=0 and <=shop warehouse size).
currentCw - wholesale price (must be in wholesale price interval that was used to optimize).
stage - time stage number (>0 and <=number of time stages).
Returns:
optimal decision (or null if parameters are incorrect)
See Also:
optimalDecision(int, float)

getMinCw

public float getMinCw()
Returns minimal wholesale price.

Returns:
minimal wholesale price of one RAM unit.

getMaxCw

public float getMaxCw()
Returns maximal wholesale price.

Returns:
maximal wholesale price of one RAM unit.

getCwStepCount

public int getCwStepCount()
Returns number of steps, used to integrate wholesale price.

Returns:
wholesale price integration step count.

setProgressBar

public void setProgressBar(javax.swing.JProgressBar progressBar)
Sets progress bar, used to indicate table calculation progress.

Parameters:
progressBar - progress bar.

getTableSize

public long getTableSize()
                  throws BadParamException
Calcutales estimated size of optimiztion tables.

Returns:
size of optimiztion tables in bytes.
BadParamException