91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 406KB
    文件類(lèi)型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-21
  • 語(yǔ)言: Matlab
  • 標(biāo)簽: matlab??TS算法??job??

資源簡(jiǎn)介

蟻群、粒子群、GA、TS等算法解決Job shop問(wèn)題matlab源碼(附test文件)

資源截圖

代碼片段和文件信息

%?Ant?Colony?Opimization?-?Ant?Colony?System?for?Hybird?Job?Shop?Sceduling
%?Problem.

function?[costs?bestSol]?=?ACO(jobs?m?n?ants?iterations?...
????????????????????????????????rzero?costFunc)

??costEnd?=?0;
??costs?=?[];
??bestSol?=?ones(1?n);
??bestSolCost?=?costFunc(bestSol?jobs?m?n);

??phermone?=?ones(n?m*m);?%?track?phermone?value?on?each?path.

??for?i?=?1:iterations

????antPaths?=?[];?%?stores?all?antPaths
????for?a?=?1:ants;

??????antPath?=?[];?%?current?ants?path

??????for?l?=?1:n?%?going?down?n?layers?in?total

????????phermoneToNextLevel?=?[];

????????if?l?==?1?%?layer?1?to?n?mapping
??????????for?j?=?1:m
????????????phermoneToNextLevel(j)?=?phermone(1?j);
??????????end

????????else?%?rest?layers?are?n?to?n?mapping
??????????lastNode?=?antPath(l-1);

??????????phermoneRow?=?l;
??????????phermoneColS?=?(lastNode?-?1)?*?m?+?1;
??????????phermoneColF?=?lastNode?*?m;
??????????phermoneToNextLevel?=?phermone(phermoneRow?...
?????????????????????????????????????????phermoneColS:phermoneColF);
????????end

????????randVal?=?rand(1);
????????weights?=?phermoneToNextLevel;
????????testPath?=?antPath;?%?copy?current?ant?path?to?calculate?distance
????????for?mi?=?1:m
??????????testPath(l)?=?mi;
??????????%?Construct?a?matrix?to?memorize?this?for?better?performance
??????????distance?=??costFunc(testPath?jobs?m?l)?-?costFunc(antPath?...
????????????????????????????????????????????????????????????????jobs?m?l-1);
??????????weights(mi)?=?weights(mi)?/?(distance+1);
????????end
????????totalWeight?=?sum(weights);
????????weightAcc?=?0;
????????nextIndex?=?0;

????????if?rand(1)???????????nextIndexs?=?find(weights?==?max(weights));
??????????nextIndex?=?nextIndexs(randi(numel(nextIndexs)));
????????else
??????????while?randVal?>?(weightAcc?/?totalWeight)
????????????nextIndex?=?nextIndex?+?1;
????????????weightAcc?=?weightAcc?+?weights(nextIndex);
??????????end
????????end
????????antPath(l)?=?nextIndex;
??????end

??????antPaths(a?:)?=?antPath;

????end

????antCosts?=?[];

????%?Find?costs?for?all?ant?paths.?Consider?to?use?a?vectoralization
????%?version?of?cost?function?for?this?process?in?matlab.
????for?a?=?1:ants
??????antCosts(a)?=?costFunc(antPaths(a:)?jobs?m?n);
????end

????bestAntCost?=?min(antCosts);
????worstAntCost?=?max(antCosts);
????bestAntPaths?=?antPaths(find(antCosts==bestAntCost)?:);

????%?Update?phermone
????phermone?=?phermone?.*?0.4;

????if?bestAntCost?<=?bestSolCost
???????%?ONLY?THE?GLOBAL?BEST?ALLOW?TO?UPDATE
??????deltaPhermone?=?1?/?bestAntCost;

??????for?s?=?1:size(bestAntPaths?1)
????????bestAntPath?=?bestAntPaths(s:);
????????for?ji?=?1:n
??????????pcol?=?0;
??????????if?ji?==?1?%?first?job
????????????pcol?=?bestAntPath(ji);
??????????else
????????????lastNode?=?bestAntPath(ji?-?1);
????????????pcol?=?(lastNode?-?1)?*?m?+?bestAntPath(ji);
??????????end
??????????phermone(ji?pcol)?=?phermone(ji?pcol)?+?deltaPhermone;
????????end
??????end
??

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2014-07-30?00:05??animated-archer-master\
?????文件??????????33??2014-07-30?00:05??animated-archer-master\.gitignore
?????文件????????3190??2014-07-30?00:05??animated-archer-master\ACO.m
?????文件?????????378??2014-07-30?00:05??animated-archer-master\ACO_16t6m_test.m
?????文件?????????384??2014-07-30?00:05??animated-archer-master\ACO_17t5m_test.m
?????文件?????????391??2014-07-30?00:05??animated-archer-master\ACO_test.m
?????文件?????????575??2014-07-30?00:05??animated-archer-master\ALL_test_16t6m.m
?????文件?????????575??2014-07-30?00:05??animated-archer-master\ALL_test_17t5m.m
?????文件????????5440??2014-07-30?00:05??animated-archer-master\GA.m
?????文件?????????344??2014-07-30?00:05??animated-archer-master\GA_16t6m_test.m
?????文件?????????348??2014-07-30?00:05??animated-archer-master\GA_17t5m_test.m
?????文件?????????352??2014-07-30?00:05??animated-archer-master\GA_test.m
?????文件????????1383??2014-07-30?00:05??animated-archer-master\PSO.m
?????文件?????????367??2014-07-30?00:05??animated-archer-master\PSO_16t6m_test.m
?????文件?????????371??2014-07-30?00:05??animated-archer-master\PSO_17t5m_test.m
?????文件????????2122??2014-07-30?00:05??animated-archer-master\PSO_lbest.m
?????文件?????????380??2014-07-30?00:05??animated-archer-master\PSO_test.m
?????文件???????24316??2014-07-30?00:05??animated-archer-master\README.html
?????文件????????9780??2014-07-30?00:05??animated-archer-master\README.org
?????文件????????1539??2014-07-30?00:05??animated-archer-master\SA.m
?????文件?????????522??2014-07-30?00:05??animated-archer-master\SA_16t6m_test.m
?????文件?????????527??2014-07-30?00:05??animated-archer-master\SA_17t5m_test.m
?????文件?????????547??2014-07-30?00:05??animated-archer-master\SA_test.m
?????文件?????????957??2014-07-30?00:05??animated-archer-master\TS.m
?????文件?????????374??2014-07-30?00:05??animated-archer-master\TS_16t6m_test.m
?????文件?????????380??2014-07-30?00:05??animated-archer-master\TS_17t5m_test.m
?????文件?????????760??2014-07-30?00:05??animated-archer-master\TS_readme.txt
?????文件?????????384??2014-07-30?00:05??animated-archer-master\TS_test.m
?????文件?????????230??2014-07-30?00:05??animated-archer-master\cost.m
?????文件?????????215??2014-07-30?00:05??animated-archer-master\cost_test.m
?????文件?????????206??2014-07-30?00:05??animated-archer-master\findStartTemp.m
............此處省略16個(gè)文件信息

評(píng)論

共有 條評(píng)論