|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSALPMPE.ApproxLP
public class ApproxLP
Defines an instance of SALP program, builds model and recovers coefficients in approximation.
| Nested Class Summary | |
|---|---|
static class |
ApproxLP.prob
Defines the transition dynamics for the model (subclass). |
| Field Summary | |
|---|---|
(package private) strategy |
compact
Initial strategy (compact representation) |
(package private) int[] |
exeHi
First level of differentiation in coarseness of approximation |
(package private) int |
exeLow
Second level of differentiation in coarseness of approximation |
(package private) int[] |
exeMid
Third level of differentiation in coarseness of approximation |
(package private) java.util.Random |
generator
Random number generator for simulating chain evolution |
(package private) int |
jini
Auxiliary variable (keeps track of initial simulation point) |
(package private) ilog.cplex.IloCplex |
model
CPLEX LP model |
(package private) int[][] |
nodes
Coarseness of linear interpolation of separable functions |
(package private) ApproxLP.prob |
P
Transition probability class |
(package private) Profit |
profit
Profit auxiliary array |
(package private) ilog.concert.IloNumVar |
v_const
Model decision variable (base value) |
(package private) ilog.concert.IloNumVar[][][] |
v_sep
Model decision variables (separable functions generalization) |
(package private) ilog.concert.IloNumVar[][] |
v_slack
Slack variable for SALP implementation |
(package private) int |
xini
Auxiliary variable (keeps track of initial simulation point) |
| Constructor Summary | |
|---|---|
ApproxLP()
Defines a new IloCplex model, loads profit function, sets coarseness of approximation and loads initial strategy. |
|
| Method Summary | |
|---|---|
state[] |
allStates(sol_sep[] q_sep,
double[] frecuency)
Returns all states in state space, and their strategies. |
void |
buildModel(state[] sample,
state[] altsample,
double[][] exit,
double[][] altexit,
boolean[] constraint)
Constructs and solves the approximating linear program using the sampled set of states. |
boolean |
CoefTaken(state[] sample,
int x,
int k,
int n)
Indicates whether a particular basis function is being covered by the set of sampled states. |
boolean |
CompareExit(state[] sample,
sol_sep q_firm,
sol_sep q_aux,
int i,
java.io.BufferedWriter out_sum)
Compare exit strategies implied by successive LP solution and decide on convergence of LP heuristic. |
double[][] |
computeCoeff(int[] s,
strategy Strat,
int out)
Computes coefficients necessary to calculate the Bellman operator. |
double |
ComputeV(state[] sample,
sol_sep[] q_sep,
java.lang.String mode,
boolean[] constraint)
Simulates performance of an strategy against the incumbent strategy. |
double |
EntryFromR(int[] s,
strategy Strat,
sol_sep q_sep)
Computes greedy response against a solution for the approximate linear program. |
void |
expectedValue(int x,
int[] s,
strategy Strat,
double pi,
double exit,
int sample_index)
Construct the constraints for the approximate linear program associated to particular industry state. |
(package private) static boolean[] |
getConstraints(state[] sample,
int maxSize)
Limits size of sampled states used in LP formulation. |
double[][] |
getExit(state[] sample,
sol_sep q_firm,
int i)
Returns exit strategy implied by LP solution. |
double[][] |
getmulti(int n,
int k,
double Pexit)
Compute multinomial probabilities for possible transitions. |
double[] |
getmultiEntry(double Pentry,
int n)
Compute entry probabilities as a function of number of entrants. |
double |
getSlack(state[] sample,
state[] altsample,
boolean[] constraint)
Returns value of slack variable in SALP implementation. |
sol_sep |
getSolution()
Returns the solution to the approximate linear program. |
int[] |
inverseIndex(int j,
double[][] Combinatorial)
Index for states when dealing when small instances. |
strategy |
IterativeStrategy(int[] s,
sol_sep[] q_sep,
int period)
Oracle M: Computes incumbent strategy based on previous solutions to the approximate linear programs. |
void |
loadCompact()
Loads initial strategy from compact.txt file. |
void |
reduceBaseFunctions()
Reduces size of approximating architecture. |
void |
reportMemory(int i,
int n)
Reports memory usage. |
int |
returnIndex(int[] s,
double[][] Combinatorial)
Returns index of a state when dealing with small instances. |
state[] |
sampleRest(sol_sep[] q_sep,
state[] sample,
boolean[] constraint)
Add states to set of sampled states so that all basis functions appear in the objective function of the LP. |
state[] |
sampleStates(sol_sep[] q_sep,
double inGamma,
double obli)
Sampling routine. |
void |
setExeNodes()
Sets coarseness of approximating architecture. |
double[] |
StratFromR(int x,
int[] s,
strategy Strat,
sol_sep q_sep)
Computes greedy response against a solution for the approximate linear program. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
ilog.cplex.IloCplex model
strategy compact
ilog.concert.IloNumVar[][][] v_sep
ilog.concert.IloNumVar v_const
ilog.concert.IloNumVar[][] v_slack
ApproxLP.prob P
Profit profit
java.util.Random generator
int xini
int jini
int[][] nodes
int[] exeHi
int exeLow
int[] exeMid
| Constructor Detail |
|---|
public ApproxLP()
| Method Detail |
|---|
public void buildModel(state[] sample,
state[] altsample,
double[][] exit,
double[][] altexit,
boolean[] constraint)
sample - Sampled set of states used to construct the approximating linear program.altsample - Additional set of states that complete use of basis functions.exit - Exit strategies for states in sample set.altexit - Exit strategies for states in additional sample set.constraint - indicates if a state in sample set will generate a set of constraints in the LP (limits size of LPs without affecting sampling).
public void reportMemory(int i,
int n)
i - iteration count.n - inner iteration count.public sol_sep getSolution()
public double getSlack(state[] sample,
state[] altsample,
boolean[] constraint)
sample - Sampled set of states used to construct the approximating linear program.altsample - Additional set of states that complete use of basis functions.constraint - indicates if a state in sample set will generate a set of constraints in the LP (limits size of LPs without affecting sampling).
public double[][] getExit(state[] sample,
sol_sep q_firm,
int i)
sample - Sampled set of states used to construct the approximating linear program.q_firm - solution to LP program.i - iteration count.
public boolean CompareExit(state[] sample,
sol_sep q_firm,
sol_sep q_aux,
int i,
java.io.BufferedWriter out_sum)
sample - Sampled set of states used to construct the approximating linear program.q_firm - solution to previous LP program.q_aux - solution to current LP program.i - iteration count.out_sum - report file handle.
public void expectedValue(int x,
int[] s,
strategy Strat,
double pi,
double exit,
int sample_index)
x - Firm quality state.s - Competitors quality state.strategy - Incumbent strategy followed by competitors.pi - Profit for the incumbent firm.exit - incumbent firm's exit strategy.sample_index - index of current state within the sampled states.
public state[] sampleStates(sol_sep[] q_sep,
double inGamma,
double obli)
q_sep - History of solutions to the approximate linear programs.inGamma - appreciation factor in transition dynamics.obli - probability that a firm will select to use initial (compact) strategy.
public state[] sampleRest(sol_sep[] q_sep,
state[] sample,
boolean[] constraint)
q_sep - History of solutions to the approximate linear programs.sample - Sampled set of states used to construct the approximating linear program.constraint - indicates if a state in sample set will generate a set of constraints in the LP (limits size of LPs without affecting sampling).
public double ComputeV(state[] sample,
sol_sep[] q_sep,
java.lang.String mode,
boolean[] constraint)
sample - Sampled set of states used to construct the approximating linear program.q_sep - History of solutions to the approximate linear programs.mode - "Base" to test incumbent strategy, "R" to test approximate best response.constraint - indicates if a state in sample set will generate a set of constraints in the LP (limits size of LPs without affecting sampling).
public strategy IterativeStrategy(int[] s,
sol_sep[] q_sep,
int period)
s - Incumbent industry state.q_sep - History of solutions to the approximate linear programs.period - Iteration for which one wants to reconstruct approximate best response.
public double[] StratFromR(int x,
int[] s,
strategy Strat,
sol_sep q_sep)
x - Firm state.s - Competitors state.q_sep - Solution for the approximate linear program.
public double EntryFromR(int[] s,
strategy Strat,
sol_sep q_sep)
s - Industry state.strategy - industry strategy.q_sep - Solution for the approximate linear program.
public double[][] computeCoeff(int[] s,
strategy Strat,
int out)
s - Industry state.strategy - Strategy.
public double[][] getmulti(int n,
int k,
double Pexit)
n - Number of firms.k - Quality of the firm.exit - Exit probability.
public double[] getmultiEntry(double Pentry,
int n)
Pentry - Individual firm's entry probability.n - number of potential entrants.
public int[] inverseIndex(int j,
double[][] Combinatorial)
j - Index of the state.Combinatorial - Combinatorial numbers (pre-computed for efficiency).
public int returnIndex(int[] s,
double[][] Combinatorial)
s - Industry state.Combinatorial - Combinatorial numbers (pre-computed for efficiency).
public state[] allStates(sol_sep[] q_sep,
double[] frecuency)
q_sep - History of solutions to the approximate linear programs.frequency - sample frequency associated (uniformly) to each state.
static boolean[] getConstraints(state[] sample,
int maxSize)
sample - Sampled set of states used to construct the approximating linear program.maxSize - maximum number of states used in LP formulation.
public boolean CoefTaken(state[] sample,
int x,
int k,
int n)
sample - Sampled set of states used to construct the approximating linear program.x - firm's quality state.k - basis function's quality state.n - number of firms in quality state k.
public void reduceBaseFunctions()
public void setExeNodes()
public void loadCompact()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||