Click here to Skip to main content
15,881,380 members
Articles / Programming Languages / C++

Aristotle Problem Solver

Rate me:
Please Sign up or sign in to vote.
4.73/5 (18 votes)
18 Feb 2009CPOL16 min read 40.1K   1.6K   30  
A program that implements the Simplex method to solve Linear Programming problems.
#pragma once

#include "Enter_data.h"

/////////////////////////////////////////////////////////////////
// Huo Problem Solver
// version 1.0
// (c) Copyright 2006
// Developed and Programmed by Spiros I. Kakos (Huo)
//
// This program is based on the Simplex method.
//
// ��������� ��� ������ simplex ��� ������������ ����
// ������� 150-162 ��� ������� "���������� �������� - ����
// �������������� ��������� ���� �������� ��� �����������"
// (�������� 4.4) ��� ������� ���������, �������� ���������,
// �����, 2000.
/////////////////////////////////////////////////////////////////

namespace Huo_Problem_solver {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace System::IO;

	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

		// ����� ����������� ��� ���������
		// 0 = New problem (��� ������� ����� �����������)
		// 1 = Production mixture (���������� ������� 135-136)
		// 2 = Transportation programming (���������� ������� 173-174)
		static int Problem_type;

		///////////////////////////////////////////////////
		// ���������� ��� ������� ����� ����������
		///////////////////////////////////////////////////

		// ���������� ��� ���������� ����� 2 (Transportation programming)
		static int Factories_number;
		static int Warehouses_number;

		// ������� ���������� (variables number)
		static int vn;
		// ������� ����������� (constraints number)
		static int cn;

		// ArrayList ��� �������� ���� ����������� ��� ���������� �����
		// ������������ (�� ����������� ��������� ��� �� ����� ������ ���
		// �����������, �� ����� ������������ ������ �� ���� ��� ArrayList)
		static ArrayList^ Syntelestes_constraints = gcnew ArrayList();
		// ArrayList ��� �������� ���� ����������� ��� ��������������
		// ���������� ���� ������������
		static ArrayList^ Syntelestes_main_function = gcnew ArrayList();

		// �������� ��� ������� ���� �������� ��� ��������� ��� �����������
		static Enter_data^ EnterData = gcnew Enter_data();

		// ���������� ��� ���������������� ����� �������� for
		static int i;
		static int j;

		// ������� ��� ���������� (���������� ����� �������� for)
		static double number_readed;

		// ������� � ��� � ������ ����;
		static bool Solution_found;

		// ������ �����
		static int os;
		// ������ ������
		static int og;
		// ���� ��� ������� ��� ������
		static double kentro;

		// ���������� ��� ������ ��� �����������
		// ������� �������
		static int lines;
		// ������� ������
		static int columns;

		// �������� �������� ���� ���������� ��� �������� ���
		// �������������� ���������� (���������� ���� �������
		// ��� ������ ������) (�������� ������ ������)
		static double kost;

		// ���������� ��� ����������� ��� debugging
		// ����� ������� ��� ���������� (����������) ��� ����������
		static int Algorithm_pass;
		// ����� ������� ��� ���-�������� ��� ����������
		static int Algorithm_subpass;

		// ������ �������� ������ (���� �� �������� ��� ������)
		static double keks;

		// �������� �������� ������
		static double keks_min;

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}

	private: System::Windows::Forms::MenuStrip^  menuStrip1;
	private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  newProblemToolStripMenuItem;
	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
	private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
	private: System::Windows::Forms::Button^  button_Solve_problem;
	private: System::Windows::Forms::TextBox^  textBox_No_variables;
	private: System::Windows::Forms::Label^  label_No_variables;
	private: System::Windows::Forms::Label^  label_No_constraints;
	private: System::Windows::Forms::TextBox^  textBox_No_constraints;
	private: System::Windows::Forms::Button^  button_Enter_main_function;
	private: System::Windows::Forms::RichTextBox^  richTextBox_Solution;
	private: System::Windows::Forms::Label^  label_Solution;
	private: System::Windows::Forms::Button^  button_Enter_constraints;
	private: System::Windows::Forms::ToolStripMenuItem^  standardProblemsToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  productionToolStripMenuItem;
	private: System::Windows::Forms::Label^  label_Explanation1;
	private: System::Windows::Forms::Label^  label_Explanation2;
	private: System::Windows::Forms::ToolStripMenuItem^  transportationProgrammingToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  helpToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  howToToolStripMenuItem;
	private: System::Windows::Forms::ToolStripMenuItem^  aboutToolStripMenuItem;
	private: System::Windows::Forms::TextBox^  textBox_Secret_1;
	private: System::Windows::Forms::TextBox^  textBox_Secret_2;
	private: System::Windows::Forms::Label^  label_Secret_1;
	private: System::Windows::Forms::Label^  label_Secret_2;
	private: System::Windows::Forms::Button^  button_Secret_ok;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma 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>
		void InitializeComponent(void)
		{
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->newProblemToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
			this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->standardProblemsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->productionToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->transportationProgrammingToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->howToToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->button_Solve_problem = (gcnew System::Windows::Forms::Button());
			this->textBox_No_variables = (gcnew System::Windows::Forms::TextBox());
			this->label_No_variables = (gcnew System::Windows::Forms::Label());
			this->label_No_constraints = (gcnew System::Windows::Forms::Label());
			this->textBox_No_constraints = (gcnew System::Windows::Forms::TextBox());
			this->button_Enter_main_function = (gcnew System::Windows::Forms::Button());
			this->richTextBox_Solution = (gcnew System::Windows::Forms::RichTextBox());
			this->label_Solution = (gcnew System::Windows::Forms::Label());
			this->button_Enter_constraints = (gcnew System::Windows::Forms::Button());
			this->label_Explanation1 = (gcnew System::Windows::Forms::Label());
			this->label_Explanation2 = (gcnew System::Windows::Forms::Label());
			this->textBox_Secret_1 = (gcnew System::Windows::Forms::TextBox());
			this->textBox_Secret_2 = (gcnew System::Windows::Forms::TextBox());
			this->label_Secret_1 = (gcnew System::Windows::Forms::Label());
			this->label_Secret_2 = (gcnew System::Windows::Forms::Label());
			this->button_Secret_ok = (gcnew System::Windows::Forms::Button());
			this->menuStrip1->SuspendLayout();
			this->SuspendLayout();
			// 
			// menuStrip1
			// 
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem, 
				this->standardProblemsToolStripMenuItem, this->helpToolStripMenuItem});
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
			this->menuStrip1->Name = L"menuStrip1";
			this->menuStrip1->Size = System::Drawing::Size(854, 26);
			this->menuStrip1->TabIndex = 0;
			this->menuStrip1->Text = L"menuStrip1";
			// 
			// fileToolStripMenuItem
			// 
			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->newProblemToolStripMenuItem, 
				this->toolStripSeparator1, this->exitToolStripMenuItem});
			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
			this->fileToolStripMenuItem->Size = System::Drawing::Size(40, 22);
			this->fileToolStripMenuItem->Text = L"File";
			// 
			// newProblemToolStripMenuItem
			// 
			this->newProblemToolStripMenuItem->Name = L"newProblemToolStripMenuItem";
			this->newProblemToolStripMenuItem->Size = System::Drawing::Size(161, 22);
			this->newProblemToolStripMenuItem->Text = L"New problem";
			this->newProblemToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::newProblemToolStripMenuItem_Click);
			// 
			// toolStripSeparator1
			// 
			this->toolStripSeparator1->Name = L"toolStripSeparator1";
			this->toolStripSeparator1->Size = System::Drawing::Size(158, 6);
			// 
			// exitToolStripMenuItem
			// 
			this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
			this->exitToolStripMenuItem->Size = System::Drawing::Size(161, 22);
			this->exitToolStripMenuItem->Text = L"Exit...";
			this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
			// 
			// standardProblemsToolStripMenuItem
			// 
			this->standardProblemsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->productionToolStripMenuItem, 
				this->transportationProgrammingToolStripMenuItem});
			this->standardProblemsToolStripMenuItem->Name = L"standardProblemsToolStripMenuItem";
			this->standardProblemsToolStripMenuItem->Size = System::Drawing::Size(142, 22);
			this->standardProblemsToolStripMenuItem->Text = L"Standard problems";
			// 
			// productionToolStripMenuItem
			// 
			this->productionToolStripMenuItem->Name = L"productionToolStripMenuItem";
			this->productionToolStripMenuItem->Size = System::Drawing::Size(262, 22);
			this->productionToolStripMenuItem->Text = L"Production mixture";
			this->productionToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::productionToolStripMenuItem_Click);
			// 
			// transportationProgrammingToolStripMenuItem
			// 
			this->transportationProgrammingToolStripMenuItem->Name = L"transportationProgrammingToolStripMenuItem";
			this->transportationProgrammingToolStripMenuItem->Size = System::Drawing::Size(262, 22);
			this->transportationProgrammingToolStripMenuItem->Text = L"Transportation programming";
			this->transportationProgrammingToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::transportationProgrammingToolStripMenuItem_Click);
			// 
			// helpToolStripMenuItem
			// 
			this->helpToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->howToToolStripMenuItem, 
				this->aboutToolStripMenuItem});
			this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";
			this->helpToolStripMenuItem->Size = System::Drawing::Size(48, 22);
			this->helpToolStripMenuItem->Text = L"Help";
			// 
			// howToToolStripMenuItem
			// 
			this->howToToolStripMenuItem->Name = L"howToToolStripMenuItem";
			this->howToToolStripMenuItem->Size = System::Drawing::Size(152, 22);
			this->howToToolStripMenuItem->Text = L"How to...";
			this->howToToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::howToToolStripMenuItem_Click);
			// 
			// aboutToolStripMenuItem
			// 
			this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
			this->aboutToolStripMenuItem->Size = System::Drawing::Size(152, 22);
			this->aboutToolStripMenuItem->Text = L"About...";
			this->aboutToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::aboutToolStripMenuItem_Click);
			// 
			// button_Solve_problem
			// 
			this->button_Solve_problem->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->button_Solve_problem->Location = System::Drawing::Point(390, 241);
			this->button_Solve_problem->Name = L"button_Solve_problem";
			this->button_Solve_problem->Size = System::Drawing::Size(75, 23);
			this->button_Solve_problem->TabIndex = 1;
			this->button_Solve_problem->Text = L"SOLVE";
			this->button_Solve_problem->UseVisualStyleBackColor = true;
			this->button_Solve_problem->Click += gcnew System::EventHandler(this, &Form1::button_Solve_problem_Click);
			// 
			// textBox_No_variables
			// 
			this->textBox_No_variables->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->textBox_No_variables->Location = System::Drawing::Point(374, 69);
			this->textBox_No_variables->Name = L"textBox_No_variables";
			this->textBox_No_variables->ReadOnly = true;
			this->textBox_No_variables->Size = System::Drawing::Size(116, 22);
			this->textBox_No_variables->TabIndex = 2;
			this->textBox_No_variables->TextChanged += gcnew System::EventHandler(this, &Form1::textBox_No_variables_TextChanged);
			// 
			// label_No_variables
			// 
			this->label_No_variables->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->label_No_variables->AutoSize = true;
			this->label_No_variables->Location = System::Drawing::Point(217, 72);
			this->label_No_variables->Name = L"label_No_variables";
			this->label_No_variables->Size = System::Drawing::Size(139, 17);
			this->label_No_variables->TabIndex = 3;
			this->label_No_variables->Text = L"Number of variables:";
			// 
			// label_No_constraints
			// 
			this->label_No_constraints->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->label_No_constraints->AutoSize = true;
			this->label_No_constraints->Location = System::Drawing::Point(217, 106);
			this->label_No_constraints->Name = L"label_No_constraints";
			this->label_No_constraints->Size = System::Drawing::Size(151, 17);
			this->label_No_constraints->TabIndex = 4;
			this->label_No_constraints->Text = L"Number of constraints:";
			// 
			// textBox_No_constraints
			// 
			this->textBox_No_constraints->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->textBox_No_constraints->Location = System::Drawing::Point(374, 103);
			this->textBox_No_constraints->Name = L"textBox_No_constraints";
			this->textBox_No_constraints->ReadOnly = true;
			this->textBox_No_constraints->Size = System::Drawing::Size(117, 22);
			this->textBox_No_constraints->TabIndex = 5;
			this->textBox_No_constraints->TextChanged += gcnew System::EventHandler(this, &Form1::textBox_No_constraints_TextChanged);
			// 
			// button_Enter_main_function
			// 
			this->button_Enter_main_function->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->button_Enter_main_function->Location = System::Drawing::Point(292, 178);
			this->button_Enter_main_function->Name = L"button_Enter_main_function";
			this->button_Enter_main_function->Size = System::Drawing::Size(271, 23);
			this->button_Enter_main_function->TabIndex = 6;
			this->button_Enter_main_function->Text = L"Enter function to maximize / minimize";
			this->button_Enter_main_function->UseVisualStyleBackColor = true;
			this->button_Enter_main_function->Click += gcnew System::EventHandler(this, &Form1::button_Enter_main_function_Click);
			// 
			// richTextBox_Solution
			// 
			this->richTextBox_Solution->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->richTextBox_Solution->Location = System::Drawing::Point(174, 310);
			this->richTextBox_Solution->Name = L"richTextBox_Solution";
			this->richTextBox_Solution->Size = System::Drawing::Size(506, 370);
			this->richTextBox_Solution->TabIndex = 7;
			this->richTextBox_Solution->Text = L"";
			// 
			// label_Solution
			// 
			this->label_Solution->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->label_Solution->AutoSize = true;
			this->label_Solution->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(161)));
			this->label_Solution->Location = System::Drawing::Point(171, 290);
			this->label_Solution->Name = L"label_Solution";
			this->label_Solution->Size = System::Drawing::Size(67, 17);
			this->label_Solution->TabIndex = 8;
			this->label_Solution->Text = L"Solution";
			// 
			// button_Enter_constraints
			// 
			this->button_Enter_constraints->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->button_Enter_constraints->Location = System::Drawing::Point(352, 149);
			this->button_Enter_constraints->Name = L"button_Enter_constraints";
			this->button_Enter_constraints->Size = System::Drawing::Size(159, 23);
			this->button_Enter_constraints->TabIndex = 9;
			this->button_Enter_constraints->Text = L"Enter constraints";
			this->button_Enter_constraints->UseVisualStyleBackColor = true;
			this->button_Enter_constraints->Click += gcnew System::EventHandler(this, &Form1::button_Enter_constraints_Click);
			// 
			// label_Explanation1
			// 
			this->label_Explanation1->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->label_Explanation1->AutoSize = true;
			this->label_Explanation1->Location = System::Drawing::Point(503, 72);
			this->label_Explanation1->Name = L"label_Explanation1";
			this->label_Explanation1->Size = System::Drawing::Size(117, 17);
			this->label_Explanation1->TabIndex = 10;
			this->label_Explanation1->Text = L"(no explanations)";
			// 
			// label_Explanation2
			// 
			this->label_Explanation2->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->label_Explanation2->AutoSize = true;
			this->label_Explanation2->Location = System::Drawing::Point(503, 106);
			this->label_Explanation2->Name = L"label_Explanation2";
			this->label_Explanation2->Size = System::Drawing::Size(117, 17);
			this->label_Explanation2->TabIndex = 11;
			this->label_Explanation2->Text = L"(no explanations)";
			// 
			// textBox_Secret_1
			// 
			this->textBox_Secret_1->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->textBox_Secret_1->Location = System::Drawing::Point(55, 92);
			this->textBox_Secret_1->Name = L"textBox_Secret_1";
			this->textBox_Secret_1->Size = System::Drawing::Size(100, 22);
			this->textBox_Secret_1->TabIndex = 12;
			this->textBox_Secret_1->Visible = false;
			this->textBox_Secret_1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox_Secret_1_TextChanged);
			// 
			// textBox_Secret_2
			// 
			this->textBox_Secret_2->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->textBox_Secret_2->Location = System::Drawing::Point(55, 154);
			this->textBox_Secret_2->Name = L"textBox_Secret_2";
			this->textBox_Secret_2->Size = System::Drawing::Size(100, 22);
			this->textBox_Secret_2->TabIndex = 13;
			this->textBox_Secret_2->Visible = false;
			this->textBox_Secret_2->TextChanged += gcnew System::EventHandler(this, &Form1::textBox_Secret_2_TextChanged);
			// 
			// label_Secret_1
			// 
			this->label_Secret_1->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->label_Secret_1->AutoSize = true;
			this->label_Secret_1->Location = System::Drawing::Point(52, 72);
			this->label_Secret_1->Name = L"label_Secret_1";
			this->label_Secret_1->Size = System::Drawing::Size(46, 17);
			this->label_Secret_1->TabIndex = 14;
			this->label_Secret_1->Text = L"label1";
			this->label_Secret_1->Visible = false;
			// 
			// label_Secret_2
			// 
			this->label_Secret_2->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->label_Secret_2->AutoSize = true;
			this->label_Secret_2->Location = System::Drawing::Point(52, 134);
			this->label_Secret_2->Name = L"label_Secret_2";
			this->label_Secret_2->Size = System::Drawing::Size(46, 17);
			this->label_Secret_2->TabIndex = 15;
			this->label_Secret_2->Text = L"label2";
			this->label_Secret_2->Visible = false;
			// 
			// button_Secret_ok
			// 
			this->button_Secret_ok->Anchor = System::Windows::Forms::AnchorStyles::Top;
			this->button_Secret_ok->Enabled = false;
			this->button_Secret_ok->Location = System::Drawing::Point(67, 202);
			this->button_Secret_ok->Name = L"button_Secret_ok";
			this->button_Secret_ok->Size = System::Drawing::Size(75, 37);
			this->button_Secret_ok->TabIndex = 16;
			this->button_Secret_ok->Text = L"OK";
			this->button_Secret_ok->UseVisualStyleBackColor = true;
			this->button_Secret_ok->Visible = false;
			this->button_Secret_ok->Click += gcnew System::EventHandler(this, &Form1::button_Secret_ok_Click);
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(854, 729);
			this->Controls->Add(this->button_Secret_ok);
			this->Controls->Add(this->label_Secret_2);
			this->Controls->Add(this->label_Secret_1);
			this->Controls->Add(this->textBox_Secret_2);
			this->Controls->Add(this->textBox_Secret_1);
			this->Controls->Add(this->label_Explanation2);
			this->Controls->Add(this->label_Explanation1);
			this->Controls->Add(this->button_Enter_constraints);
			this->Controls->Add(this->label_Solution);
			this->Controls->Add(this->richTextBox_Solution);
			this->Controls->Add(this->button_Enter_main_function);
			this->Controls->Add(this->textBox_No_constraints);
			this->Controls->Add(this->label_No_constraints);
			this->Controls->Add(this->label_No_variables);
			this->Controls->Add(this->textBox_No_variables);
			this->Controls->Add(this->button_Solve_problem);
			this->Controls->Add(this->menuStrip1);
			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
			this->MainMenuStrip = this->menuStrip1;
			this->Name = L"Form1";
			this->Text = L"Aristotle Problem Solver";
			this->menuStrip1->ResumeLayout(false);
			this->menuStrip1->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion


