📄 tsp_u1.h
字号:
//---------------------------------------------------------------------------
#ifndef tsp_u1H
#define tsp_u1H
//---------------------------------------------------------------------------
#include <vcl\Classes.hpp>
#include <vcl\Controls.hpp>
#include <vcl\StdCtrls.hpp>
#include <vcl\Forms.hpp>
#include <vcl\ExtCtrls.hpp>
#include <vcl\Dialogs.hpp>
#include <vcl\ComCtrls.hpp>
#include "Unit_about.h"
#include "titlebar.h"
//---------------------------------------------------------------------------
/*------------------------------------------------------------------
Main class TSPApplet
citynum - integer number of city (min=2 ,max=300 ,def=10 );
waynum - integer number of net points (min=2 ,max=600 ,def=30 );
itmax - integer, max number of iteration (min=10,max=6000,def=1500);
para - double parameter a of calculation (min=0.,max=1.,def=0.2 );
parb - double parameter b of calculation (min=0.,max=10.,def=2. );
park - double parameter k of calculation (min=0.,max=1.,def=.2 );
parke - double, parameter of conditions to stop calculation (min=0.2,max=4. ,def=1. );
-----------------------------------------------------------------*/
class TSP {
public:
double **delta;
static int x=0, y=1;
double **city, **way, **phiArr, *city_norm;
double para, parb, park, park_st, pare, parke;
int citynum, waynum, itmax;
bool loaded;
AnsiString file_loaded;
int * optimal_solution, *best_solution;
double optimal_length, best_length;
TSP(int cnum, int wnum, int max, double a, double b,double k, double ke);
~TSP();
void newpoint();
void newcity();
double phi(double d);
double fcity(int ip, int id);
void ini_before_iteration();
void iteration();
void load_city_map(AnsiString pf, AnsiString tf);
double dist_max();
void draw_result();
};
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Go_Button;
TBevel *Bevel3;
TButton *Button1;
TCheckBox *CheckBox_Step;
TEdit *Edit_tick;
TCheckBox *CheckBox_random;
TEdit *Edit_seed;
TEdit *Edit_central;
TEdit *Edit_radius;
TLabel *Label8;
TLabel *Label9;
TGroupBox *GroupBox1;
TEdit *Edit1_NofC;
TEdit *Edit2_NofN;
TEdit *Edit3_imax;
TEdit *Edit4_a;
TEdit *Edit5_b;
TEdit *Edit6_k;
TEdit *Edit7_ke;
TLabel *Label10;
TLabel *Label11;
TLabel *Label12;
TLabel *Label13;
TLabel *Label14;
TLabel *Label15;
TLabel *Label16;
TButton *Button_load;
TOpenDialog *OpenDialog1;
TStatusBar *StatusBar1;
TEdit *Edit_error;
TLabel *Label1;
TImage *Image1;
TTitleBar *TitleBar1;
TButton *Button_write;
void __fastcall Go_ButtonClick(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button_loadClick(TObject *Sender);
void __fastcall Image1Click(TObject *Sender);
void __fastcall FormPaint(TObject *Sender);
void __fastcall write_result(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
TSP * tsp;
bool tsp_started;
FILE * output_file;
};
//---------------------------------------------------------------------------
extern TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -