## org.apache.mahout.ep
Class State<T extends Payload<U>,U>

    java.lang.Object
      org.apache.mahout.ep.State<T,U>

All Implemented Interfaces:
  Comparable<State<T,U>>, org.apache.hadoop.io.Writable

    public class State<T extends Payload<U>,U>

extends Object
implements Comparable<State<T,U>>, org.apache.hadoop.io.Writable

Records evolutionary state and provides a mutation operation for recorded-step meta-mutation. You provide the payload, this class provides the mutation operations. During mutation, the payload is copied and after the state variables are changed, they are passed to the payload. Parameters are internally mutated in a state space that spans all of R^n, but parameters passed to the payload are transformed as specified by a call to setMap(). The default mapping is the identity map, but uniform-ish or exponential-ish coverage of a range are also supported. More information on the underlying algorithm can be found in the following paper http://arxiv.org/abs/0803.3838

See Also:
  `Mapping`

Constructor Summary
`State()`
`State(double[] x0, double omni)` Invent a new state with no momentum (yet).

Method Summary
`int` `compareTo(State<T,U> other)` Natural order is to sort in descending order of score.
`State<T,U>` `copy()` Deep copies a state, useful in mutation.
`boolean` `equals(Object o)`
`double` `get(int i)` Returns a transformed parameter.
`int` `getId()`
`double[]` `getMappedParams()` Returns all the parameters in mapped form.
`Mapping[]` `getMaps()`
`double` `getOmni()`
`double[]` `getParams()`
`T` `getPayload()`
`double[]` `getStep()`
`double` `getValue()`
`int` `hashCode()`
`State<T,U>` `mutate()` Clones this state with a random change in position.
`void` `readFields(DataInput input)`
`void` `setId(int id)`
`void` `setMap(int i, Mapping m)` Defines the transformation for a parameter.
`void` `setMaps(Iterable<Mapping> maps)`
`void` `setMaps(Mapping[] maps)`
`void` `setOmni(double omni)`
`void` `setPayload(T payload)`
`void` `setStep(double[] step)`
`void` `setValue(double v)`
`String` `toString()`
`void` `write(DataOutput out)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### State

    public State()

### State

    public State(double[] x0,
                 double omni)

  Invent a new state with no momentum (yet).

Method Detail

### copy

    public State<T,U> copy()

  Deep copies a state, useful in mutation.

### mutate

    public State<T,U> mutate()

  Clones this state with a random change in position. Copies the payload and lets it know about the change.

  Returns:
    A new state.

### setMap

    public void setMap(int i,
                       Mapping m)

  Defines the transformation for a parameter.

  Parameters:
    `i` - Which parameter's mapping to define.
    `m` - The mapping to use.
  See Also:
    `Mapping`

### get

    public double get(int i)

  Returns a transformed parameter.

  Parameters:
    `i` - The parameter to return.
  Returns:
    The value of the parameter.

### getId

    public int getId()

### getParams

    public double[] getParams()

### getMaps

    public Mapping[] getMaps()

### getMappedParams

    public double[] getMappedParams()

  Returns all the parameters in mapped form.

  Returns:
    An array of parameters.

### getOmni

    public double getOmni()

### getStep

    public double[] getStep()

### getPayload

    public T getPayload()

### getValue

    public double getValue()

### setOmni

    public void setOmni(double omni)

### setId

    public void setId(int id)

### setStep

    public void setStep(double[] step)

### setMaps

    public void setMaps(Mapping[] maps)

### setMaps

    public void setMaps(Iterable<Mapping> maps)

### setValue

    public void setValue(double v)

### setPayload

    public void setPayload(T payload)

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### compareTo

    public int compareTo(State<T,U> other)

  Natural order is to sort in descending order of score. Creation order is used as a tie-breaker.

  Specified by:
    `compareTo` in interface `Comparable<State<T extends Payload<U>,U>>`
  Parameters:
    `other` - The state to compare with.
  Returns:
    -1, 0, 1 if the other state is better, identical or worse than this one.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### write

    public void write(DataOutput out)
               throws IOException

  Specified by:
    `write` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `IOException`

### readFields

    public void readFields(DataInput input)
                    throws IOException

  Specified by:
    `readFields` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `IOException`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.