private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 MessageBox::Show("Thank you for using this program!\n\nContact us at www.kakos.com.gr or through stasp@hol.gr for any bug reporting or suggestions.", "Exit Aristotle Problem Solver...", MessageBoxButtons::OK, MessageBoxIcon::Information);
			 Application::Exit();
		 }


private: System::Void button_Solve_problem_Click(System::Object^  sender, System::EventArgs^  e) {
			// Beginning of try-block
			try{
			// ������� ������ = ���� ��� �� ����������� ��� ��� ������ ��� �� �������� ��� ������������� ���������
			this->lines = (cn + 1);  
			// ������ ������ = ���� ��� �� ���������� ��� ��� slack variables (�� ������ ����� ���� ��� �� �����������) ��� ��� ����� ��� �� ����� ������ ��� �����������
			this->columns = (vn + cn + 1);

			// ���������� ������ �� ����� ������� ���� ��� �� ����������
			array<double, 2>^ dedomena = gcnew array<double, 2>(lines,columns);

			// �������� ��� ��������� ��� ���������� ���� Enter_data.h ���� ������ ��� �����������
			for(i=0; i<lines; i++)
			{
				 for(j=0; j<columns; j++)
				 {
					if( i < (lines - 1) )
					{
					// �� ����������� ����� ���� �������� ��� ����������� ��� �����������
					if( j < vn )
					{
						dedomena[i,j] = Double::Parse(Syntelestes_constraints[(j + i*(vn+1))]->ToString());
					}
					else	// �� ������� ���� �������� ��� slack variables
					{
						// ���� �� "��������" ���� ��� �������� ��� ������ �� ��� slack variables �������� ������
						// (��� �� ���� �������� ��� �� �����)
						if( (j - vn) == i )
							dedomena[i,j] = 1;
						else
							dedomena[i,j] = 0;
					}
					
					// �������� ��� �������� ��� ������ ������� ���� �����������
					if( j == (columns-1) )
					{
						dedomena[i,j] = Double::Parse(Syntelestes_constraints[(j - cn + i*(vn+1))]->ToString());
					}
					}
					
					// �������� ��� ����������� ��� �������������� ����������
					if( i == (lines - 1) )
					{
						if( j < vn )
						{
							// �������: ��������� ���� ����������� �� �������� ������� (����� ���� �������� ��� �������� �����)
							dedomena[i,j] = 0 - Double::Parse(Syntelestes_main_function[j]->ToString());
						    // Debuging messageBox
							// (Use it ONLY for debuging! Disable for normal program execution)
							// MessageBox::Show(String::Concat("����������� ������� ���������� (", i.ToString(), ",", j.ToString(),") = ", dedomena[i,j].ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
						}
						else
							dedomena[i,j] = 0;
					}
				 }
			}

			// Debuging block
			// (Use it ONLY for debuging! Disable for normal program execution)
			StreamWriter^ sw = gcnew StreamWriter("c:\\Huo_Problem_Solver_initial_array.txt");
			for(i=0; i<lines; i++)
			{
				 for(j=0; j<columns; j++)
				 {
					 sw->WriteLine(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()));
					 // Debuging messageBox
					 // (Use it ONLY for debuging! Disable for normal program execution)
					 // MessageBox::Show(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
				 }
			}
			sw->Close();
			// End of debuging block

			///////////////////////////////////////////////////
			// INITIATE SIMPLEX ALGORITHM
			///////////////////////////////////////////////////

			this->Algorithm_pass = 1;
			this->Algorithm_subpass = 1;

			do{

			// Have we found the optimal solution? We will check for that later.
			this->Solution_found = true;

			/////////////////////////////////////////////////////////////////////////////////
			// FIND THE COLUMN-GUID (Greek: ������ ��� ������ ������)
			// Select the incoming variable: choose the most negative number
			// in the last (lines - 1) line of the table.
			// We intially give a negative value to the number that will indicate
			// the column-guide.
			// Greek: ������� ������������ ����������: ������� ��� ��� ��������� �������
			// ���� ��������� (lines - 1) ������ ��� ������
			// ������ ������� ��� ������ ���� ���� ������ ��� �� ������ ��� ����� �����
			/////////////////////////////////////////////////////////////////////////////////
			this->kost = 0;
			for(j=0; j<columns; j++)
			{
				this->number_readed = dedomena[(lines - 1),j];
				if( this->number_readed < this->kost )
				{
					// Since we have found a negative number in the equation, the optimal solution is not yet found.
					// Greek: ���� ������� ��������� ������� ���� ������������� ���������, � ������ ���� ��� ���� ������ �����
					this->Solution_found = false;
					// Column-guide
					// Greek: ������ �����
					this->os = j;
					this->kost = this->number_readed;
				}
			}

			////////////////////////////////////////////////////////////////
			// If the solution is found, the algorithm stops
			// and the solution is displayed in the textBox
			// Greek: �� � ���� �������, ���� � ���������� ��������� ���
			// � ���� ����������� ��� ������� textBox
			////////////////////////////////////////////////////////////////
			if( this->Solution_found == true )
			{
				/////////////////////////////////////////////////////////
				// Record the solution in a text file
				// Greek: ��������� ��� ����� �� ������ text
				/////////////////////////////////////////////////////////

				this->richTextBox_Solution->Text = "SOLUTION\n";
				MessageBox::Show( "Solution found!", "Simplex algorithm finished", MessageBoxButtons::OK, MessageBoxIcon::Information );
				StreamWriter^ sw5 = gcnew StreamWriter("c:\\Huo_Problem_Solver_Solution_array.txt");
				for(i=0; i<lines; i++)
				{
					 for(j=0; j<columns; j++)
					 {
						 sw5->WriteLine(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()));
						 // Debuging messageBox
						 // (Use it ONLY for debuging! Disable for normal program execution)
						 // MessageBox::Show(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
					 }
				}
				sw5->Close();

				/////////////////////////////////////////////////////////
				// Show the results in the richtextBox
				// Greek: ���������� ��� ������������� ��� richTextbox
				/////////////////////////////////////////////////////////

				// Number of non-zero elements in a column
				// Greek: ������� ��� ��-��������� ��������� ���� ������
				int Non_zero_elements;

				// Create a table that will store the solution
				// Greek: ���������� ������ ��� �� ����������� �� ����
				array<double>^ solution_array = gcnew array<double>(vn);

				for(j=0; j<vn; j++)
				{
					Non_zero_elements = 0;
					for(i=0; i<lines; i++)
					{
						if(dedomena[i,j] != 0)
							Non_zero_elements++;
					}

					// If there is only one non-zero element, then the program checks to see where it is so as to store the solution.
					// Greek: �� ������� ���� ��� ��-�������� ��������, ���� �� ��������� ������� �� ��� ��� ���� ��������� ��� �� ���������� �� ����
					if(Non_zero_elements == 1)
					{
						for(i=0; i<lines; i++)
						{
							if(dedomena[i,j] != 0)
								solution_array[j] = (dedomena[i,(columns-1)] / dedomena[i,j]);
						}
					}
					else
						solution_array[j] = 0;
				}

				for(j=0; j<vn; j++)
				{
					switch(this->Problem_type)
					{
					case 0:
						this->richTextBox_Solution->Text = String::Concat( this->richTextBox_Solution->Text, "\n", "x", (j+1).ToString(), " = ", solution_array[j].ToString() );
						break;

					case 1:
						this->richTextBox_Solution->Text = String::Concat( this->richTextBox_Solution->Text, "\nProduce ", solution_array[j].ToString(), " units of product ", (j+1).ToString() );
						break;
					};
				}

				//////////////////////////////////////////////////
				// Additional explanations (if they exist)
				// Greek: ��������������� ����������� (�� ��������)
				//////////////////////////////////////////////////
				switch(this->Problem_type)
				{
				case 0:
					this->richTextBox_Solution->Text = String::Concat( this->richTextBox_Solution->Text, "\n", "x", (j+1).ToString(), " = ", solution_array[j].ToString() );
					break;

				case 1:
					this->richTextBox_Solution->Text = String::Concat( this->richTextBox_Solution->Text, "\n\nto maximize your profits." );
					break;
				};
			}

			if( this->Solution_found == false )
			{
			/////////////////////////////////////////////////////////
			// Find the line-guide.
			// Divide the element 1 of the column that contains the
			// right-side elements of the equations with the respective
			// element of the column-guide and find the smallest one
			// so as to find the line-guide.
			// Greek: ������ ��� ������ �������
			// �������� ��� ��������� i ��� ������ ��� �������� ��
			// ����� ����� ��� ��������� �� �� ���������� ��������
			// ��� ������ ������ ��� ������ ��� ���������� ��� ���
			// ������� ��� ������ �������
			/////////////////////////////////////////////////////////
			
			// Select an initial "exit" criterion
			// Greek: ������� ���� ������� ��������� ������
			// (note: "dedomena" stands for "data" in Greek)
			this->keks_min = dedomena[0,(columns - 1)] / dedomena[0,os];
			this->og = 0;

			for(i=0; i<(lines-1); i++)
			{
				this->keks = dedomena[i,(columns - 1)] / dedomena[i,os];
				if( this->keks < this->keks_min )
				{
					// ������ ������
					this->og = i;
					this->keks_min = this->keks;
				}
			}

			////////////////////////////////////////
			// CENTER OF THE TABLE
			// Greek: ������ ��� ������
			// (note: "kentro" stands for "center" in Greek)
			////////////////////////////////////////
			
			this->kentro = dedomena[og,os];

			// Debuging block
			// (Use it ONLY for debuging! Disable for normal program execution)
			StreamWriter^ sw1 = gcnew StreamWriter(String::Concat("c:\\Huo_Problem_Solver_array_Pass_", this->Algorithm_pass.ToString(), "_Subpass_", this->Algorithm_subpass.ToString(), ".txt"));
			sw1->WriteLine( String::Concat("Column-guide:", this->os.ToString()) );
			sw1->WriteLine( String::Concat("Row-guide:", this->og.ToString()) );
			sw1->WriteLine( String::Concat("Center value:", this->kentro.ToString()) );
			sw1->WriteLine( "" );
			for(i=0; i<lines; i++)
			{
				 for(j=0; j<columns; j++)
				 {
					 sw1->WriteLine(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()));
					 // Debuging messageBox
					 // (Use it ONLY for debuging! Disable for normal program execution)
					 // MessageBox::Show(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
				 }
			}
			sw1->Close();
			// End of debuging block

			this->Algorithm_pass++;
			this->Algorithm_subpass++;

			///////////////////////////////////////////////////////
			// Set the new elements of the table
			// Greek: ������� ��� ���� ��������� ��� ������
			///////////////////////////////////////////////////////
			
			for(i=0; i<lines; i++)
			{
				 for(j=0; j<columns; j++)
				 {
					 if( (i != og) && (j != os) )
						 dedomena[i,j] = dedomena[i,j] - ( (dedomena[og,j]*dedomena[i,os]) / kentro );
				 }
			}

			// Debuging block
			// (Use it ONLY for debuging! Disable for normal program execution)
			StreamWriter^ sw2 = gcnew StreamWriter(String::Concat("c:\\Huo_Problem_Solver_array_Pass_", this->Algorithm_pass.ToString(), "_Subpass_", this->Algorithm_subpass.ToString(), ".txt"));
			for(i=0; i<lines; i++)
			{
				 for(j=0; j<columns; j++)
				 {
					 sw2->WriteLine(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()));
					 // Debuging messageBox
					 // (Use it ONLY for debuging! Disable for normal program execution)
					 // MessageBox::Show(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
				 }
			}
			sw2->Close();
			// End of debuging block

			this->Algorithm_pass++;
			this->Algorithm_subpass++;

			///////////////////////////////////////////////////////
			// Divide all elements of the line-guide with the
			// value of the center of the table.
			// Greek: �������� ���� ��� ��������� ��� ������ ������� ��
			// ��� ���� ��� ������� ��� ������
			///////////////////////////////////////////////////////
			
			for(j=0; j<columns; j++)
			{
				dedomena[og,j] = dedomena[og,j] / kentro;
			}

			// Debuging block
			// (Use it ONLY for debuging! Disable for normal program execution)
			StreamWriter^ sw3 = gcnew StreamWriter(String::Concat("c:\\Huo_Problem_Solver_array_Pass_", this->Algorithm_pass.ToString(), "_Subpass_", this->Algorithm_subpass.ToString(), ".txt"));
			for(i=0; i<lines; i++)
			{
				 for(j=0; j<columns; j++)
				 {
					 sw3->WriteLine(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()));
					 // Debuging messageBox
					 // (Use it ONLY for debuging! Disable for normal program execution)
					 // MessageBox::Show(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
				 }
			}
			sw3->Close();
			// End of debuging block

			this->Algorithm_pass++;
			this->Algorithm_subpass++;

			///////////////////////////////////////////////////////////
			// Set all the rest of the elements to zero in the
			// column-guide (except the center which is already equal to 1).
			// Greek: ���������� ��� ��������� ��������� ��� ������ ������
			// (����� ��� ������� ��� ����� ��� ��� �� 1)
			///////////////////////////////////////////////////////////

			for(i=0; i<lines; i++)
			{
				if( i != og )
					dedomena[i,os] = 0;
			}

			// Debuging block
			// (Use it ONLY for debuging! Disable for normal program execution)
			StreamWriter^ sw4 = gcnew StreamWriter(String::Concat("c:\\Huo_Problem_Solver_array_Pass_", this->Algorithm_pass.ToString(), "_Subpass_", this->Algorithm_subpass.ToString(), ".txt"));
			for(i=0; i<lines; i++)
			{
				 for(j=0; j<columns; j++)
				 {
					 sw4->WriteLine(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()));
					 // Debuging messageBox
					 // (Use it ONLY for debuging! Disable for normal program execution)
					 // MessageBox::Show(String::Concat("dedomena[", i.ToString(), ",", j.ToString(),"] = ", dedomena[i,j].ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
				 }
			}
			sw4->Close();
			// End of debuging block

			this->Algorithm_pass++;
			this->Algorithm_subpass++;

			}

			}while( this->Solution_found == false );

			/////////////////////////////////////////
			// END OF SIMPLEX METHOD
			/////////////////////////////////////////

			} // End of try-block

			catch( Exception^ ) {
				MessageBox::Show("Program encoured a problem! This may be due to one (but not limited to) of the following reasons...\n\n1. You have not entered the constraints or the main function coefficients.\n\n2. You entered wrong data type when entering the contraints or the main function coefficients (i.e. you entered letters or special symbols instead of numbers you were supposed to enter).", "Huo Problem Solver Exception detected...", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
			}
		 }


