亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? main.c

?? 用C編寫的部落尋優的優化算法
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*************************************************************************
     TRIBES, an fully adaptive particle swarm optimiser
                             -------------------
    last update           : 2005-01-12
    email                    : Maurice.Clerc@WriteMe.com
    Home page           :  http://www.mauriceclerc.net
 ***************************************************************************/
 /*
     Have fun, and keep me posted if you do something interesting with it,
     or if you find a bug (I'm pretty sure there are some!).
 */
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

/* Recent updates
2005-01
2004-11 Specific binary strategies (and examples of binary problems).
  Some of them with a very simple "taboo" rule.
2004-07
- added a pseudo-gradient method to define the best informer
- rewritten the "remove worst particle" part. There was a minor bug.
  The algo is so robust that most of the time it was not important.
  But sometimes it did ... So, globally, performances are now a bit better.

- added link_reorg. Not very convincing, though.

- you can now use discrete variables whose values can't be simply
   computed by using min, max and granularity. The acceptable values are read
   on the file discrete.txt
*/

/* TO DO

- adding something so that you can cope with more complicated search spaces
   (not only hyperparallelepids) WORK STILL IN PROGRESS.
   The perfect way, for a (semi) continuous search space would be by homeomorphism.
   Quite difficult, though.

 */

/*
************** TRIBES: An adaptive parameter free Particle Swarm Optimiser  ******************************
This version does not really need any parameters at all, except, of course, the ones
defining the problem (file problems.txt):
- function
- dimension
- xmin,xmax, granularity (for the hyperparallepipedic search space)
- target
- admissible error
- if all components of the solution have to be different (useful for some combinatorial problems)

Granularity. If you _know_  that the solution, on some dimensions,  is on an "integer" point, or even a rational one,
you can give this information
Fo example, if for a given dimension, the solution is an integer, then you can set granularity to 1 for this dimension:
the process may be faster (example: functions 4 and 6, or 1 and 2 if S is an integer)

Also, you have to set granularity to 1 for some "combinatorial" problems like Knap-sack, Fifty-fifty or Magic Square

You can try to optimize some simple (and less simple) functions, for example:
1) find DD numbers that sum to S.
2) find DD numbers whose product is S
3) Sphere. Find DD numbers  whose sum of squares is S
4) Rosenbrock (Banana)
5) Clerc's f1 (Alpine)
6) Griewank
7) Rastrigin
8) Fifty-fifty Problem (in particular with granul=1)
9) Ackley
10) Foxholes  2D.
  etc.
(see also the file functions.txt).
--------
 TSP
There is now a Traveling Salesman Problem option (30). Not that good, but it works for small
graphs (typically <20 nodes). The best way seems to be also the simplest:
just setting granularity to 1 and activating the all_different option.
However, some features (in particular initialization and local search) are specific (see TSP.c)

Of course, you need a file describing the graph (full matrix TSPLIB format).
I also tried a continous relaxation of the problem in another version, but it does not give good results.

Note that PSO for TSP may work quite well, but only by adding some local search that are not in Tribes.
 ---------
QAP
As TSP is a particular case of QAP (Quadratic Assignment Problem), I added this option (32), which works
almost exactly like TSP.
---------
Multiobjective   (see, for example, 33 etc.)
Using Tribes for multiobjective problems is very easy, for each run gives a different solution,
thanks to the random initialization of the first swarm (usually just one particle, at the very beginning).

The trick is to be able to compare two positions, no matter one or more functions are to take into account.
This is done in better_than().

Some points:
- set accuracy to 0.
- it never really "converges", so the stop criterion is the max number of evaluations you give, Max_Eval.
- I have added a module that "cleans up" the result file (run.txt), if you want keeping only the
  non dominated  solutions (in file run_cleaned.txt).

In practice, it is better to run a lot of  times (say 500)  with a small Max_Eval (say 20),
and then to clean up  the result.


Note 1
Sometimes, you may prefer using only positive functions.
   Then just add big enough constants. See 34 (Schaffer) for example.

Note 2
Multiobjective approach is a nice way to take complicated constraints into account.
See, for example Pressure vessel example (code function 52)

--------
You can add your own function (see myfunction.c and functions.txt)

Just for fun, using the function 2 (DD-product), you can then factorize a (small!) integer number.

Note:
For test purpose (cf. file problems.txt), there _are_ some parameters, in particular:
 no_begin:
  you may choose the "best" neighbour at random, or using or not  pseudo-gradient method

 adapt:
If adapt=n, it means you want to use a swarm of constant size n


 (and the neighbourhood of each particle is the whole swarm)
For classical test functions, and with n= about 20, this version is often better
than the ones that don't use hyperspheres.

If adapt=0, it means you want to use complete adaptive method.
Not always better than the previous one, but you don't even has to "guess"
what the right swarm size is.

Strategies:
There is no reason to adopt the same strategy for a "good" particle and for a "bad" one.
  These problemeters define which one to use in which case.
Note that, though, strategy 1 is a  compromise for any case.

non_unif coefficients:
Using these coefficients, distributions in hyperspheres can be non uniform
(Gaussian, for example).
In practice, uniform distribution seems OK.

Fuzzification:
You may use fuzzy decision rules and/or fuzzy distributions.
Doesn't seems to be very useful.

----------------------------------------------

Equation
--------
For each particle, we have
.
x(t+1) = x(t) + w(x(t),x(t-1),p_i(t),p_g(t))
with
.
x(t) := position at time t
x(t-1) := position at time t-1
pi(t):= previous best position of the particle (at time t)
pg(t):= previous best position found so far in the i-group (informer group) of the particle (at time t),
        including the particle itself
w(x1,x2,x3) := a vectorial function of three positions

Unlike "classical" PS0s, there is no explicit velocity
and w is not at all depending on some more or less arbitrary "weights"
 cognitive or social coefficients (often called alpha, phi_1, phi_2).
 A promising area is defined using hyperspheres (cf. move_particle).


Download
--------
Well, you have it, havn't you ?
For more information about PSO
 http://www.mauriceclerc.net, Math stuff for PSO
And for even more information, see the Particle Swarm Central http://www.particleswarm.net

Compiling the program
-------------------
It is written in ANSI C, so you shouldn't have any problem.

Using the program
-----------------
See files problems.txt
"Problems" describe the problem(s) (function, dimension, search space etc.

*/
/* INFORMAL DESCRIPTION

Common part
-----------
At the very beginning, there are n particles {0,1,2,...,n},

n=3 (or even 1) for the complete adaptive version. So we have on the same time
- the swarm,
- a tribe T0,
- three i-groups I0, I1,I2 (informers group).
Each particle belongs to the tribe T0
For each particle, its i-group contains:
	i) the particle itself
	ii) the best particle of the tribe


At each time step each particle "moves" towards a more promising area,
using its knowledge (x,p_i,p_g).
- let H_i be the hypersphere radius=norm(p_i-p_g), center p_i
- let H_g be the hypersphere radius=norm(p_i-p_g), center p_g
- a point pp_i is randomly chosen in H_i
		(WARNING. It is not that easy, see rand_in_hypersphere)
- a point pp_g is randomly chosen in H_g
- x(t+1) is a weighted combination of pp_i and pp_g,

	according to the f values on p_i and p_g.

Note: if you don't use adaptive version, it means you have a global PSO
(the neighbourhood of each particle is the whole swarm).

Adaptive part
-------------
From time to time social adaptation is performed:
- for each tribe, one counts how many particles have improved their best performance (n)
	If n=0,the tribe is said "bad"
	if (n>=size(tribe)/2) the tribe is said "good"

- if there is at least one bad tribe, a new tribe is generated
- for each bad tribe:
	- the best particle is found and "generates" a new particle
		in the new tribe, for the moment purely at random,
	- this new particle is added to the i-group of this best particle

- for each particle of the new tribe, the i-group contains
	ii) the particle itself
	ii) the best particle of the new tribe,
	iii) the particle that has generated it (symmetry. Note that thanks to the i-group
			concept, you could build non symmetrical relationships)



- for each "good" tribe
	- the worst particle is removed (if it is bad)
	- in all i-groups it is replaced by the best one of the tribe (general case)
		or by the best particle of the i-group of the removed particle
		(mono-particle tribe case)
	- its i-group (except of course this removed particle itself) is merged to the one
		that replaces it.


Example
-------
Very beginning
T0 = {0,1,2}
i-group table
particle	i-group
	0		{0,1,2}
	1		{0,1,2}
	2		{0,1,2}
========
Adaptation 1, T0 is "bad", best particle 1.
A new tribe T1 is generated.
3 is generated by 1 in the new tribe T1

T0 = {0,1,2}
T1 = {3}

 i-group table
 --------------
	particle	i-group
		0		{0,1,2}
		1		{0,1,2,3}
		3		{1,3}
=========
Adaptation 2. T0 is good, best particle 0, worst 1, T1 is bad, best particle 3.
T2 is generated.
1 is removed (and replaced by 0 for the i-groups)
4 is generated by 0 into T2.


T0 = {0,2}
T1 = {3}
T2 = {4}
 i-group table
 --------------
	particle	i-group
		0		{0,2,3}

		2		{0,2}
		3		{0,3,4} (1 has been replaced by 0)
		4		{3,4}
==========
Adaptation 3. T0 is bad (best particle 2, worst particle 0),T1 is good, T2 is bad.
T3 is generated

0 is removed (replaced by 2 for i-groups)
6 is generated by 2 in T3
8 is generated by 4 in T3

T0 = {2,5}
T1 = {3}
T2 = {4}
T3 = {6,8}

 i-group table
 --------------
	particle	i-group
		2		{2,5,6}
		3		{3,7}
		4		{4,8}
		5		{2,5}
		6		{2,6,8}
		7		{3,7}
		8		{4,8}

etc.

 */

