SALPMPE
Class ApproxAlgorithm

java.lang.Object
  extended by SALPMPE.ApproxAlgorithm

public class ApproxAlgorithm
extends java.lang.Object

Defines the approximate best response iterative algorithm. Computes convergence criteria, report solutions and long run indicators.

Version:
2.0

Field Summary
(package private) static double[][] Combinatorial
          combinatorial numbers, use to index states in small intances
 
Constructor Summary
ApproxAlgorithm()
          Defines a new instance of the approximate best response iterative algorithm.
 
Method Summary
 state[] allStates(ApproxLP ALP, sol_sep[] q_sep)
          Returns all states in state space, and their strategies.
 void computeIndicator(state[] sample, java.io.BufferedWriter out_ind, int niter, double budslack, double runningtime)
          Computes simulated long run indicators of interest.
 boolean convergenceCriteria(double JBase, double JRresponse, double Tolerr, int niter)
          Checks if convergence criteria is met.
 void excelIndicator(state[] sample, int niter, double runningtime, java.lang.String status)
          Computes simulated long run indicators of interest (for log file).
(package private) static void getCombinatorial()
          Computes combinatorial coefficients use to index states for small instances.
 void killCplex(ApproxLP ALP)
          Kills CPLEX instances and tries to release memory.
static void main(java.lang.String[] args)
          Class main routine.
 int maxInner(int niter)
          Computes maximum number of inner iterations in computation of approximate best response.
 void reportCoeff(ApproxLP ALP)
          Reports solution coefficients.
 void reportPolicy(ApproxLP ALP, sol_sep[] q_sep)
          Reports entry and exit equilibrium policies.
 void ReportProgress(double JBase, double JRresponse, double Tolerr, int niter, java.io.BufferedWriter out_sum)
          Prints out algorithm's progress.
 void reportValue(ApproxLP ALP, sol_sep[] q_sep)
          Reports value function approximation and equilibrium investment policy.
 void solveEquilibrium()
          Solves for the approximate equilibrium.
 void TotalNumberStates(int samplesize1, int samplesize2)
          Computes total number of states use in LP formulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Combinatorial

static double[][] Combinatorial
combinatorial numbers, use to index states in small intances

Constructor Detail

ApproxAlgorithm

public ApproxAlgorithm()
Defines a new instance of the approximate best response iterative algorithm.

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Class main routine. Declares a new algorithm instance and solves for the equilibrium.

Throws:
java.io.IOException

solveEquilibrium

public void solveEquilibrium()
                      throws java.io.IOException
Solves for the approximate equilibrium.

Throws:
java.io.IOException

killCplex

public void killCplex(ApproxLP ALP)
Kills CPLEX instances and tries to release memory.

Parameters:
ALP - Instance of CPLEX model.

convergenceCriteria

public boolean convergenceCriteria(double JBase,
                                   double JRresponse,
                                   double Tolerr,
                                   int niter)
Checks if convergence criteria is met.

Parameters:
JBase - Simulated value function for a firm using the approximate best response to the incumbent strategy when competitors use the incumbent strategy.
JRresponse - Simulated value function for a firm when all industry uses the incumbent strategy.
Tolerr - Tolerance error for the convergence criteria.
niter - Iteration number.
Returns:
"true"- equilibrium found, "false" iterate.

reportCoeff

public void reportCoeff(ApproxLP ALP)
Reports solution coefficients.

Parameters:
ALP - Instance of CPLEX model.

reportPolicy

public void reportPolicy(ApproxLP ALP,
                         sol_sep[] q_sep)
Reports entry and exit equilibrium policies.

Parameters:
ALP - Instance of approximate algorithm.
q_sep - History of approximate linear program solutions.

reportValue

public void reportValue(ApproxLP ALP,
                        sol_sep[] q_sep)
Reports value function approximation and equilibrium investment policy.

Parameters:
ALP - Instance of approximate algorithm.
q_sep - History of approximate linear program solutions.

computeIndicator

public void computeIndicator(state[] sample,
                             java.io.BufferedWriter out_ind,
                             int niter,
                             double budslack,
                             double runningtime)
Computes simulated long run indicators of interest.

Parameters:
sample - Sampled set of states.
out_ind - Buffered writer for reporting indicators.
niter - Iteration number.
budslack - Value of slack variable in SALP implementation.
runningtime - Algorithm's total running time.

excelIndicator

public void excelIndicator(state[] sample,
                           int niter,
                           double runningtime,
                           java.lang.String status)
Computes simulated long run indicators of interest (for log file).

Parameters:
sample - Sampled set of states.
niter - Iteration number.
runningtime - Algorithm's total running time.
status - CPLEX solver exit status.

ReportProgress

public void ReportProgress(double JBase,
                           double JRresponse,
                           double Tolerr,
                           int niter,
                           java.io.BufferedWriter out_sum)
Prints out algorithm's progress.

Parameters:
JBase - Simulated value function for a firm using the approximate best response to the incumbent strategy when competitors use the incumbent strategy.
JRresponse - Simulated value function for a firm when industry use the incumbent strategy.
Tolerr - Tolerance error for the convergence criteria.
niter - Iteration number.
out_sum - Buffered writer for reporting algorithm evolution.

TotalNumberStates

public void TotalNumberStates(int samplesize1,
                              int samplesize2)
Computes total number of states use in LP formulation.

Parameters:
samplesize1 - Size of the sampled set of states.
samplesize2 - Size of the additional set of states.

maxInner

public int maxInner(int niter)
Computes maximum number of inner iterations in computation of approximate best response.

Parameters:
niter - Iteration count.

getCombinatorial

static void getCombinatorial()
Computes combinatorial coefficients use to index states for small instances.


allStates

public state[] allStates(ApproxLP ALP,
                         sol_sep[] q_sep)
Returns all states in state space, and their strategies.

Parameters:
q_sep - History of solutions to the approximate linear programs.
Returns:
set of possible states in the state space with their strategies.