private: System::Void textBox_No_variables_TextChanged(System::Object^  sender, System::EventArgs^  e) {
			 try{
				 vn = Int32::Parse( this->textBox_No_variables->Text );
			 }

			 catch( FormatException^ ) {
			 }
		 }


private: System::Void button_Enter_constraints_Click(System::Object^  sender, System::EventArgs^  e) {
			 if( (vn > 0) && (cn > 0) ) {
				 // �������� ���������� �� textBoxes ��� ��������� ���
				 // ������ ��� ���������� ��� ��� ����������� (��� ��
				 // ��� ������� �������� ���� ��������� ��� � �������
				 // ���������� �� ������� �������� ������ ���� ��������)
				 this->textBox_No_constraints->ReadOnly = true;
				 this->textBox_No_variables->ReadOnly = true;

				 // ���������� ���� EnterData ��� �� ����������� ����
				 // ������������ ��� ����������� (��. Enter_data.h)
				 EnterData->What_is_entered = 1;

				 // ������������ ��� EnterData
				 Update_EnterData();

				 // ������� ��� form ��� ��� �������� ��� �����������
				 EnterData->ShowDialog();

				 // �������� ��� ��������� ��� ���������� ���� Enter_data.h ���� ������ ��� �����������
				 for(i=0; i<(vn*cn + cn); i++)
				 {
					 // Debuging messageBox
					 // (Use it ONLY for debuging! Disable for normal program execution)
					 // MessageBox::Show(String::Concat("i = ", i.ToString(), ", Data transfered = ", EnterData->Data_entered[i]->ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
					 Syntelestes_constraints->Add(EnterData->Data_entered[i]);
				 }
			 }
			 else
				 MessageBox::Show( "Please enter the number of variables and the number of constraints first.", "Number of variables and/or constraints not defined", MessageBoxButtons::OK, MessageBoxIcon::Error );
		 }


private: System::Void button_Enter_main_function_Click(System::Object^  sender, System::EventArgs^  e) {
			 if( (vn > 0) && (cn > 0) ) {
				 // �������� ���������� �� textBoxes ��� ��������� ���
				 // ������ ��� ���������� ��� ��� ����������� (��� ��
				 // ��� ������� �������� ���� ��������� ��� � �������
				 // ���������� �� ������� �������� ������ ���� ��������)
				 this->textBox_No_constraints->ReadOnly = true;
				 this->textBox_No_variables->ReadOnly = true;

				 // ���������� ���� EnterData ��� �� ����������� ����
				 // ����������� ��� �������������� ���������� (��. Enter_data.h)
				 EnterData->What_is_entered = 2;

				 // ������������ ��� EnterData
				 Update_EnterData();

				 // ������� ��� form ��� ��� �������� ��� �����������
				 EnterData->ShowDialog();

				 // �������� ��� ��������� ��� ���������� ���� Enter_data.h ���� ������ ��� �����������
				 for(i=0; i<vn; i++)
				 {
					 // Debuging messageBox
					 // (Use it ONLY for debuging! Disable for normal program execution)
					 // MessageBox::Show(String::Concat("����������� ", i.ToString(), " ������� ���������� ��� ��������� = ", EnterData->Data_entered[i]->ToString()), "Huo debuging message...", MessageBoxButtons::OK, MessageBoxIcon::Information);
					 Syntelestes_main_function->Add(EnterData->Data_entered[i]);
				 }
			 }
			 else
				 MessageBox::Show( "Please enter the number of variables and the number of constraints first.", "Number of variables and/or constraints not defined", MessageBoxButtons::OK, MessageBoxIcon::Error );
		 }


