using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Neural_Net_Test
{
/// <summary>
/// Summary description for SelfOrganizingNetworkTwoOptions.
/// </summary>
public class SelfOrganizingNetworkTwoOptions : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textInitialLearningRate;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.NumericUpDown numericNumberOfIterations;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textFinalLearningRate;
private System.Windows.Forms.NumericUpDown numericNeighborhoodSize;
private System.Windows.Forms.NumericUpDown numericNeighborhoodDecrementInterval;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private double dInitialLearningRate;
private double dFinalLearningRate;
private int nInitialNeighborhoodSize;
private int nFinalNeighborhoodSize;
private int nNeighborhoodDecrementInterval;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.NumericUpDown numericFinalNeighborhoodSize;
private int nNumberOfIterations;
private Icon icon;
public double InitialLearningRate
{
get
{
return dInitialLearningRate;
}
set
{
dInitialLearningRate = value;
}
}
public double FinalLearningRate
{
get
{
return dFinalLearningRate;
}
set
{
dFinalLearningRate = value;
}
}
public int InitialNeighborhoodSize
{
get
{
return nInitialNeighborhoodSize;
}
set
{
nInitialNeighborhoodSize = value;
}
}
public int FinalNeighborhoodSize
{
get
{
return nFinalNeighborhoodSize;
}
set
{
nFinalNeighborhoodSize = value;
}
}
public int NeighborhoodDecrementInterval
{
get
{
return nNeighborhoodDecrementInterval;
}
set
{
nNeighborhoodDecrementInterval = value;
}
}
public int NumberOfIterations
{
get
{
return nNumberOfIterations;
}
set
{
nNumberOfIterations = value;
}
}
public SelfOrganizingNetworkTwoOptions( double dInitialLearningRate, double dFinalLearningRate, int nInitialNeighborhoodSize, int nFinalNeighborhoodSize, int nNeighborhoodDecrementInterval, int nNumberOfIterations )
{
icon = new Icon( "App.ico" );
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.Icon = icon;
//
// TODO: Add any constructor code after InitializeComponent call
//
InitialLearningRate = dInitialLearningRate;
FinalLearningRate = dFinalLearningRate;
InitialNeighborhoodSize = nInitialNeighborhoodSize;
FinalNeighborhoodSize = nFinalNeighborhoodSize;
NeighborhoodDecrementInterval = nNeighborhoodDecrementInterval;
NumberOfIterations = nNumberOfIterations;
textInitialLearningRate.Text = InitialLearningRate.ToString();
textFinalLearningRate.Text = FinalLearningRate.ToString();
numericNeighborhoodSize.Value = InitialNeighborhoodSize;
numericFinalNeighborhoodSize.Value = FinalNeighborhoodSize;
numericNeighborhoodDecrementInterval.Value = NeighborhoodDecrementInterval;
numericNumberOfIterations.Value = NumberOfIterations;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SelfOrganizingNetworkTwoOptions));
this.label2 = new System.Windows.Forms.Label();
this.textInitialLearningRate = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.numericNumberOfIterations = new System.Windows.Forms.NumericUpDown();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textFinalLearningRate = new System.Windows.Forms.TextBox();
this.numericNeighborhoodSize = new System.Windows.Forms.NumericUpDown();
this.numericNeighborhoodDecrementInterval = new System.Windows.Forms.NumericUpDown();
this.label7 = new System.Windows.Forms.Label();
this.numericFinalNeighborhoodSize = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numericNumberOfIterations)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericNeighborhoodSize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericNeighborhoodDecrementInterval)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericFinalNeighborhoodSize)).BeginInit();
this.SuspendLayout();
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(120, 23);
this.label2.TabIndex = 2;
this.label2.Text = "Initial Learning Rate";
//
// textInitialLearningRate
//
this.textInitialLearningRate.Location = new System.Drawing.Point(160, 16);
this.textInitialLearningRate.Name = "textInitialLearningRate";
this.textInitialLearningRate.TabIndex = 3;
this.textInitialLearningRate.Text = "textBox1";
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(128, 23);
this.label3.TabIndex = 4;
this.label3.Text = "Final Learning Rate";
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 80);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(128, 23);
this.label4.TabIndex = 6;
this.label4.Text = "Neighborhood Size";
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 144);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(136, 23);
this.label5.TabIndex = 8;
this.label5.Text = "Neighborhood Decrement";
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 176);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(120, 23);
this.label6.TabIndex = 10;
this.label6.Text = "Number Of Iterations";
//
// numericNumberOfIterations
//
this.numericNumberOfIterations.Location = new System.Drawing.Point(160, 176);
this.numericNumberOfIterations.Maximum = new System.Decimal(new int[] {
1000,
0,
0,
0});
this.numericNumberOfIterations.Name = "numericNumberOfIterations";
this.numericNumberOfIterations.TabIndex = 11;
this.numericNumberOfIterations.Value = new System.Decimal(new int[] {
500,
0,
0,
0});
//
// button1
//
this.button1.Location = new System.Drawing.Point(40, 216);
this.button1.Name = "button1";
this.button1.TabIndex = 12;
this.button1.Text = "O.K.";
this.button1.Click += new System.EventHandler(this.OnOK);
//
// button2
//
this.button2.Location = new System.Drawing.Point(192, 216);
this.button2.Name = "button2";
this.button2.TabIndex = 13;
this.button2.Text = "Cancel";
this.button2.Click += new System.EventHandler(this.OnCancel);
//
// textFinalLearningRate
//
this.textFinalLearningRate.Location = new System.Drawing.Point(160, 48);
this.textFinalLearningRate.Name = "textFinalLearningRate";
this.textFinalLearningRate.TabIndex = 14;
this.textFinalLearningRate.Text = "textB";
//
// numericNeighborhoodSize
//
this.numericNeighborhoodSize.Location = new System.Drawing.Point(160, 80);
this.numericNeighborhoodSize.Name = "numericNeighborhoodSize";
this.numericNeighborhoodSize.TabIndex = 15;
this.numericNeighborhoodSize.Value = new System.Decimal(new int[] {
5,
0,
0,
0});
//
// numericNeighborhoodDecrementInterval
//
this.numericNeighborhoodDecrementInterval.Location = new System.Drawing.Point(160, 144);
this.numericNeighborhoodDecrementInterval.Maximum = new System.Decimal(new int[] {
2000,
0,
0,
0});
this.numericNeighborhoodDecrementInterval.Name = "numericNeighborhoodDecrementInterval";
this.numericNeighborhoodDecrementInterval.TabIndex = 16;
this.numericNeighborhoodDecrementInterval.Value = new System.Decimal(new int[] {
1000,
0,
0,
0});
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 112);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(128, 23);
this.label7.TabIndex = 17;
this.label7.Text = "Final Neighborhood Size";
//
// numericFinalNeighborhoodSize
//
this.numericFinalNeighborhoodSize.Location = new System.Drawing.Point(160, 112);
this.numericFinalNeighborhoodSize.Name = "numericFinalNeighborhoodSize";
this.numericFinalNeighborhoodSize.TabIndex = 18;
//
// SelfOrganizingNetworkTwoOptions
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(320, 262);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.numericFinalNeighborhoodSize,
this.label7,
this.numericNeighborhoodDecrementInterval,
this.numericNeighborhoodSize,
this.textFinalLearningRate,
this.textInitialLearningRate,
this.button2,
this.button1,
this.numericNumberOfIterations,
this.label6,
this.label5,
this.label4,
this.label3,
this.label2});
this.Name = "SelfOrganizingNetworkTwoOptions";
this.Text = "SelfOrganizingNetworkTwoOptions";
((System.ComponentModel.ISupportInitialize)(this.numericNumberOfIterations)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericNeighborhoodSize)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericNeighborhoodDecrementInterval)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericFinalNeighborhoodSize)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void OnOK(object sender, System.EventArgs e)
{
double dTemp = 0.0;
string strTemp = "";
try
{
strTemp = textInitialLearningRate.Text;
dTemp = Double.Parse( strTemp );
InitialLearningRate = dTemp;
strTemp = textFinalLearningRate.Text;
dTemp = Double.Parse( strTemp );
FinalLearningRate = dTemp;
NumberOfIterations = ( int )this.numericNumberOfIterations.Value;
InitialNeighborhoodSize = ( int )this.numericNeighborhoodSize.Value;
FinalNeighborhoodSize = ( int )this.numericFinalNeighborhoodSize.Value;
NeighborhoodDecrementInterval = ( int )this.numericNeighborhoodDecrementInterval.Value;
}
catch( ArgumentNullException argNullExp )
{
MessageBox.Show( "Error Argument Null Exception thrown by data entered, Please try again" + argNullExp.Message );
return;
}
catch( FormatException formExp )
{
MessageBox.Show( "Error the data has to be in double format, you entered " + strTemp + formExp.Message );
return;
}
catch( OverflowException overExp )
{
MessageBox.Show( "Error the number you entered is too large or too small " + overExp.Message );
return;
}
this.Close();
}
private void OnCancel(object sender, System.EventArgs e)
{
this.Close();
}
}
}