예제 #1
0
        public MainWindow()
        {
            InitializeComponent();
            this.Title = "MultiCanvasDemo";

            #region Engine setup
            insilico.bShowAnimations = true;        // Enable node-physics and smooth display transitions
            insilico.Start();                       // Start the background thread (for animations and physics)

            insilico.bEnableSimulatedData = true;  // <------------------ Enable/Disable simulated data here
            #endregion

            #region Display Objects

            EEG eeg1 = new EEG(100);
            eeg1.TargetCanvas = RedCanvas;
            eeg1.Layout = Layouts.Spartan;
            insilico.displays.Add(eeg1);
            eeg1.max = 7;
            eeg1.min = 0;
            eeg1.Activate();

            EEG eeg0 = new EEG(30);
            eeg0.TargetCanvas = BlueCanvas;
            eeg0.Layout = Layouts.Spartan;
            insilico.displays.Add(eeg0);
            eeg0.max = 10;
            eeg0.min = 0;
            eeg0.Activate();

            Graph graph = new Graph();
            graph.TargetCanvas = BlackCanvas;
            graph.DefaultVertexStyleTemplate = Styles.Green_VertexStyle;
            graph.DefaultEdgeStyleTemplate = Styles.GreenGlass_EdgeStyle;
            graph.DefaultVertexStyleTemplate.vertexColor = Cached.BrushLimeGreen;
            graph.DefaultVertexStyleTemplate.vertexOpacity = 0.7;
            insilico.displays.Add(graph);
            graph.Activate();

            EEG eeg3 = new EEG(30);
            eeg3.TargetCanvas = GreenCanvas;
            eeg3.Layout = Layouts.Spartan;
            insilico.displays.Add(eeg3);
            eeg3.max = 10;
            eeg3.min = 0;
            eeg3.Activate();

            EEG eeg4 = new EEG(30);
            eeg4.TargetCanvas = YellowCanvas;
            eeg4.Layout = Layouts.Spartan;
            insilico.displays.Add(eeg4);
            eeg4.max = 10;
            eeg4.min = 0;
            eeg4.Activate();

            #endregion
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();
            this.Title = "EvolutionDemo (Nucleo)";

            #region Engine setup
            insilico.bShowAnimations = true;        // Enable node-physics and smooth display transitions
            insilico.Start();                       // Start the background thread (for animations and physics)

            insilico.bEnableSimulatedData = false;  // <------------------ Enable/Disable simulated data here
            #endregion

            #region Display Objects (LinePlots, Histograms, VitalIndicators, EEGs, Networks, etc)
            EEG eeg = new EEG(30);
            insilico.displays.Add(eeg);
            eeg.TargetCanvas = MyCanvas;
            eeg.Height = 300;
            eeg.Width = 800;
            eeg.yo = 90;
            eeg.xo = 125;
            eeg.max = 40;
            eeg.min = 0;
            eeg.Activate();
            #endregion

            #region Set up evolutionary optimizer
            EvolutionarySimulation evo = new EvolutionarySimulation() {
                reqGenerations = 10000,
                initialPopCount = 100,
                indFitCutoff = 0.5,
                popFitCutoff = 0.5,
                geneCount = 3,
                FitnessTest = SolveSystemOf_3Equations,
                acceptedDistance = 0.01,
                bJournalingEnabled = true,
                endCondition = SimEndCondition.StopOnFirstSolution,
                mutationRegime = MutationRegime.LinearDecrease,
                bCheckMeanPopDiv = false
            };
            #endregion

            #region Set up data source (feed from the evolutionary optimizer)
            DataSource myDataSource = new DataSource();
            myDataSource.simulation = evo;
            myDataSource.eeg = eeg;
            myDataSource.canvasWidth = 450.0f;
            myDataSource.canvasHeight = 1033.0f;
            myDataSource.Start();
            evo.StartSim();
            #endregion
        }
