H=CIRCLE(CENTER,Radius,NOP,STYLE)
This routine draws a circle with center defined as
a vector CENTER, Radius as a scaler RADIS. NOP is
the number of points on the circle. As to STYLE,
use it the same way as you use the rountine PLOT.
Since the handle of the object is returned, you
use routine SET to get the best result.
C++完美演繹 經(jīng)典算法 如 /* 頭文件:my_Include.h */ #include <stdio.h> /* 展開C語(yǔ)言的內(nèi)建函數(shù)指令 */ #define PI 3.1415926 /* 宏常量,在稍后章節(jié)再詳解 */ #define circle(Radius) (PI*Radius*Radius) /* 宏函數(shù),圓的面積 */ /* 將比較數(shù)值大小的函數(shù)寫在自編include文件內(nèi) */ int show_big_or_small (int a,int b,int c) { int tmp if (a>b) { tmp = a a = b b = tmp } if (b>c) { tmp = b b = c c = tmp } if (a>b) { tmp = a a = b b = tmp } printf("由小至大排序之后的結(jié)果:%d %d %d\n", a, b, c) } 程序執(zhí)行結(jié)果: 由小至大排序之后的結(jié)果:1 2 3 可將內(nèi)建函數(shù)的include文件展開在自編的include文件中 圓圈的面積是=201.0619264
使用到的參數(shù)跟談到彈性網(wǎng)絡(luò)的那一章里頭所講的是一樣的, ke 則是終止條件。如果 step 被打勾,則程式在每一步之間會(huì)暫停 100毫秒(或其他使用者輸入的數(shù)值)。如果 Random 被打勾,則程式會(huì)以系統(tǒng)時(shí)間作為亂數(shù)產(chǎn)生器的種子數(shù),否則,就以使用者輸入的數(shù)( Random 右邊那一格)為種子數(shù)。
你可以利用 load 來(lái)載入推銷員問(wèn)題檔與其最佳解,如此便可比較彈性網(wǎng)絡(luò)所找出來(lái)的解與最佳解差了多少。
Central, Radius, and Error 這三個(gè)參數(shù)的前兩個(gè),只影響彈性網(wǎng)絡(luò)的起使位置和大小,對(duì)求解沒(méi)有影響。第三個(gè)參數(shù)代表城市與網(wǎng)絡(luò)點(diǎn)之間的容忍距離,也就是說(shuō),如果某城市與某網(wǎng)絡(luò)點(diǎn)之間的距離,小于容忍距離,那就把這個(gè)城市當(dāng)成是被該網(wǎng)絡(luò)點(diǎn)所拜訪。
按下小 w按鈕會(huì)將目前的結(jié)果與參數(shù)值寫到“en.out”這個(gè)檔案。使得我們可以很方便地來(lái)比較不同參數(shù)的效果。