// ��������� ��� ���������� ��� EnterData �� ��� ������ ����������
// ������� ��� �� ������������ ��� ������������ ��� EnterData ���
// ��� ������ ��� ��������� ��� ��������� ��� �� ������
private: System::Void Update_EnterData() {
				 // �������� ��� ����� ��� �����������
				 EnterData->Problem_type = this->Problem_type;

				 // �������� ��� ���������� ��� ����������� ���� EnterData
				 EnterData->vn = this->vn;
				 EnterData->cn = this->cn;

				 // ��������� ��� EnterData ��� ���������� �������
				 // ����� �����������

				 switch( this->Problem_type )
				 {
				 case 2:
					 EnterData->Factories_number = this->Factories_number;
					 EnterData->Warehouses_number = this->Warehouses_number;
					 break;
				 };

				 // ���������� ��� ArrayList ��� ������� �� �������� ��� ���������� ���� EnterData
				 EnterData->Data_entered->Clear();
		 }


private: System::Void textBox_No_constraints_TextChanged(System::Object^  sender, System::EventArgs^  e) {
			 try{
			 cn = Int32::Parse( this->textBox_No_constraints->Text );
			 }

			 catch( FormatException^ ) {
			 }
		 }


private: System::Void newProblemToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 // ����� ����������� = 0
			 this->Problem_type = 0;

			 New_problem_initiation();
		 }