예제 #3
0
        public MainWindow()
        {
            InitializeComponent();
            this.Title = "InsilicoDemo";
            canvas.Background = Cached.DarkestBrown;
            #region Engine setup
            int tier = RenderCapability.Tier >> 16;
            // RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;

            // Example graph
            //Graph myGraph = new Graph();
            //GraphLayout myLayout = new GraphLayout();
            //myGraph.DefaultVertexStyleTemplate = Styles.Green_VertexStyle;
            //myGraph.DefaultEdgeStyleTemplate = Styles.GreenGlass_EdgeStyle;

            //insilico.displays.Add(myGraph);
            //myGraph.drawEdgeArrows = false;
            //Cached.graph = insilico.graph;

            //insilico.graph = myGraph;
            //Cached.graph = myGraph;

            insilico.canvas = canvas;
            insilico.bShowAnimations = true;
            //insilico.layout = myLayout;
            insilico.bPrintEdgeNode = false;
            insilico.bSizeVertexToText = true;
            insilico.bShowObjectCoordinates = false;
            insilico.bShowAnimations = true;
            insilico.bCompressLeaves = false;
            insilico.bShowEdges = true;

            insilico.bEnableSimulatedData = true; // <------------------ Enable/Disable simulated data here
            insilico.Start();
            #endregion

            #region Displays

            Graph graph = new Graph();
            graph.TargetCanvas = canvas;
            graph.DefaultVertexStyleTemplate = Styles.Green_VertexStyle;
            graph.DefaultEdgeStyleTemplate = Styles.GreenGlass_EdgeStyle;
            graph.DefaultVertexStyleTemplate.vertexColor = Cached.BrushLimeGreen;
            graph.DefaultVertexStyleTemplate.vertexOpacity = 0.7;
            insilico.displays.Add(graph);
            graph.Height = 400;
            graph.Width = 250;
            graph.yo = 300;
            graph.xo = 650;
            graph.Activate();

            VitalIndicator vital0 = new VitalIndicator();
            insilico.displays.Add(vital0);
            vital0.TargetCanvas = canvas;
            vital0.Height = 400;
            vital0.Width = 20;
            vital0.yo = 300;
            vital0.xo = 50;
            //vital0.elementColor = Cached.BrushRed;
            vital0.Activate();

            VitalIndicator vital1 = new VitalIndicator();
            insilico.displays.Add(vital1);
            vital1.TargetCanvas = canvas;
            vital1.Height = 400;
            vital1.Width = 20;
            vital1.yo = 300;
            vital1.xo = 110;
            vital1.Layout = Layouts.DefaultLayout;
            vital1.Activate();

            VitalIndicator vital2 = new VitalIndicator();
            insilico.displays.Add(vital2);
            vital2.TargetCanvas = canvas;
            vital2.Height = 400;
            vital2.Width = 20;
            vital2.yo = 300;
            vital2.xo = 170;
            vital2.Activate();

            LinePlot lp1 = new LinePlot(10);
            insilico.displays.Add(lp1);
            lp1.TargetCanvas = canvas;
            lp1.Height = 200;
            lp1.Width = 300;
            lp1.yo = 50;
            lp1.xo = 50;
            lp1.Activate();

            LinePlot lp2 = new LinePlot(10);
            lp2.Layout = Layouts.LinePlotBlue;
            insilico.displays.Add(lp2);
            lp2.TargetCanvas = canvas;
            lp2.Height = 200;
            lp2.Width = 600;
            lp2.yo = 50;
            lp2.xo = 750;
            lp2.Activate();

            Histogram h3 = new Histogram(25);
            h3.TargetCanvas = canvas;
            h3.Height = 200;
            h3.Width = 300;
            h3.xo = 400;
            h3.yo = 50;
            insilico.displays.Add(h3);
            h3.Activate();

            EEG e0 = new EEG(15);
            e0.TargetCanvas = canvas;
            e0.Height = 400;
            e0.Width = 350;
            e0.xo = 250;
            e0.yo = 300;
            insilico.displays.Add(e0);
            e0.stepCount = 15;
            e0.Layout.bShowPoints = false;
            e0.min = -1;
            e0.Activate();

            EEG e1 = new EEG(100);
            e1.TargetCanvas = canvas;
            e1.Height = 400;
            e1.Width = 400;
            e1.xo = 950;
            e1.yo = 300;
            insilico.displays.Add(e1);
            e1.Layout.bShowPoints = false;
            e1.stepCount = 400;
            e1.min = -1;
            e1.handle = "test";
            e1.Activate();

            EEG e2 = new EEG(100);
            e2.TargetCanvas = canvas;
            e2.Height = 150;
            e2.Width = 1300;
            e2.xo = 50;
            e2.yo = 750;
            insilico.displays.Add(e2);
            e2.Layout.bShowPoints = false;
            e2.Layout.lineColor = Cached.BrushRed;
            e2.stepCount = 400;
            e2.min = -1;
            e2.Activate();

            #endregion

            #region Graph Test
            /*
            Vertex v0 = new Vertex();
            v0.label = "Neuron_49586F";
            Vertex v1 = new Vertex();
            v1.label = "Subsystem-9";
            Vertex v2 = new Vertex();
            v2.label = "Output_Signal";

            v0.type = 5;
            v1.type = 6;
            v2.type = 7;

            v0.attachedDisplay = h0;
            //v1.attachedDisplay = lp1;
            //v2.attachedDisplay = lp0;

            myGraph.Add(v0);
            myGraph.Add(v1);
            myGraph.Add(v2);
            myGraph.Root = v0;
            myGraph.CreateUnidirectionalEdge(v0, v1, insilico.DefaultEdgeStyleTemplate);
            myGraph.CreateUnidirectionalEdge(v1, v2, insilico.DefaultEdgeStyleTemplate);

            //insilico.GenerateLabels();
            //insilico.Compute_RadialExpansionLayout(insilico.graph, 0, 0, (float)canvas.ActualWidth, (float)canvas.ActualHeight);
            //insilico.RequestCompute();

            v0.coordinates = Engine.ToWPFCoords(new Point(rand.Next(-50, 50), rand.Next(-50, 50)), 1100, 800);
            v1.coordinates = Engine.ToWPFCoords(new Point(rand.Next(-50, 50), rand.Next(-50, 50)), 1100, 800);
            v2.coordinates = Engine.ToWPFCoords(new Point(rand.Next(-50, 50), rand.Next(-50, 50)), 1100, 800);
            */
            #endregion

            // Simulated data source to feed the various display objects in the rendering engine
            /*
            SimulatedData myDataSource = new SimulatedData();
            myDataSource.canvasWidth = 1100.0f;
            myDataSource.canvasHeight = 800.0f;
            //myDataSource.graph = myGraph;
            myDataSource.Start();
             * */
        }