// DEPENDING on how you build the application you may or may not need to "include"
// the following files

 #include "def_struct.c"

 // External subroutines
 #include "movpeaks_mc.c"
 #include "read_display_save.c"
 #include "tools.c" // Some  mathematical tools like alea(), max(), min(), regranul() etc.
 #include "extra_tools.c" // Some "informative" tools, not strictly necessary, like distance(), energy() etc.
 #include "myfunction.c" // Write your own objective function in this file.
 #include "myconstrain.c"     // Write your own constrain function g(position)>=0
 #include "apple_trees.c" // For "apple trees" example

 #include "TSP.c"
 #include "QAP.c"
 #include "MINLP.c"

 #include "annxor.c"
 #include "annparity.c"
 #include "anncolorcube.c"
 #include "annpima.c"
 #include "annsinsimp.c"
 #include "annservo.c"

 //=========================================================================================
int main(int argc, char *argv[])
{
int           bidon;
int				i,j;
int            level;
float   Max_Eval;
int				nb_pb;
struct position result;
double t;

E=exp(1);
pi=(double)2*acos(0);
two_pi=2*pi;

 printf("\n t  %f",20.0); // Test of code generation. Should print 20.000000

// Initialize function names. Just for display
  if ((f_functs = fopen("functions.txt","r")) == NULL)
   {
   fprintf(stderr,"Can't open the file functions.txt\n");
   exit(1);
   }

i=1;
next_funct:
	fscanf(f_functs,"%i %s\n",&bidon,&functions[i]);
  if (bidon!=-1)
  {
	// printf("\n %i %s",bidon,functions[i]);
    i=i+1;
    goto next_funct;
  }
printf("\n-----------------------------------\n");

fclose (f_functs);


//===================  Other files  (keep them open during the whole process)


f_problem=fopen("problems.txt","r");
if (f_problem == NULL)
 {
 fprintf(stderr,"Can't open the file problems.txt\n");
 exit(1);
 }
 f_discrete=fopen("discrete.txt","r");
 if (f_discrete == NULL)
 {
 fprintf(stderr,"Can't open the file discrete.txt\n");
 exit(1);
 }
printf("\n Open files");
f_run=fopen("run.txt","w");
f_run_c=fopen("run_c.txt","w");
f_swarm=fopen("swarm.txt","w");
f_synth=fopen("synth.txt","w");
f_trace=fopen("trace.txt","w");
f_energy=fopen("energy.txt","w");
f_trace_run=fopen("trace_run.txt","w");
//-----------------

// Read strategies  (for tests. Will be hard coded later) . See move_particle()
for (i=0;i<2;i++)
{
      for (j=0;j<Max_status;j++)
         fscanf(f_problem, "%f",&strategies[i][j]);

}

fscanf(f_problem,"%i",&confin_interv); // If <0, no interval (boundary) confinement

fscanf(f_problem,"%i",&circular_hood); // Option. Usually equal to 0.
// If >0,  indicates the size of the circular neighbourhood
//    This option is just to rapidly compare with parametric PSO

if (circular_hood<0)
{
	if (circular_hood<-1)
	{
		circular_hood=-circular_hood;
		rand_hood=circular_hood;
	}
	else
	{
		//rand_hood=K_optim(problem[level].init_size,problem[level].eps);
		// Just for info. : init_size and eps are not yet known
	}
}
else
{
	rand_hood=0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品久久久| 欧美伦理电影网| 久久久久久久综合日本| 久久99国产精品久久| 精品久久99ma| 国产一区二区导航在线播放| 精品国精品自拍自在线| 国产精华液一区二区三区| 中文子幕无线码一区tr| 色94色欧美sute亚洲13| 午夜视频一区在线观看| 精品久久久久久亚洲综合网 | 欧美蜜桃一区二区三区 | 国产精品午夜春色av| 粉嫩一区二区三区在线看| 国产精品乱码一区二三区小蝌蚪| 成人深夜视频在线观看| 亚洲一区在线观看网站| 日韩一区二区高清| 国产成人啪午夜精品网站男同| 国产精品毛片a∨一区二区三区| 91理论电影在线观看| 图片区小说区区亚洲影院| 精品国产乱码久久久久久1区2区| 成人h精品动漫一区二区三区| 亚洲国产中文字幕在线视频综合| 欧美一卡2卡3卡4卡| 成人午夜在线视频| 成人教育av在线| 亚洲三级小视频| 欧美一区二区日韩一区二区| 成人永久免费视频| 日韩av中文字幕一区二区三区| 国产日韩高清在线| 欧美日本一区二区三区| 国产精品一区二区三区四区| 亚洲午夜激情av| 中文字幕欧美日韩一区| 91精品国产综合久久久久久久| 成人丝袜高跟foot| 美腿丝袜在线亚洲一区| 最新久久zyz资源站| 欧美xxx久久| 欧美日韩精品欧美日韩精品| 风间由美一区二区av101| 性感美女极品91精品| 中文字幕在线观看一区| 久久久亚洲高清| 在线不卡免费av| 色综合天天综合| 国产高清一区日本| 久久99精品久久久久| 亚洲国产精品久久不卡毛片| 国产精品毛片a∨一区二区三区| 精品久久五月天| 欧美精品777| 欧美日韩中文精品| 色综合久久综合中文综合网| 国产激情视频一区二区在线观看 | 国产高清精品在线| 美日韩一区二区三区| 亚洲成人1区2区| 一区二区三区 在线观看视频| 国产精品久久久久桃色tv| 久久午夜免费电影| 精品国产一区二区三区av性色| 欧美日韩中字一区| 欧美亚洲动漫精品| 欧洲中文字幕精品| 色婷婷av一区二区三区之一色屋| 丁香婷婷综合五月| 国产成人午夜片在线观看高清观看| 久久er99精品| 一本一本久久a久久精品综合麻豆| 久久精品一区二区三区不卡牛牛| 91精品国产欧美一区二区18 | av在线不卡免费看| 岛国av在线一区| 成人免费毛片app| 成人一区二区三区中文字幕| 岛国精品在线观看| 成人午夜私人影院| 91一区二区三区在线观看| 色综合天天综合色综合av| 色噜噜狠狠色综合中国| 在线精品视频免费观看| 欧美日本一区二区| 91精品国产欧美一区二区成人| 欧美一区二区久久| 26uuu亚洲综合色| 丝袜美腿亚洲综合| 日韩一区欧美二区| 激情综合亚洲精品| 成人午夜视频免费看| 91麻豆产精品久久久久久| 日本精品一区二区三区四区的功能| 一本一道综合狠狠老| 欧美精品电影在线播放| 久久亚洲精品国产精品紫薇| 久久久久青草大香线综合精品| 国产女人aaa级久久久级| 亚洲私人黄色宅男| 三级欧美在线一区| 国产宾馆实践打屁股91| 91麻豆国产香蕉久久精品| 555夜色666亚洲国产免| 久久精品在这里| 亚洲主播在线观看| 国内精品在线播放| 色综合久久久久久久| 欧美videofree性高清杂交| 国产精品久久久久久久久免费桃花| 一区二区三区在线观看视频| 久久9热精品视频| 色综合天天综合网天天看片| 日韩一区二区免费在线电影| 中文字幕av不卡| 午夜精品免费在线| 成人免费福利片| 欧美一区二区成人| 亚洲色图欧洲色图婷婷| 激情欧美一区二区三区在线观看| 91亚洲精品一区二区乱码| 欧美一区二区三区思思人 | 亚洲欧美日韩中文字幕一区二区三区| 午夜精品免费在线观看| 国产成人8x视频一区二区| 色av成人天堂桃色av| 2023国产一二三区日本精品2022| 亚洲免费三区一区二区| 国产精品综合视频| 欧美欧美午夜aⅴ在线观看| 国产欧美综合色| 日韩av电影天堂| 色婷婷精品久久二区二区蜜臀av| 2023国产精品| 丝袜美腿亚洲综合| 91久久精品一区二区三区| 国产欧美精品国产国产专区 | bt7086福利一区国产| 91精品国产色综合久久不卡电影| 亚洲欧美成人一区二区三区| 国产精品综合网| 精品国产乱码久久久久久图片| 一区二区在线观看免费| jizzjizzjizz欧美| 中文字幕欧美日韩一区| 国内精品国产三级国产a久久| 3atv在线一区二区三区| 一区二区三区在线视频观看| 成人网在线播放| 欧美国产丝袜视频| 国产精品亚洲一区二区三区妖精| 欧美成人精品福利| 日韩在线卡一卡二| 欧美日韩一区高清| 一区二区三国产精华液| 91麻豆成人久久精品二区三区| 国产精品久久久久影视| 国产成人在线视频免费播放| 日韩丝袜美女视频| 日本美女视频一区二区| 欧美精品视频www在线观看| 国产成人精品亚洲日本在线桃色| 日韩免费一区二区| 麻豆精品久久久| 日韩视频国产视频| 久久成人免费网| 久久亚洲综合色| 国产91清纯白嫩初高中在线观看| 国产日产欧美一区| 暴力调教一区二区三区| 国产精品久久久99| 色成人在线视频| 五月综合激情日本mⅴ| 日韩一区二区在线播放| 日本美女视频一区二区| 欧美成人乱码一区二区三区| 国产在线视频不卡二| 国产亚洲va综合人人澡精品| 成a人片国产精品| 一区二区三区四区在线免费观看| 欧美亚洲国产怡红院影院| 亚洲国产一区视频| 日韩一区二区三区四区| 激情六月婷婷综合| 中文字幕中文字幕一区二区| 色94色欧美sute亚洲线路一ni| 午夜婷婷国产麻豆精品| 亚洲精品在线免费播放| www.视频一区| 亚洲1区2区3区视频| 日韩欧美视频在线| 国产·精品毛片| 亚洲欧美激情小说另类| 欧美一区二区福利在线| 成人免费高清视频在线观看| 亚洲国产精品麻豆| 久久久另类综合| 欧美日韩中文字幕精品|