private: System::Void New_problem_initiation() {
			 this->cn = 0;
			 this->vn = 0;

			 ///////////////////////////
			 // ������ ����������
			 ///////////////////////////

			 switch(this->Problem_type)
			 {
			 case 2:
				 this->label_Secret_1->Text = "Factories number";
				 this->label_Secret_1->Visible = true;
				 this->textBox_Secret_1->Text = "";
				 this->textBox_Secret_1->Visible = true;
				 this->label_Secret_2->Text = "Warehouses number";
				 this->label_Secret_2->Visible = true;
				 this->textBox_Secret_2->Text = "";
				 this->textBox_Secret_2->Visible = true;
				 this->button_Secret_ok->Enabled = true;
				 this->button_Secret_ok->Visible = true;
				 break;

			 default:
				 this->label_Secret_1->Text = "";
				 this->label_Secret_1->Visible = false;
				 this->textBox_Secret_1->Visible = false;
				 this->label_Secret_2->Text = "";
				 this->label_Secret_2->Visible = false;
				 this->textBox_Secret_2->Visible = false;
				 this->button_Secret_ok->Enabled = false;
				 this->button_Secret_ok->Visible = false;
				 break;
			 };

			 //////////////////////////////////////////////
			 // �������� �����������, �� ��������
			 //////////////////////////////////////////////

			 switch(this->Problem_type)
			 {
			 case 0:
				 this->label_Explanation1->Text = "(no explanations)";
 				 this->label_Explanation2->Text = "(no explanations)";
				 break;

			 case 1:
				 this->label_Explanation1->Text = "(number or products produced)";
 				 this->label_Explanation2->Text = "(number of raw materials used)";
				 break;

			 case 2:
				 this->label_Explanation1->Text = "(number factories) x (number of warehouses)";
 				 this->label_Explanation2->Text = "(number of factories) + (number of warehouses)";
				 break;
			 };

			 this->textBox_No_variables->ReadOnly = false;
			 this->textBox_No_constraints->ReadOnly = false;
			 this->textBox_No_variables->Text = "";
			 this->textBox_No_constraints->Text = "";

			 this->richTextBox_Solution->Text = "";

			 this->Syntelestes_constraints->Clear();
			 this->Syntelestes_main_function->Clear();
		 }

private: System::Void productionToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			// ����� ����������� = 1
			this->Problem_type = 1;

			New_problem_initiation();
		 }


private: System::Void transportationProgrammingToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			// ����� ����������� = 2
			this->Problem_type = 2;

			New_problem_initiation();
		 }


private: System::Void aboutToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 MessageBox::Show("Aristotle Problem Solver\n(c) Copyright 2006\n\nDeveloped and programmed by Kakos Bros Solutions\n\nThis program is based on the SIMPLEX algorithm and the Huo Problem Solver (which was also developed by Kakos Bros Solutions).\nContact us at www.kakos.com.gr or through stasp@hol.gr for any bug reporting or suggestions.", "About Aristotle Problem Solver...", MessageBoxButtons::OK, MessageBoxIcon::Information);
		 }


private: System::Void howToToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 MessageBox::Show("1. Use File -> New problem to set up a new problem to solve.\n\nNote that the program must be used for maximizing a main function. If you have a problem concerning the minimization of a function, transform it properly to a maximization goal.\nPlease also note that all contraints added must be of a {<} nature. If you have a {>} constraint, you will have to transform it properly to a {<} constraint.\n\n2. Use Standard Problems to initiate the processing of some already typed-in standardized problems with real-time help on how to enter the constraints and the main function of the problem.", "How to solve problems...", MessageBoxButtons::OK, MessageBoxIcon::Information);
		 }


private: System::Void textBox_Secret_1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
			 try{
				 this->Factories_number = Int32::Parse( this->textBox_Secret_1->Text );
			 }

			 catch( IOException^ ) {
			 }
		 }


private: System::Void textBox_Secret_2_TextChanged(System::Object^  sender, System::EventArgs^  e) {
			 try{
				 this->Warehouses_number = Int32::Parse( this->textBox_Secret_2->Text );
			 }

			 catch( IOException^ ) {
			 }
		 }


private: System::Void button_Secret_ok_Click(System::Object^  sender, System::EventArgs^  e) {
			 switch( this->Problem_type )
			 {
			 case 2:
				 if( (this->Factories_number > 0) && (this->Warehouses_number > 0) )
				 {
					 this->label_Secret_1->Text = "";
					 this->label_Secret_1->Visible = false;
					 this->textBox_Secret_1->Visible = false;
					 this->label_Secret_2->Text = "";
					 this->label_Secret_2->Visible = false;
					 this->textBox_Secret_2->Visible = false;
					 this->button_Secret_ok->Enabled = false;
					 this->button_Secret_ok->Visible = false;

					 this->vn = Factories_number * Warehouses_number;
					 this->cn = Factories_number + Warehouses_number;

					 this->textBox_No_variables->Text = (Factories_number * Warehouses_number).ToString();
					 this->textBox_No_constraints->Text = (Factories_number + Warehouses_number).ToString();
				 }
				 else
					 MessageBox::Show("Please enter the number of factories AND the number of warehouses.", "Incomplete data entry!", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
				 break;
			 };
		 }


	};
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Kakos Bros Solutions
Greece Greece
Spiros [Spyridon or Spyros are also used] Kakos (huo) lives in Athens, Greece. He is currently working as an IT consultant in a large firm. Begun programming during the Commodore era in MS Basic and is still trying to learn (mostly in C++ and C#)...
He likes chess and has recently bought a new (old) modem for one of his Commodores 128 (yes, he has two of them!) to set up a server based on 8-bit technology. He thinks that when the World Wide Web crashes completely by an alien cyber attack, he will be the only one capable of surfing with his Commodore computer and will eventually save the day...
He likes reading and writting philosophy and is a fond admirer of Aristotle and Alfred Russel Wallace. His main heritage is Harmonia Philosophica.
At his free time he is researching the application of polypyrrole (PPy) in the PCB manufacturing process (through-hole plating) at the National Technical University of Athens - Advanced Materials section.

Comments and Discussions