📄 unit_main.h
字号:
//---------------------------------------------------------------------------
#ifndef Unit_MainH
#define Unit_MainH
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
#include <math.h>
#include <values.h>
#include <vcl\ExtCtrls.hpp>
#include <vcl\ComCtrls.hpp>
#include <vcl\Dialogs.hpp>
#include "unit1.h"
#include "unit3.h"
#include <vcl\MPlayer.hpp>
#include "titlebar.h"
#include "Digits.hpp"
//---------------------------------------------------------------------------
extern int no_of_cities;
class cities {
public:
double ** city,
** map;
unsigned char **old_generation,
**meta_generation;
double *fitness;
int *no_of_offspring;
int nofc,
population,
no_of_generation,
count_of_gen,
duration;
int op;
double cutoff,
average_distance,
minimum_distance,
p_of_crossover,
p_of_mutation;
int best_child;
unsigned char * optimal_solution, * best_solution;
double optimal_length, best_length, old_minimum_distance;
double * prob;
// public:
double * lengths;
int best_ant;
bool loaded;
AnsiString file_loaded;
cities(int nc, int np,
double cf, int du, double pofc, double pofm,
int m, int nofg);
~cities();
void change_p(double cf, int du, double pofc, double pofm, int nofg);
void generate_city_map();
void load_city_map(AnsiString pf, AnsiString tf);
void setup_map();
bool one_cycle();
void paint_result();
void calculate_fitness();
void initialize_population();
void generate_meta_generation();
};
class TASForm : public TForm
{
__published: // IDE-managed Components
TButton *Button_go;
TButton *Button_step;
TGroupBox *GroupBox1;
TEdit *Edit_cities;
TEdit *Edit_pop;
TLabel *Label3;
TBevel *Bevel1;
TEdit *Edit_steps;
TLabel *Label8;
TStatusBar *StatusBar;
TCheckBox *CheckBox_random;
TEdit *Edit_seed;
TLabel *Label9;
TOpenDialog *OpenDialog1;
TButton *Button_load;
TImage *Image1;
TTitleBar *TitleBar1;
TButton *Button_write;
TLabel *Label4;
TLabel *Label1;
TEdit *Edit_cutoff;
TEdit *Edit_duration;
TLabel *Label2;
TComboBox *ComboBox_op;
TLabel *Label5;
TLabel *Label6;
TEdit *Edit_pofc;
TEdit *Edit_pofm;
TDigits *Digits1;
TLabel *Label7;
void __fastcall Button_goClick(TObject *Sender);
void __fastcall Button_stepClick(TObject *Sender);
void __fastcall Button_loadClick(TObject *Sender);
void __fastcall Show_About(TObject *Sender);
void __fastcall FormPaint(TObject *Sender);
void __fastcall Change(TObject *Sender);
void __fastcall write_result(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TASForm(TComponent* Owner);
cities * AS;
bool AS_start;
FILE * output_file;
};
//---------------------------------------------------------------------------
extern TASForm *ASForm;
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -