|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Folding
public class Folding
The class Folding implements the top level of the algorithm. It has a main method that reads a chain from the command line. Here is a sample run.
> java Folding hphpphhp Best solution: Chromosome [fitness=-2, genes=[Right, Up, Up, Left, Down, Left, Up], chain=hphpphhp]Because of the ``probabilistic'' nature of the algorithm, each run is likely to produce a new solution.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_CHAIN
The chain that will be used if no argument was supplied on the command line. |
static int |
MAX_GENERATIONS
A constant that specifies the maximum number of generations (iterations) for a run. |
Constructor Summary | |
---|---|
Folding()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
The main method of this program. |
static Chromosome |
solve(java.lang.String chain)
Implements the top loop of the genetic algorithm. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_GENERATIONS
public static final java.lang.String DEFAULT_CHAIN
Constructor Detail |
---|
public Folding()
Method Detail |
---|
public static Chromosome solve(java.lang.String chain)
chain
- The chain for which a fold is sought
public static void main(java.lang.String[] args)
> java Folding ppphhpphhppppphhhhhhhpphhpppphhpphpp > java Folding hphpphhphpphphhpphph > java Folding hphpphhp
args
- the array of arguments that were passed to the main method, generally on the command line
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |