Beispiel #1
0
        private void batchAddButton_Click(object sender, EventArgs e)
        {
            if (architectureTextBox.Text.Trim() == "" || processTextBox.Text.Trim() == "" || learningTextBox.Text.Trim() == "" || newStimuliPackFileDictionary.Count < 1)
            {
                MessageBox.Show("Set the simulation files.");
            }
            else if (!RegularExpression.PositiveIntCheck(repeatTextBox.Text))
            {
                MessageBox.Show("Repeat has to be a positive integer.\nIf you do not want repeat, insert 1.");
            }
            else
            {
                List <BatchData> newBatchDataList = new List <BatchData>();
                for (int repeatIndex = 0; repeatIndex < int.Parse(repeatTextBox.Text); repeatIndex++)
                {
                    BatchData newBatchData = new BatchData();

                    newBatchData.Name                      = batchName;
                    newBatchData.ArchitectureFile          = architectureTextBox.Text;
                    newBatchData.ProcessFile               = processTextBox.Text;
                    newBatchData.LearningSetupFile         = learningTextBox.Text;
                    newBatchData.StimuliPackFileDictionary = newStimuliPackFileDictionary;

                    Simulator newSimulator = new Simulator(random);
                    newSimulator.Architecture_Load(architectureTextBox.Text);
                    newSimulator.Process_Load(processTextBox.Text);
                    foreach (string key in newBatchData.StimuliPackFileDictionary.Keys)
                    {
                        newSimulator.StimuliImport(key, newBatchData.StimuliPackFileDictionary[key]);
                    }
                    newBatchData.Simulator         = newSimulator;
                    newBatchData.LearningSetupList = LearningSetup_Load(learningTextBox.Text);
                    newBatchDataList.Add(newBatchData);
                }
                VariableApply(newBatchDataList);

                newStimuliPackFileDictionary = new Dictionary <string, string>();
                architectureTextBox.Text     = "";
                processTextBox.Text          = "";
                learningTextBox.Text         = "";
                repeatTextBox.Text           = "1";

                StimuliPackList_Refresh();
                BatchDataList_Refresh();
            }
        }
Beispiel #2
0
        private void structureLoadButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Architecture XML File(*.ACTXML)|*.ACTXML";
            openFileDialog.Multiselect      = false;
            openFileDialog.InitialDirectory = Application.StartupPath;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (MessageBox.Show("Current layer and bundle information will be deleted.", "Caution", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    simulator.Architecture_Load(openFileDialog.FileName);

                    layerSetupGroupBox.Enabled  = true;
                    bundleSetupGroupBox.Enabled = true;

                    Refresh();
                }
            }
        }
Beispiel #3
0
        private void batchAddButton_Click(object sender, EventArgs e)
        {
            if (architectureTextBox.Text.Trim() == "" || processTextBox.Text.Trim() == "" || learningTextBox.Text.Trim() == "" || newStimuliPackFileDictionary.Count < 1)
            {
                MessageBox.Show("Set the simulation files.");
            }
            else if (!RegularExpression.PositiveIntCheck(repeatTextBox.Text))
            {
                MessageBox.Show("Repeat has to be a positive integer.\nIf you do not want repeat, insert 1.");
            }
            else
            {
                List<BatchData> newBatchDataList = new List<BatchData>();
                for (int repeatIndex = 0; repeatIndex < int.Parse(repeatTextBox.Text); repeatIndex++)
                {
                    BatchData newBatchData = new BatchData();

                    newBatchData.Name = batchName;
                    newBatchData.ArchitectureFile = architectureTextBox.Text;
                    newBatchData.ProcessFile = processTextBox.Text;
                    newBatchData.LearningSetupFile = learningTextBox.Text;
                    newBatchData.StimuliPackFileDictionary = newStimuliPackFileDictionary;

                    Simulator newSimulator = new Simulator(random);
                    newSimulator.Architecture_Load(architectureTextBox.Text);
                    newSimulator.Process_Load(processTextBox.Text);
                    foreach (string key in newBatchData.StimuliPackFileDictionary.Keys) newSimulator.StimuliImport(key, newBatchData.StimuliPackFileDictionary[key]);
                    newBatchData.Simulator = newSimulator;
                    newBatchData.LearningSetupList = LearningSetup_Load(learningTextBox.Text);
                    newBatchDataList.Add(newBatchData);
                }
                VariableApply(newBatchDataList);

                newStimuliPackFileDictionary = new Dictionary<string, string>();
                architectureTextBox.Text = "";
                processTextBox.Text = "";
                learningTextBox.Text = "";
                repeatTextBox.Text = "1";

                StimuliPackList_Refresh();
                BatchDataList_Refresh();
            }
        }
