📄 repairtimes.java~
字号:
{
if( Math.random() < 0.5 )
{
SEEDS[ pl ].set( bl );
}
}
}
// final Genotype SEEDTP0 = new Genotype( "GTJqc5eJgQMpdsQijj^llE^Elf[ov_E2`Vj2rIqt[OpfXsGc4n8U`ZS6UXN1p09D", tpGenLength, 6 );
// final Genotype SEEDTP1 = new Genotype( "UrFEZ7_gVE9iEslS0dMJ51eg3jq4cDF3ume6b5iTQuS[8cVo9blDXNncTLs[VTG^", tpGenLength, 6 );
// final Genotype[] TP_SEEDS = { SEEDTP0, SEEDTP1 };
final Genotype[] TP_SEEDS = { };
// BitMutator bm = new BitMutator( BIT_MUTATION_PROB );
// GeneticOperator m = new ExactGenotypeMutator( GENOTYPE_MUT );
GeneticOperator m = new SAGAMutator( 1, 10 );
//GeneticOperator m = new AdaptiveMutator( 1, genotypeLength / 5 );
// GeneticOperator tpm = new AdaptiveMutator( 1, tpGenLength / 5 );
GeneticOperator tpm = new ExactGenotypeMutator( GENOTYPE_MUT );
// GeneticOperator ws = new WireSwapper( BITS_PER_VARIABLE, STABILIZERS );
GeneticOperator spxo = new SinglePointXOver();
GeneticOperator tpspxo = new SinglePointXOver();
// Standard
GeneticOperator[] geneticOps = { m, spxo };
GeneticOperator[] tpGeneticOps = { tpm, tpspxo };
double[] opsProbs = { MUTATION_PROB, XOVER_PROB };
double[] tpOpsProbs = { TP_MUTATION_PROB, TP_XOVER_PROB };
/* 1+1
GeneticOperator[] geneticOps = { m };
GeneticOperator[] tpGeneticOps = { tpm };
double[] opsProbs = { MUTATION_PROB };
double[] tpOpsProbs = { TP_MUTATION_PROB };
*/
// Selector selector = new FitnessProportionateSelector();
Selector selector = new RankSelector( );
// Selector tpSelector = new FitnessProportionateSelector();
// Selector tpSelector = new RankSelector( TP_RANK_PROBS );
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 };
//SingleFaultModel faultModel = new SingleStaticFaultModel( fPos );
//InteractionModel interactionModel = new StandardInteractionModel( evolver, deployment, experiment );
PopulationLogReader.fullOrderGenotypes = true;
int eSize = 7;
int nrEvals = 7;
boolean overdetecting = true;
InteractionModel inIm = new BISTPIM( evolver, deployment, circuit, experiment, faultModel, eSize, overdetecting );
int[] numProps = { 2 };
InteractionModel noisyIM = new NoisyPIM( inIm, deployment, experiment, numProps );
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIM, circuit );
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 = "Add1BIST-" + fName;
monica.setName( dirName );
taskQ.add( monica );
taskQNames.add( dirName );
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3 );
}
private static void add2MultBISTPars( SingleFaultModel faultModel )
{
String dirName = "2MultBISTPars";
// A - Genetic Algorithms Properties
// Standard
final int POP_SIZE = 32;
final int TP_POP_SIZE = 7;
final double BIT_MUTATION_PROB = 0.05;
final int GENOTYPE_MUT = 1;
final double XOVER_PROB = 0.4;
final double ALIEN_PROB = 0;
final double WIRE_SWAP_PROB = 0.7;
final double MUTATION_PROB = 0.6;
final int NUM_OF_ELITES = 2;
final double TP_XOVER_PROB = 0.5;
final double TP_MUTATION_PROB = 0.5;
final int TP_NUM_OF_ELITES = 2;
final double[] TP_RANK_PROBS = { 8d, 4d, 2d, 1d };
//
/* 1+1
final int POP_SIZE = 7;
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 = 1;
final int NUM_OF_ELITES = 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;
/* For NANDC
final int BITS_PER_VARIABLE = 5;
final int STABILIZERS = 1;
final int GATE_INPUTS = 2;
*/
// D - Simulator Properties
final int SIMULATOR_GATE_DELAY = 0;
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 = 30;
// E - EXPERIMENT set up
BooleanFunction boolFunQ = new Add1bitQFun();
BooleanFunction boolFunC = new Add1bitCFun();
// BooleanFunction boolFun = new MUXFunction( 2 , 4 );
// BooleanFunction boolFun = new VertorHorizFun();
// BooleanFunction boolFun = new FLEXToneDetectFun();
/*Experiment experimentQ = new ArbitraryFunctionExperiment( boolFunQ, T_SETUP );
Experiment experimentC = new ArbitraryFunctionExperiment( boolFunC, T_SETUP );
Experiment[] exps = { experimentQ, experimentC };
Experiment experiment = new MultiOutputExperiment( exps );*/
ConfigurableRandomInputExperiment experiment = new MultiplierExperiment( 2, T_SETUP );
Experiment tpexp = new TestPattern4EvolvingExperiment( experiment );
// 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 );
//ElementDelayModel delayModel = new GaussianDelayModel( 0.5, 0.5 );
CircuitMapping circuitMapping = new LUTAbsoluteMapping( experiment.getNumOfInputs(), experiment.getNumOfOutputs() + 1, BITS_PER_VARIABLE, LUT_INPUTS, delayModel );
SimulatorFaultyCircuit circuit = new SimulatorFaultyCircuit( circuitMapping );
SimulatorDeployment deployment = new SimulatorDeployment( circuit );
// FLEXDeployment deployment = new FLEXDeployment( vFileName, path2Prog, path2MaxPlus, wrkDir, BITS_PER_VARIABLE, STABILIZERS, GATE_INPUTS, experiment.getNumOfInputs(), experiment.getNumOfOutputs(), PORT_ADD );
// A - Genetic Operators Set up
/* For CNAND
int genotypeLength = GATE_INPUTS * STABILIZERS * ( ( 1 << BITS_PER_VARIABLE ) - experiment.getNumOfInputs() ) * ( BITS_PER_VARIABLE + 1 );
*/
int genotypeLength = ( ( 1 << BITS_PER_VARIABLE ) - experiment.getNumOfInputs() ) * ( ( 1 << LUT_INPUTS ) + LUT_INPUTS * BITS_PER_VARIABLE );
int testPatLength = ( 1 << experiment.getNumOfInputs() ) * 2;
int tpGenLength = testPatLength * experiment.getNumOfInputs();
final Genotype SEED0 = new FullOrderGenotype( genotypeLength ); // SF8 from log
Genotype[] SEEDS = new Genotype[ POP_SIZE ];
for( int pl = 0; pl < POP_SIZE; pl++ )
{
SEEDS[ pl ] = ( FullOrderGenotype ) SEED0.clone();
for( int bl = 0; bl < SEEDS[ pl ].length(); bl++ )
{
if( Math.random() < 0.5 )
{
SEEDS[ pl ].set( bl );
}
}
}
//final Genotype SEED0 = new Genotype( "01000001000110011000000001110110001010011000011111011100100100001110110001111101110100011110011111000111101111111010010101101000010011011100010110000101100110000000011101010000000011011000111111011001000011101111110111000001100100001100011100000100000001000001111101111110111010110111010110000010100100000001001110001101000110011101001100111110110010000101111011101010010110100011101001011111" );
// final Genotype SEED1 = new Genotype( "6WS_iRZCj6Y8ELA2eO6ZJ8eMnPDTCdlHHtQFdj95jMhqg7bcFi9PGfu86JVoIpWkQjmvWSX6S[shXWjEjlRQiieI9QV95HvQD6iK\\EHNY\\RKa\\hB5^aF\\3OL9cl3r7r07rdbpQJkrOYaivRCqCK5IWPFM4USapH2mi3_RR2BX[5i^cCfnLZRR]N5t94Ms0iiLfmLuh72feoUuHWV6CHTh[0etY9[[Iv9KTBf`iZZojZteMsirncWvonRShJ0", genotypeLength, 6 );
// final Genotype SEED2 = new Genotype( "2GS_i17CiQY8ELA2eO6ZJ8eMnPDTC_jrLtUVdjDG8EEQS\\beNi9PKfu87Jjc3jRiaIqH[ALYJsE11WIqSMRIgj04oBe09jKAhLiLaMVU_08qdSQaImCtgaB4cc[3r3raARcfpAJli0jWiJ0kq4Nk0WPF64USqpH2gi3bBKu2]SRe`cCfknjBqEMKTO7Iu5ru1_THNb72V3n6rWD824uaHW0etY9[[Iv9KTBf`gtYM_AhAq6hNldYCEAdb1i0", genotypeLength, 6 );
// final Genotype[] SEEDS = { SEED0, SEED1, SEED2 };
// final Genotype[] SEEDS = { SEED0, SEED1 };
//final Genotype[] SEEDS = { SEED0 };
// final Genotype[] SEEDS = { };
// final Genotype SEEDTP0 = new Genotype( "GTJqc5eJgQMpdsQijj^llE^Elf[ov_E2`Vj2rIqt[OpfXsGc4n8U`ZS6UXN1p09D", tpGenLength, 6 );
// final Genotype SEEDTP1 = new Genotype( "UrFEZ7_gVE9iEslS0dMJ51eg3jq4cDF3ume6b5iTQuS[8cVo9blDXNncTLs[VTG^", tpGenLength, 6 );
// final Genotype[] TP_SEEDS = { SEEDTP0, SEEDTP1 };
final Genotype[] TP_SEEDS = { };
// BitMutator bm = new BitMutator( BIT_MUTATION_PROB );
//GeneticOperator m = new ExactGenotypeMutator( GENOTYPE_MUT );
GeneticOperator m = new SAGAMutator( 1, 10 );
//GeneticOperator m = new LockingExactGenotypeMutator( GENOTYPE_MUT, 1000 );
//GeneticOperator m = new AdaptiveMutator( 1, genotypeLength / 5 );
// GeneticOperator tpm = new AdaptiveMutator( 1, tpGenLength / 5 );
GeneticOperator tpm = new ExactGenotypeMutator( GENOTYPE_MUT );
// GeneticOperator ws = new WireSwapper( BITS_PER_VARIABLE, STABILIZERS );
GeneticOperator spxo = new SinglePointXOver();
GeneticOperator tpspxo = new SinglePointXOver();
// Standard
GeneticOperator[] geneticOps = { m, spxo };
GeneticOperator[] tpGeneticOps = { tpm, tpspxo };
double[] opsProbs = { MUTATION_PROB, XOVER_PROB };
double[] tpOpsProbs = { TP_MUTATION_PROB, TP_XOVER_PROB };
///
/* 1+1
GeneticOperator[] geneticOps = { m };
GeneticOperator[] tpGeneticOps = { tpm };
double[] opsProbs = { MUTATION_PROB };
double[] tpOpsProbs = { TP_MUTATION_PROB };
//*/
// Selector selector = new FitnessProportionateSelector();
Selector selector = new RankSelector( );
// Selector tpSelector = new FitnessProportionateSelector();
// Selector tpSelector = new RankSelector( TP_RANK_PROBS );
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 };
//SingleFaultModel faultModel = new SingleStaticFaultModel( fPos );
//InteractionModel interactionModel = new StandardInteractionModel( evolver, deployment, experiment );
PopulationLogReader.fullOrderGenotypes = true;
int eSize = 9;
boolean od = true;
InteractionModel bistIm= new BISTPIM( evolver, deployment, circuit, experiment, faultModel, eSize, od );
int[] np = { 2 };
int nrevals = 1;
InteractionModel noisyIm = new NoisyPIM( bistIm, deployment, experiment, np, nrevals );
InteractionModel interactionModel = new CircuitParsimonyPIM( noisyIm, circuit );
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 );
monica.setName( dirName );
taskQ.add( monica );
taskQNames.add( dirName );
ControlLib.writeGNUPlotScript( dirName, logDir, logFileName, 3, false );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -