コード例 #1
0
ファイル: SkyscraperSimulation.cs プロジェクト: kylc/seve
        static void Main(string[] args)
        {
            var webSerializer = new JSONWebSerializer();
            var clientBroadcaster = new ClientBroadcaster(webSerializer);

            var constructor = new SkyscraperBinarySerializer(VertexCount, Max);

            var crossFunction = new RandomCrossFunction();
            var mutateFunction = new ConstantMutateFunction(MutatePercent);

            var algorithm = new Algorithm(PopulationSize, constructor, crossFunction, mutateFunction);
            var simulation = new SerialSimulation(algorithm, state =>
            {
                var data = webSerializer.Serialize(state);
                clientBroadcaster.Broadcast(data);
            });

            clientBroadcaster.StartServer();
            simulation.RunSimulation();
        }
コード例 #2
0
ファイル: SerialSimulation.cs プロジェクト: kylc/seve
 public SerialSimulation(Algorithm algorithm, Action<SimulationState> stateCallback)
 {
     Algorithm = algorithm;
     StateCallback = stateCallback;
 }