Buggy code:
public class ComplicatedPlan2 { static int size = 17 ; public static void main ( String [ ] args ) { CommandGene [ ] commands = new CommandGene [ ComplicatedPlan2 . size ] ; int [ ] depths = new int [ ComplicatedPlan2 . size ] ; GPConfiguration gpConf = null ; try { gpConf = new GPConfiguration ( ) ; } catch ( InvalidConfigurationException e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } IGPFitnessEvaluator prismEvaluationFunction = new EvaluateFitness ( ) ; gpConf . setGPFitnessEvaluator ( prismEvaluationFunction ) ; gpConf . setMaxInitDepth ( 2 ) ; try { gpConf . setPopulationSize ( 50 ) ; } catch ( InvalidConfigurationException e ) { e . printStackTrace ( ) ; } gpConf . setCrossoverProb ( 0.9F ) ; gpConf . setReproductionProb ( 0.1F ) ; gpConf . setNewChromsPercent ( 0.3F ) ; gpConf . setStrictProgramCreation ( true ) ; gpConf . setUseProgramCache ( true ) ; gpConf . setNoCommandGeneCloning ( false ) ; try { gpConf . setFitnessFunction ( ( ( GPFitnessFunction ) ( prismEvaluationFunction ) ) ) ; } catch ( InvalidConfigurationException e ) { e . printStackTrace ( ) ; } try { commands [ 0 ] = new org . jgap . gp . function . SubProgram ( gpConf , new Class [ ] { CommandGene . VoidClass , CommandGene . VoidClass } , true ) ; depths [ 0 ] = 0 ; commands [ 1 ] = new org . jgap . gp . function . SubProgram ( gpConf , new Class [ ] { CommandGene . VoidClass , CommandGene . VoidClass } , true ) ; depths [ 1 ] = 1 ; commands [ 2 ] = new org . jgap . gp . function . SubProgram ( gpConf , new Class [ ] { CommandGene . VoidClass , CommandGene . VoidClass } , true ) ; depths [ 2 ] = 2 ; commands [ 3 ] = new org . jgap . gp . function . SubProgram ( gpConf , new Class [ ] { CommandGene . VoidClass , CommandGene . VoidClass } , true ) ; depths [ 3 ] = 3 ; commands [ 4 ] = new actions . IncreaseDatabaseAThreads ( gpConf ) ; depths [ 4 ] = 4 ; commands [ 5 ] = new actions . DeleteServerL1 ( gpConf ) ; depths [ 5 ] = 4 ; commands [ 6 ] = new actions . IfSuccessElse ( gpConf ) ; depths [ 6 ] = 3 ; commands [ 7 ] = new actions . AddServerL1 ( gpConf ) ; depths [ 7 ] = 4 ; commands [ 8 ] = new actions . IncreaseDatabaseAThreads ( gpConf ) ; depths [ 8 ] = 4 ; commands [ 9 ] = new actions . AddServerL1 ( gpConf ) ; depths [ 9 ] = 4 ; commands [ 10 ] = new org . jgap . gp . function . SubProgram ( gpConf , new Class [ ] { CommandGene . VoidClass , CommandGene . VoidClass } , true ) ; depths [ 10 ] = 2 ; commands [ 11 ] = new actions . AddServerL2 ( gpConf ) ; depths [ 11 ] = 3 ; commands [ 12 ] = new actions . DeleteServerL1 ( gpConf ) ; depths [ 12 ] = 3 ; commands [ 13 ] = new actions . IfSuccessElse ( gpConf ) ; depths [ 13 ] = 1 ; commands [ 14 ] = new actions . AddServerL1 ( gpConf ) ; depths [ 14 ] = 2 ; commands [ 15 ] = new actions . IncreaseDatabaseAThreads ( gpConf ) ; depths [ 15 ] = 2 ; commands [ 16 ] = new actions . AddServerL1 ( gpConf ) ; depths [ 16 ] = 2 ; ProgramChromosome chromosome = new ProgramChromosome ( gpConf , ComplicatedPlan2 . size ) ; chromosome . setFunctions ( commands ) ; Field depthArray = chromosome . getClass ( ) . getDeclaredField ( "m_depth" ) ; depthArray . setAccessible ( true ) ; depthArray . set ( chromosome , depths ) ; System . out . println ( ( "Created<seq2seq4repair_space>plan:<seq2seq4repair_space>" + ( chromosome . toStringNorm ( 0 ) ) ) ) ; Thread . sleep ( 500 ) ; EvaluateFitness ef = new EvaluateFitness ( ) ; Plan generatedPlan = ef . createPlan ( chromosome , 0 ) ; System . out . println ( ( "Our<seq2seq4repair_space>plan:<seq2seq4repair_space>" + ( generatedPlan . planString ( ) ) ) ) ; <START_BUG> ef . makePrismFileFromChromosome ( chromosome ) ; <END_BUG> System . out . println ( "finished<seq2seq4repair_space>generating<seq2seq4repair_space>files" ) ; ArrayList < ArrayList < CommandGene > > planList = ef . generatePossiblePlanExecutions ( chromosome ) ; for ( int i = 0 ; i < ( planList . size ( ) ) ; i ++ ) { boolean isPlanFeasible = ef . checkPlanFeasibility ( planList . get ( i ) ) ; ArrayList < CommandGene > testPlan = planList . get ( i ) ; System . out . print ( "A<seq2seq4repair_space>plan:<seq2seq4repair_space>" ) ; for ( int j = 0 ; j < ( testPlan . size ( ) ) ; j ++ ) { System . out . print ( ( ( testPlan . get ( j ) . toString ( ) ) + ",<seq2seq4repair_space>" ) ) ; } System . out . print ( "\n" ) ; if ( ! isPlanFeasible ) { System . out . println ( "Plan<seq2seq4repair_space>failed" ) ; System . exit ( 1 ) ; } } System . out . println ( "All<seq2seq4repair_space>plans<seq2seq4repair_space>succeeded" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } }

Fix:
ef . makePrismFileFromPlan ( generatedPlan , chromosome ) ;