예제 #1
0
        // Adding variable for objective function
        private void objectiveFunctionAddButton_Click(object sender, EventArgs e)
        {
            if (ValidationMethods.IsThatDouble(objectiveFunctionCoeffTextBox.Text))
            {
                ObjectiveFunction.AddElementWithUpdateProcess(new Variable {
                    Coefficient = Convert.ToDouble(objectiveFunctionCoeffTextBox.Text), Index = ObjectiveFunction.Variables.Count
                });

                objectiveFunctionCoeffTextBox.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Please enter a number!", "Error", MessageBoxButtons.OK);
            }
        }
예제 #2
0
 // Assign Coefficient to Transient Eq.
 private void assignCoefficientButton_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(contraintsCoeffVariableTextBox.Text) && ValidationMethods.IsThatDouble(contraintsCoeffVariableTextBox.Text) && variableComboBox.SelectedItem != null)
     {
         TransientEquation.Variables[variableComboBox.SelectedIndex].Coefficient = Convert.ToDouble(contraintsCoeffVariableTextBox.Text);
         contraintsCoeffVariableTextBox.Text = string.Empty;
         variableComboBox.SelectedItem       = null;
     }
     else
     {
         if (!ValidationMethods.IsThatDouble(contraintsCoeffVariableTextBox.Text))
         {
             MessageBox.Show("Please enter a number!", "Error", MessageBoxButtons.OK);
         }
         else
         {
             MessageBox.Show("Please enter variable and its coefficient!", "Error", MessageBoxButtons.OK);
         }
     }
 }