Beispiel #4
0
        private void VariableApply(List<BatchData> batchDataList)
        {
            int totalVariousSize = 1;
            foreach (Variable variable in variableList) totalVariousSize *= variable.VariousSize;

            List<List<Change>> changeListList = new List<List<Change>>();
            for (int index = 0; index < totalVariousSize; index++)
            {
                List<Change> newChangeList = new List<Change>();
                changeListList.Add(newChangeList);
            }

            for (int variableIndex = 0; variableIndex < variableList.Count; variableIndex++)
            {
                for (int index = 0; index < totalVariousSize; index += variableList[variableIndex].VariousSize)
                {
                    int subIndex = 0;
                    for (decimal point = (decimal)variableList[variableIndex].StartPoint; point <= (decimal)variableList[variableIndex].EndPoint; point += (decimal)variableList[variableIndex].Step)
                    {
                        Change newChange = new Change();
                        newChange.LayerConnectionName = variableList[variableIndex].LayerConnectionName;
                        newChange.ProcessName = variableList[variableIndex].ProcessName;
                        newChange.VariableType = variableList[variableIndex].VariableType;
                        newChange.Point = (double)point;

                        changeListList[index + subIndex].Add(newChange);
                        subIndex++;
                    }
                }
            }

            List<BatchData> variableBatchData = new List<BatchData>();
            foreach (BatchData batchData in batchDataList)
            {
                for (int index = 0; index < changeListList.Count; index++)
                {
                    BatchData newBatchData = new BatchData();

                    newBatchData.Name = batchName;
                    newBatchData.ArchitectureFile = batchData.ArchitectureFile;
                    newBatchData.ProcessFile = batchData.ProcessFile;
                    newBatchData.LearningSetupFile = batchData.LearningSetupFile;
                    foreach (string key in batchData.StimuliPackFileDictionary.Keys) newBatchData.StimuliPackFileDictionary[key] = batchData.StimuliPackFileDictionary[key];

                    Simulator newBatchSimulator = new Simulator(random);
                    newBatchSimulator.Architecture_Load(newBatchData.ArchitectureFile);
                    newBatchSimulator.Process_Load(newBatchData.ProcessFile);
                    foreach (string key in newBatchData.StimuliPackFileDictionary.Keys) newBatchSimulator.StimuliImport(key, newBatchData.StimuliPackFileDictionary[key]);
                    newBatchData.Simulator = newBatchSimulator;
                    newBatchData.LearningSetupList = LearningSetup_Load(newBatchData.LearningSetupFile);
                    newBatchData.ChangeList = changeListList[index];

                    variableBatchData.Add(newBatchData);
                }
            }

            foreach (BatchData batchData in variableBatchData)
            {
                foreach (Change change in batchData.ChangeList)
                {
                    switch (change.VariableType)
                    {
                        case VariableType.Layer_Unit:
                            List<string> renewalConnectionKeyList = new List<string>();
                            foreach (string key in batchData.Simulator.ConnectionDictionary.Keys)
                            {
                                if (batchData.Simulator.ConnectionDictionary[key].SendLayer.Name == change.LayerConnectionName || batchData.Simulator.ConnectionDictionary[key].ReceiveLayer.Name == change.LayerConnectionName) renewalConnectionKeyList.Add(key);
                            }
                            batchData.Simulator.LayerMaking(change.LayerConnectionName, (int)change.Point, batchData.Simulator.LayerDictionary[change.LayerConnectionName].CleanupUnitCount);
                            foreach (string key in renewalConnectionKeyList)
                            {
                                batchData.Simulator.ConnectionMaking(key, batchData.Simulator.ConnectionDictionary[key].SendLayer.Name, batchData.Simulator.ConnectionDictionary[key].ReceiveLayer.Name);
                            }
                            break;
                        case VariableType.Layer_DamagedSD:
                            if (change.Point != 0) batchData.Simulator.ProcessDictionary[change.ProcessName].LayerStateDictionary[change.LayerConnectionName] = LayerState.Damaged;
                            else batchData.Simulator.ProcessDictionary[change.ProcessName].LayerStateDictionary[change.LayerConnectionName] = LayerState.On;
                            batchData.Simulator.ProcessDictionary[change.ProcessName].LayerDamagedSDDictionary[change.LayerConnectionName] = change.Point;
                            break;
                        case VariableType.Connection_DamagedSD:
                            if (change.Point != 0) batchData.Simulator.ProcessDictionary[change.ProcessName].ConnectionStateDictionary[change.LayerConnectionName] = ConnectionState.Damaged;
                            else batchData.Simulator.ProcessDictionary[change.ProcessName].ConnectionStateDictionary[change.LayerConnectionName] = ConnectionState.On;
                            batchData.Simulator.ProcessDictionary[change.ProcessName].ConnectionDamagedSDDictionary[change.LayerConnectionName] = change.Point;
                            break;
                        case VariableType.LearningRate:
                            batchData.Simulator.LearningRate = change.Point;
                            break;
                        case VariableType.InitialWeight:
                            batchData.Simulator.WeightRange = change.Point;
                            break;
                    }
                }
                batchData.Simulator.SimulatorRenewal();
            }

            this.batchDataList.AddRange(variableBatchData);
        }
