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

📄 auto.h

📁 使用改进的遗传算法实现简单的高校排课
💻 H
字号:
//---------------------------------------------------------------------------

#ifndef autoH
#define autoH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ADODB.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <Grids.hpp>
#define maxpop 100
struct pp
{
      int chrom[100];
      int fitness;
      int parent1, parent2, xsite;
} *oldpop,*newpop,*p1;

 const unsigned long maxshort=65536L;
         const unsigned long multiplier=1194211693L;
         const unsigned long adder=12345L;
         unsigned long randSeed=time(0);
//---------------------------------------------------------------------------
class TAutoForm : public TForm
{
__published:	// IDE-managed Components
        TButton *Button1;
        TDataSource *DataSource1;
        TADOTable *ADOTable1;
        TADOQuery *ADOQuery1;
        TLabel *Label1;
        TListBox *ListBox1;
        TComboBox *ComboBox1;
        TDBGrid *DBGrid1;
        TEdit *Edit1;
        TEdit *Edit2;
        TLabel *Label2;
        TLabel *Label3;
        TEdit *Edit3;
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall ComboBox1Change(TObject *Sender);
        void __fastcall ListBox1Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
         int grade;
         __fastcall TAutoForm(TComponent* Owner);
         void __fastcall TAutoForm::initpop();
         __fastcall TAutoForm::objfunc(int *a);
         void __fastcall TAutoForm::statics(struct pp* pop);
         void __fastcall TAutoForm::generation();
         __fastcall TAutoForm::select();
         void __fastcall TAutoForm::crossover(int *a,int *b,int k5);
         void __fastcall TAutoForm::randomize1();
         __fastcall TAutoForm::random1();
         __fastcall TAutoForm::flip(float probability);
         __fastcall TAutoForm::length(int *a);
         __fastcall TAutoForm::order(int *b,int l);
         void __fastcall TAutoForm::check(int *a);
         void __fastcall TAutoForm::initialize();
         void __fastcall TAutoForm::pause();
         unsigned int popsize,lchrom,gen,maxgen,nmutation,ncross,jcross,maxpp,minpp,jrand;
         float pcross,pmutation,rj[maxpop],oldrand[maxpop];
         float sumfitness,avg,max,min;
         int chromize[10]; //课元组
         int priority[10];//优先级组
         __fastcall TAutoForm::Random(unsigned long n);
};
//---------------------------------------------------------------------------
extern PACKAGE TAutoForm *AutoForm;
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

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