⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit_main.h

📁 针对TSP问题
💻 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 "unit2.h"
#include "titlebar.h"
#include "Digits.hpp"
//---------------------------------------------------------------------------
class cities {
public:
  // use different arrays to sotre tao and visibility to gain
  // a little bit speed up and flexibility (as for ATSP)
    double **tao,
           **visibility,
           **city;	// coordinates of cities
    int nofc, 		// number of cities
        nofa;		// number of ants
    int **ants, **allowed;
    int * optimal_solution, * best_solution;
    int cycle_count_when_best_found;
    double optimal_length, best_length;
    double alpha, beta, evaporation, Q, tolerance; // parameters
    double * prob;
//  public:
    double * lengths;
    int best_ant;
    bool loaded;
    AnsiString file_loaded;

    cities(int nc, int na, double pa, double pb, double pe, double pq, double pt);
    ~cities();
    void change_p(double pa, double pb, double pe, double pq, double pt);
    void generate_city_map();
    void load_city_map(AnsiString pf, AnsiString tf);
    void ini_visibility_and_tao();
    bool one_cycle();
    void paint_result();
};

class TASForm : public TForm
{
__published:	// IDE-managed Components
	TButton *Button_go;
	TButton *Button_step;
	TGroupBox *GroupBox1;
	TEdit *Edit_cities;
	TEdit *Edit_ants;
	TEdit *Edit_alpha;
	TEdit *Edit_beta;
	TEdit *Edit_eva;
	TEdit *Edit_Q;
	TEdit *Edit_tolerance;
	TLabel *Label1;
	TLabel *Label2;
	TLabel *Label3;
	TLabel *Label4;
	TLabel *Label5;
	TLabel *Label6;
	TLabel *Label7;
	TBevel *Bevel1;
	TEdit *Edit_steps;
	TLabel *Label8;
	TStatusBar *StatusBar;
	TCheckBox *CheckBox_random;
	TEdit *Edit_seed;
	TLabel *Label9;
	TCheckBox *CheckBox_bestlength;
	TOpenDialog *OpenDialog1;
	TButton *Button_load;
	TImage *Image1;
	TTitleBar *TitleBar1;
	TButton *Button_write;
	TDigits *Digits1;
	TLabel *Label10;
	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;
    unsigned int step_count, steps_to_run;
    FILE * output_file;
};
//---------------------------------------------------------------------------
extern TASForm *ASForm;
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -