hu.birot.OTKit.performance
Class ProductionExamples

java.lang.Object
  extended by hu.birot.OTKit.performance.ProductionExamples

public class ProductionExamples
extends java.lang.Object

This class contains a number of static methods returning concrete implementations of the abstract class Production.


Constructor Summary
ProductionExamples()
           
 
Method Summary
static Production constant(Form F)
          Creates a Production whose produce method always returns the form F.
static Production grammatical()
          This static method returns an instance of Production corresponding to the "produce some grammatical form" method.
static Production SA(double K_max, double K_step, double t_max, double t_min, double t_step, int nr_unmoved)
          This static method returns an instance of Production that realizes a general simulated annealing.
static Production SAOTnm(double K_max, double K_step, double t_max, double t_min, double t_step, int nr_unmoved)
          This static method returns an instance of the Production class, which implements the Simulated Annealing for Optimality Theory Algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProductionExamples

public ProductionExamples()
Method Detail

grammatical

public static Production grammatical()

This static method returns an instance of Production corresponding to the "produce some grammatical form" method. The produce(Grammar G, Form f) method of this Production will return a random surface form that is a grammatical (globally optimal) mapping from underlying form f, with respect to grammar G.

The set of candidates generated from underlying from f must be finite, as defined by method G.gen.allCandidates(f).

G.hierarchy.type defines how the candidates are compared. If the type is "hg", then the weights in G.hierarchy are employed. If the type is "ot", then G.hierarchy will be sorted by rank. In that case, if G.hierarchy contains constraints with equal ranks, then it is unpredictable how they will be ranked. (For this case, see grammaticalPermutte() and grammaticalStratified() below.)

Returns:
An instance of Production corresponding to the "produce some grammatical form" method.

SAOTnm

public static Production SAOTnm(double K_max,
                                double K_step,
                                double t_max,
                                double t_min,
                                double t_step,
                                int nr_unmoved)

This static method returns an instance of the Production class, which implements the Simulated Annealing for Optimality Theory Algorithm. The parameters of the cooling schedule in SA-OT are given as the parameters of this method.

The produce(G, f) method of the returned Production stochastically maps an underlying form f to a surface form, using grammar G. Form f being the underlying form, the initial candidate of the random walk will be chosen randomly by G.gen.randomCandidate(f, Math.random()), the neighbourhood structure is given by G.topology, and G.hierarchy is used as the hierarchy defining the Harmony function. (Do not forget to specify whether G.hierarchy.type is "ot" or "hg".) If you would like to use different starting points for the random walk, you can change G.gen so that it implement a different firstCandidate(uf) method.

Parameters:
K_max - Starting range of the temperature.
K_step - Step decreasing the range of the temperature.
t_max - Highest value of the temperature in each range.
t_min - Step decreasing the value of the temperature within a range.
t_step - Lowest value of the temperature in each range.
nr_unmoved - Number of iterations during which the random walker has not moved in order to stop.
Returns:
An instance of an SA-OT production.

SA

public static Production SA(double K_max,
                            double K_step,
                            double t_max,
                            double t_min,
                            double t_step,
                            int nr_unmoved)

This static method returns an instance of Production that realizes a general simulated annealing. The method produce(Grammar G, Form f) will return a surface form with respect to Grammar G and underlying form f. The production method used is:

In both cases, G.hierarchy.type are rewritten: to "ot" in the first case and to "hg" in the second case.

In the SA-OT case, the parameters of SA-OT are those specified as the parameters of this static method.

In the traditional SA (SA-HG) case, q is either 2 (if G.type == "hg"), or the real value specified by prefix of G.type up till the first "-" character. (For instance, if G.type == "3.13-HG", then q == 3.14.) Subsequently, the SA-OT parameters are converted to corresponding parameters Tmax and r of traditional exponential SA (where temperature is decreased from Tmax by a multiplicative factor q in each iteration). The following formulae are employed:

Both in OT and in HG, the random walk is launched from G.gen.randomCandidate(f, Math.random()). The neighborhood structure is defined by G.topology. The random walk terminates if the random walker has not moved for nr_unmoved iterations.

Parameters:
K_max -
K_step -
t_max -
t_min -
t_step -
nr_unmoved -
Returns:
An instance of the Production class that realizes a general simulated annealing.

constant

public static Production constant(Form F)
Creates a Production whose produce method always returns the form F.

Parameters:
F - the Form that will be constantly returned by the produce method of the Production.
Returns:
A constant Production.