예제 #1
0
파일: ocr.go 프로젝트: NioTeX/neat
func main() {
	flag.Parse()
	//defer profile.Start(profile.CPUProfile).Stop()

	if *Phased {
		fmt.Println("Using phased mutator")
	} else {
		fmt.Println("Using complexifying-only mutator")
	}
	fmt.Println("Each trial will run for a maximum of", *Duration, "minutes.")

	if err := trials.Run(func(i int) (*neat.Experiment, error) {
		eval := &Evaluator{stopTime: time.Now().Add(time.Minute * time.Duration(*Duration))}
		var ctx *starter.Context
		if *Phased {
			ctx = starter.NewContext(eval, func(ctx *starter.Context) {
				ctx.SetMutator(mutator.NewComplete(ctx, ctx, ctx, ctx, ctx, ctx))
			})
		} else {
			ctx = starter.NewContext(eval)
		}
		if exp, err := starter.NewExperiment(ctx, ctx, i); err != nil {
			return nil, err
		} else {
			return exp, nil
		}

	}); err != nil {
		log.Fatal("Could not run OCR: ", err)
	}
}
예제 #2
0
파일: run.go 프로젝트: NioTeX/neat
func main() {
	flag.Parse()
	//defer profile.Start(profile.CPUProfile).Stop()
	if *Novelty {
		fmt.Println("Using Novelty search")
	} else {
		fmt.Println("Using Fitness search")
	}
	if *RealTime {
		fmt.Println("Using Real-Time generator")
	} else {
		fmt.Println("Using Classic generator")
	}
	fmt.Println("Using", *Steps, "time steps per evaluation")
	fmt.Println("Loading maze file:", *MazeFile)
	var err error
	orig := Evaluator{}
	if orig.Environment, err = loadEnv(*MazeFile); err != nil {
		log.Fatalf("Could not load maze file %s: %v", *MazeFile, err)
	}

	if err = trials.Run(func(i int) (*neat.Experiment, error) {

		var ctx *starter.Context
		var eval neat.Evaluator
		var gen neat.Generator
		if *RealTime {
			eval = &RTEvaluator{Evaluator: Evaluator{Environment: orig.clone()}}
			gen = &generator.RealTime{RealTimeSettings: ctx}
		} else {
			eval = &Evaluator{Environment: orig.clone()}
			gen = &generator.Classic{ClassicSettings: ctx}
		}
		if *Novelty {
			ctx = starter.NewContext(eval, func(ctx *starter.Context) {
				ctx.SetGenerator(gen)
				ctx.SetSearcher(&searcher.Novelty{NoveltySettings: ctx, Searcher: &searcher.Concurrent{}})
			})
		} else {
			ctx = starter.NewContext(eval, func(ctx *starter.Context) {
				ctx.SetGenerator(gen)
			})
		}

		if exp, err := starter.NewExperiment(ctx, ctx, i); err != nil {
			return nil, err
		} else {
			//ctx.Settings.ArchivePath = path.Join(ctx.Settings.ArchivePath, "fit")
			//ctx.Settings.ArchiveName = ctx.Settings.ArchiveName + "-fit"
			//ctx.Settings.WebPath = path.Join(ctx.Settings.WebPath, "fit")
			return exp, nil
		}
	}); err != nil {
		log.Fatal("Could not run maze experiment: ", err)
	}
}
예제 #3
0
파일: neat.go 프로젝트: NioTeX/neat
func neatContext() *starter.Context {
	cfg := initSettings()
	cfg.ExperimentName = "NEAT"
	cfg.ArchivePath = "./proof-out/neat"
	cfg.ArchiveName = "neat"
	cfg.WebPath = cfg.ArchivePath

	ctx := starter.NewContext(&NEATEval{})
	ctx.Settings = cfg
	return ctx
}
예제 #4
0
파일: flappy.go 프로젝트: NioTeX/neat
func main() {
	flag.Parse()
	//defer profile.Start(profile.CPUProfile).Stop()
	if err := trials.Run(func(i int) (*neat.Experiment, error) {
		ctx := starter.NewContext(&Evaluator{})
		if exp, err := starter.NewExperiment(ctx, ctx, i); err != nil {
			return nil, err
		} else {
			return exp, nil
		}

	}); err != nil {
		log.Fatal("Could not run XOR: ", err)
	}

}
예제 #5
0
파일: phased.go 프로젝트: NioTeX/neat
func phasedContext() *starter.Context {
	cfg := initSettings()
	cfg.ExperimentName = "Phased"
	cfg.ArchivePath = "./proof-out/phased"
	cfg.ArchiveName = "phased"
	cfg.WebPath = cfg.ArchivePath
	cfg.PruningPhaseThreshold = 10
	cfg.MaxMPCAge = 5
	cfg.MaxImprovementAge = 5
	cfg.ImprovementType = neat.Absolute
	cfg.DelNodeProbability = 0.015
	cfg.DelConnProbability = 0.025

	ctx := starter.NewContext(&NEATEval{})
	ctx.Settings = cfg
	return ctx
}
예제 #6
0
파일: hyperneat.go 프로젝트: NioTeX/neat
func hyperneatContext() *starter.Context {
	cfg := initSettings()
	cfg.ExperimentName = "HyperNEAT"
	cfg.ArchivePath = "./proof-out/hyperneat"
	cfg.ArchiveName = "hyperneat"
	cfg.WebPath = cfg.ArchivePath
	cfg.MutateActivationProbability = 0.25
	cfg.OutputActivation = neat.Tanh
	cfg.NumInputs = 4
	cfg.NumOutputs = 2

	ctx := starter.NewContext(&NEATEval{}, func(ctx *starter.Context) {
		ctx.SetMutator(mutator.NewComplete(ctx, ctx, ctx, ctx, ctx, ctx))
		ctx.SetDecoder(&decoder.HyperNEAT{CppnDecoder: decoder.Classic{}, HyperNEATSettings: hyperneatSettings(ctx)})
	})
	ctx.Settings = cfg
	return ctx
}