?? evothreemults.java~
字號:
writeGNUPlotScript( dirName, 1 );
}
/*
private static void add2MultPost1Plus1( int id, String genes)
{
// 1+1
final int POP_SIZE = 20;
final int TP_POP_SIZE = 2;
final double BIT_MUTATION_PROB = 0.05;
final int GENOTYPE_MUT = 1;
final double XOVER_PROB = 0;
final double MUTATION_PROB = 0.8;
final int NUM_OF_ELITES = 1;
final double CHOP_PROB = 0.1;
final double STRETCH_PROB = 0.1;
final double TP_XOVER_PROB = 0;
final double TP_MUTATION_PROB = 1;
final int TP_NUM_OF_ELITES = 1;
final double[] RANK_PROBS = { 1d, 0d };
final double[] TP_RANK_PROBS = { 1d, 0d };
//
// D - Circuit Structure Properties
final int BITS_PER_VARIABLE = 5;
final int LUT_INPUTS = 2;
// D - Simulator Properties
final int SIMULATOR_GATE_DELAY = 1;
final double T_SETUP = 0.45;
// final int INPUT_SAMPLE_SEPARATION = 1;
// E - Experiment Properties
final int TEST_LENGTH = 50;
// M - Log Properties
int DUMP_POP_EVERY = 1;
int GENERATIONS = 20000;
// E - EXPERIMENT set up
Experiment inExperiment = new MultiplierExperiment( 2, T_SETUP );
Experiment aonExperiment = new AllOrNothingExperiment( inExperiment );
Experiment tpexp = new TestPattern4EvolvingExperiment( inExperiment );
// D - DEPLOYMENT set up
// SimulatorCircuit circuit = new SimulatorLUTCircuit( SIMULATOR_GATE_DELAY, BITS_PER_VARIABLE , LUT_INPUTS, experiment.getNumOfInputs(), experiment.getNumOfOutputs() );
ElementDelayModel delayModel = new ConstantDelayModel( SIMULATOR_GATE_DELAY );
CircuitMapping circuitMapping = new LUTAbsoluteMapping( inExperiment.getNumOfInputs(), inExperiment.getNumOfOutputs(), BITS_PER_VARIABLE, LUT_INPUTS, delayModel );
SimulatorSimpleCircuit circuit = new SimulatorSimpleCircuit( circuitMapping );
SimulatorDeployment inDeployment = new SimulatorDeployment( circuit );
// E - For Parsimony Experiment
BufferedIndividualDeployment deployment = new BufferedIndividualDeployment( inDeployment );
Experiment experiment = new VarLenGenParsimonyExperiment( aonExperiment, deployment );
int lutSize = 1 << LUT_INPUTS;
int blockSize = lutSize + LUT_INPUTS * BITS_PER_VARIABLE;
int genotypeLength = ( ( 1 << BITS_PER_VARIABLE ) - experiment.getNumOfInputs() ) * blockSize;
int blockLength = BITS_PER_VARIABLE * LUT_INPUTS + 1 << LUT_INPUTS;
int testPatLength = ( 1 << experiment.getNumOfInputs() ) * 2;
int tpGenLength = testPatLength * experiment.getNumOfInputs();
final Genotype SEED0 = new Genotype( genes );
final Genotype[] SEEDS = { SEED0 };
final Genotype[] TP_SEEDS = { };
GeneticOperator m = new ExactGenotypeMutator( GENOTYPE_MUT );
GeneticOperator chop = new Chopper( 1 );
GeneticOperator stretch = new Stretcher( 1, 0 );
GeneticOperator tpm = new ExactGenotypeMutator( GENOTYPE_MUT );
GeneticOperator spxo = new TracingSinglePointXOver();
GeneticOperator tpspxo = new SinglePointXOver();
// 1+1
GeneticOperator[] geneticOps = { m, chop, stretch };
//GeneticOperator[] geneticOps = { m };
GeneticOperator[] tpGeneticOps = { tpm };
double[] opsProbs = { MUTATION_PROB, CHOP_PROB, STRETCH_PROB };
//double[] opsProbs = { MUTATION_PROB };
double[] tpOpsProbs = { TP_MUTATION_PROB };
//
// Selector selector = new FitnessProportionateSelector();
Selector selector = new RankSelector( RANK_PROBS );
//Selector selector = new RankSelector( );
Selector tpSelector = new RankSelector( TP_RANK_PROBS );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, SEEDS );
Evolver tpEvolver = new StandardEvolver( TP_POP_SIZE, tpGenLength, tpGeneticOps, tpOpsProbs, tpSelector, TP_NUM_OF_ELITES, TP_SEEDS );
Evolver[] evolvers = { evolver, tpEvolver };
Experiment[] experiments = { experiment, tpexp };
InteractionModel interactionModel = new StandardInteractionModel( evolver, deployment, experiment );
int[] evolutionFrequency = { 1 , 4 };
// InteractionModel interactionModel = new CircuitTestPatternIM( evolvers, deployment, experiments, evolutionFrequency );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, java.lang.Integer.MAX_VALUE );
String dirName = "2MultPost1Plus1-" + id;
monica.setName( dirName );
taskQ.add( monica );
taskQNames.add( dirName );
writeGNUPlotScript( dirName, 1 );
}
*/
private static void add2MultPostParsimony1Plus1( int id, String genes)
{
// 1+1
final int POP_SIZE = 11;
final int TP_POP_SIZE = 2;
final double BIT_MUTATION_PROB = 0.05;
final int GENOTYPE_MUT = 1;
final double XOVER_PROB = 0;
final double MUTATION_PROB = 0.6;
final int NUM_OF_ELITES = 1;
final double CHOP_PROB = 0.1;
final double STRETCH_PROB = 0.1;
final double TP_XOVER_PROB = 0;
final double TP_MUTATION_PROB = 1;
final int TP_NUM_OF_ELITES = 1;
final double[] RANK_PROBS = { 1d, 0d };
final double[] TP_RANK_PROBS = { 1d, 0d };
//
// D - Circuit Structure Properties
final int BITS_PER_VARIABLE = 5;
final int LUT_INPUTS = 2;
// D - Simulator Properties
final int SIMULATOR_GATE_DELAY = 1;
final double T_SETUP = 0.45;
// final int INPUT_SAMPLE_SEPARATION = 1;
// E - Experiment Properties
final int TEST_LENGTH = 50;
// M - Log Properties
int DUMP_POP_EVERY = 1;
int GENERATIONS = 50000;
// E - EXPERIMENT set up
Experiment inExperiment = new MultiplierExperiment( 2, T_SETUP );
Experiment aonExperiment = new AllOrNothingExperiment( inExperiment );
Experiment tpexp = new TestPattern4EvolvingExperiment( inExperiment );
// D - DEPLOYMENT set up
// SimulatorCircuit circuit = new SimulatorLUTCircuit( SIMULATOR_GATE_DELAY, BITS_PER_VARIABLE , LUT_INPUTS, experiment.getNumOfInputs(), experiment.getNumOfOutputs() );
ElementDelayModel delayModel = new ConstantDelayModel( SIMULATOR_GATE_DELAY );
CircuitMapping circuitMapping = new LUTAbsoluteMapping( inExperiment.getNumOfInputs(), inExperiment.getNumOfOutputs(), BITS_PER_VARIABLE, LUT_INPUTS, delayModel );
SimulatorSimpleCircuit circuit = new SimulatorSimpleCircuit( circuitMapping );
SimulatorDeployment deployment = new SimulatorDeployment( circuit );
// E - For Parsimony Experiment
final int TARGET_GATES = 6;
Experiment experiment = new ElementParsimonyExperiment( aonExperiment, circuit, TARGET_GATES );
int lutSize = 1 << LUT_INPUTS;
int blockSize = lutSize + LUT_INPUTS * BITS_PER_VARIABLE;
int genotypeLength = ( ( 1 << BITS_PER_VARIABLE ) - experiment.getNumOfInputs() ) * blockSize;
int blockLength = BITS_PER_VARIABLE * LUT_INPUTS + 1 << LUT_INPUTS;
int testPatLength = ( 1 << experiment.getNumOfInputs() ) * 2;
int tpGenLength = testPatLength * experiment.getNumOfInputs();
final Genotype SEED0 = new Genotype( genes, genotypeLength, 6 );
final Genotype[] SEEDS = { SEED0 };
final Genotype[] TP_SEEDS = { };
GeneticOperator m = new ExactGenotypeMutator( GENOTYPE_MUT );
GeneticOperator bmin0 = new BunchMutator( BITS_PER_VARIABLE, 1, blockSize, lutSize );
GeneticOperator bmin1 = new BunchMutator( BITS_PER_VARIABLE, 1, blockSize, lutSize + BITS_PER_VARIABLE );
GeneticOperator bmf = new BunchMutator( lutSize, 1, blockSize );
GeneticOperator bc = new BlockCopy ( blockSize, blockSize );
GeneticOperator chop = new Chopper( 1 );
GeneticOperator stretch = new Stretcher( 1, 0 );
GeneticOperator tpm = new ExactGenotypeMutator( GENOTYPE_MUT );
GeneticOperator spxo = new TracingSinglePointXOver();
GeneticOperator tpspxo = new SinglePointXOver();
// 1+1
GeneticOperator[] geneticOps = { bmin0, bmin1, bmf, bc };
GeneticOperator[] tpGeneticOps = { tpm };
double[] opsProbs = { 0.2,0.3,0.3,0.2 };
double[] tpOpsProbs = { TP_MUTATION_PROB };
//
// Selector selector = new FitnessProportionateSelector();
Selector selector = new RankSelector( RANK_PROBS );
//Selector selector = new RankSelector( );
Selector tpSelector = new RankSelector( TP_RANK_PROBS );
Evolver evolver = new StandardEvolver( POP_SIZE, genotypeLength, geneticOps, opsProbs, selector, NUM_OF_ELITES, SEEDS );
Evolver tpEvolver = new StandardEvolver( TP_POP_SIZE, tpGenLength, tpGeneticOps, tpOpsProbs, tpSelector, TP_NUM_OF_ELITES, TP_SEEDS );
Evolver[] evolvers = { evolver, tpEvolver };
Experiment[] experiments = { experiment, tpexp };
InteractionModel interactionModel = new StandardInteractionModel( evolver, deployment, experiment );
int[] evolutionFrequency = { 1 , 4 };
// InteractionModel interactionModel = new CircuitTestPatternIM( evolvers, deployment, experiments, evolutionFrequency );
Monica monica = new Monica( interactionModel, DUMP_POP_EVERY, GENERATIONS );
String dirName = "2MultPostParimony1Plus1-" + id;
monica.setName( dirName );
taskQ.add( monica );
taskQNames.add( dirName );
writeGNUPlotScript( dirName, 1 );
}
private static void add2MultParsimony1Plus1( int id )
{
// A - Genetic Algorithms Properties
// 1+1
final int POP_SIZE = 11;
final int TP_POP_SIZE = 2;
final double BIT_MUTATION_PROB = 0.05;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -