PIANOS.generator
Class Acceptation

java.lang.Object
  extended by PIANOS.generator.Acceptation

public class Acceptation
extends java.lang.Object

Generates calculations needed when generating the Fortarn module "main".


Constructor Summary
Acceptation()
           
 
Method Summary
static java.util.ArrayList<java.lang.String> generateAcceptationCode(Variable variable, java.lang.String strategy)
          Generates code that decides whether the new value is accepted and makes the necessary changes: updates the value of the current parameter and all functional parameters depending on it.
static java.util.ArrayList<java.lang.String> generateAcceptationFormula(Variable variable)
          Generates code that calculates the acceptance probability for the current parameter.
static java.util.ArrayList<java.lang.String> generateNewValueCode(Variable variable)
          Generates code that fetches a proposed new value for a parameter from its buffer or if the buffer is empty, calls the subroutine "generate".
static java.util.ArrayList<java.lang.String> generateNewValuesFunctionalCode(Variable variable)
          Generates code that calculates new values for all the functional parameters depending on the current parameter.
static void setTopologicalList(java.util.ArrayList<Variable> list)
          Sets the topological variable list that is used when calculating the correct new-value-generation order for functional parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Acceptation

public Acceptation()
Method Detail

setTopologicalList

public static void setTopologicalList(java.util.ArrayList<Variable> list)
Sets the topological variable list that is used when calculating the correct new-value-generation order for functional parameters. This method must be called before any other methods of this class are called.

Parameters:
list - A list of all variables in the current model in topolocial order.

generateNewValueCode

public static java.util.ArrayList<java.lang.String> generateNewValueCode(Variable variable)
Generates code that fetches a proposed new value for a parameter from its buffer or if the buffer is empty, calls the subroutine "generate".

Parameters:
variable - A parameter for which the new value code is generated.We assume that it is indexed by "one_dim(1)" if it is global, by "one_dim(i)" if it is one-dimensional and by "two_dim(i, j)" if it is two-dimensional.

generateAcceptationCode

public static java.util.ArrayList<java.lang.String> generateAcceptationCode(Variable variable,
                                                                            java.lang.String strategy)
                                                                     throws InvalidModelException
Generates code that decides whether the new value is accepted and makes the necessary changes: updates the value of the current parameter and all functional parameters depending on it.

Parameters:
variable - A parameter for which the acceptation code is generated. We assume that it is indexed by "one_dim(1)" if it is global, by "one_dim(i)" if it is one-dimensional and by "two_dim(i, j)" if it is two-dimensional.
Throws:
InvalidModelException

generateNewValuesFunctionalCode

public static java.util.ArrayList<java.lang.String> generateNewValuesFunctionalCode(Variable variable)
                                                                             throws InvalidModelException
Generates code that calculates new values for all the functional parameters depending on the current parameter.

Parameters:
variable - The current parameter. We assume that it is indexed by "one_dim(1)" if it is global, by "one_dim(i)" if it is one-dimensional and by "two_dim(i, j)" if it is two-dimensional. Note that the new values for "SUM"-parameters are not calculated here.
Throws:
InvalidModelException

generateAcceptationFormula

public static java.util.ArrayList<java.lang.String> generateAcceptationFormula(Variable variable)
                                                                        throws InvalidModelException,
                                                                               IllegalParametersException,
                                                                               MissingFunctionException
Generates code that calculates the acceptance probability for the current parameter.

Parameters:
variable - The current parameter. We assume that it is indexed by "one_dim(1)" if it is global, by "one_dim(i)" if it is one-dimensional and by "two_dim(i, j)" if it is two-dimensional.
Throws:
InvalidModelException
IllegalParametersException
MissingFunctionException