本文整理汇总了C#中Simulator.Process_Load方法的典型用法代码示例。如果您正苦于以下问题:C# Simulator.Process_Load方法的具体用法?C# Simulator.Process_Load怎么用?C# Simulator.Process_Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulator
的用法示例。
在下文中一共展示了Simulator.Process_Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: batchAddButton_Click
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();
}
}
示例2: VariableApply
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);
}