Beispiel #5
0
        private void VariableApply(List <BatchData> batchDataList)
        {
            int totalVariousSize = 1;

            foreach (Variable variable in variableList)
            {
                totalVariousSize *= variable.VariousSize;
            }

            List <List <Change> > changeListList = new List <List <Change> >();

            for (int index = 0; index < totalVariousSize; index++)
            {
                List <Change> newChangeList = new List <Change>();
                changeListList.Add(newChangeList);
            }

            for (int variableIndex = 0; variableIndex < variableList.Count; variableIndex++)
            {
                for (int index = 0; index < totalVariousSize; index += variableList[variableIndex].VariousSize)
                {
                    int subIndex = 0;
                    for (decimal point = (decimal)variableList[variableIndex].StartPoint; point <= (decimal)variableList[variableIndex].EndPoint; point += (decimal)variableList[variableIndex].Step)
                    {
                        Change newChange = new Change();
                        newChange.LayerConnectionName = variableList[variableIndex].LayerConnectionName;
                        newChange.ProcessName         = variableList[variableIndex].ProcessName;
                        newChange.VariableType        = variableList[variableIndex].VariableType;
                        newChange.Point = (double)point;

                        changeListList[index + subIndex].Add(newChange);
                        subIndex++;
                    }
                }
            }


            List <BatchData> variableBatchData = new List <BatchData>();

            foreach (BatchData batchData in batchDataList)
            {
                for (int index = 0; index < changeListList.Count; index++)
                {
                    BatchData newBatchData = new BatchData();

                    newBatchData.Name              = batchName;
                    newBatchData.ArchitectureFile  = batchData.ArchitectureFile;
                    newBatchData.ProcessFile       = batchData.ProcessFile;
                    newBatchData.LearningSetupFile = batchData.LearningSetupFile;
                    foreach (string key in batchData.StimuliPackFileDictionary.Keys)
                    {
                        newBatchData.StimuliPackFileDictionary[key] = batchData.StimuliPackFileDictionary[key];
                    }

                    Simulator newBatchSimulator = new Simulator(random);
                    newBatchSimulator.Architecture_Load(newBatchData.ArchitectureFile);
                    newBatchSimulator.Process_Load(newBatchData.ProcessFile);
                    foreach (string key in newBatchData.StimuliPackFileDictionary.Keys)
                    {
                        newBatchSimulator.StimuliImport(key, newBatchData.StimuliPackFileDictionary[key]);
                    }
                    newBatchData.Simulator         = newBatchSimulator;
                    newBatchData.LearningSetupList = LearningSetup_Load(newBatchData.LearningSetupFile);
                    newBatchData.ChangeList        = changeListList[index];

                    variableBatchData.Add(newBatchData);
                }
            }

            foreach (BatchData batchData in variableBatchData)
            {
                foreach (Change change in batchData.ChangeList)
                {
                    switch (change.VariableType)
                    {
                    case VariableType.Layer_Unit:
                        List <string> renewalConnectionKeyList = new List <string>();
                        foreach (string key in batchData.Simulator.ConnectionDictionary.Keys)
                        {
                            if (batchData.Simulator.ConnectionDictionary[key].SendLayer.Name == change.LayerConnectionName || batchData.Simulator.ConnectionDictionary[key].ReceiveLayer.Name == change.LayerConnectionName)
                            {
                                renewalConnectionKeyList.Add(key);
                            }
                        }
                        batchData.Simulator.LayerMaking(change.LayerConnectionName, (int)change.Point, batchData.Simulator.LayerDictionary[change.LayerConnectionName].CleanupUnitCount);
                        foreach (string key in renewalConnectionKeyList)
                        {
                            batchData.Simulator.ConnectionMaking(key, batchData.Simulator.ConnectionDictionary[key].SendLayer.Name, batchData.Simulator.ConnectionDictionary[key].ReceiveLayer.Name);
                        }
                        break;

                    case VariableType.Layer_DamagedSD:
                        if (change.Point != 0)
                        {
                            batchData.Simulator.ProcessDictionary[change.ProcessName].LayerStateDictionary[change.LayerConnectionName] = LayerState.Damaged;
                        }
                        else
                        {
                            batchData.Simulator.ProcessDictionary[change.ProcessName].LayerStateDictionary[change.LayerConnectionName] = LayerState.On;
                        }
                        batchData.Simulator.ProcessDictionary[change.ProcessName].LayerDamagedSDDictionary[change.LayerConnectionName] = change.Point;
                        break;

                    case VariableType.Connection_DamagedSD:
                        if (change.Point != 0)
                        {
                            batchData.Simulator.ProcessDictionary[change.ProcessName].ConnectionStateDictionary[change.LayerConnectionName] = ConnectionState.Damaged;
                        }
                        else
                        {
                            batchData.Simulator.ProcessDictionary[change.ProcessName].ConnectionStateDictionary[change.LayerConnectionName] = ConnectionState.On;
                        }
                        batchData.Simulator.ProcessDictionary[change.ProcessName].ConnectionDamagedSDDictionary[change.LayerConnectionName] = change.Point;
                        break;

                    case VariableType.LearningRate:
                        batchData.Simulator.LearningRate = change.Point;
                        break;

                    case VariableType.InitialWeight:
                        batchData.Simulator.WeightRange = change.Point;
                        break;
                    }
                }
                batchData.Simulator.SimulatorRenewal();
            }

            this.batchDataList.AddRange(variableBatchData);
        }