資源簡介
最全的java多目標進化算法,包括naga2,spea2,pesa2等等目前流行的多目標進化算法
代碼片段和文件信息
/**
?*?Algorithm.java
?*?@author?Juan?J.?Durillo
?*?@version?1.0
?*/
package?jmetal.base?;
import?java.io.Serializable;
import?java.util.*;
import?jmetal.util.JMException;
/**?This?class?implements?a?generic?template?for?the?algorithms?developed?in
?*??jmetal.?Every?algorithm?must?have?a?mapping?between?the?parameters?and?
?*??and?their?names?and?another?mapping?between?the?operators?and?their?names.?
?*??The?class?declares?an?abstract?method?called?execute
?which?
?*??defines?the?behavior?of?the?algorithm.
?*/?
public?abstract?class?Algorithm?implements?Serializable?{
???
?/**?
??*?Stores?the?operators?used?by?the?algorithm?such?as?selection?crossover
??*?etc.
??*/
??protected?Map?operators_?=?null;
??
?/**?
??*?Stores?algorithm?specific?parameters.?For?example?in?NSGA-II?these
??*?parameters?include?the?population?size?and?the?maximum?number?of?function
??*?evaluations.
??*/
??protected?Mapject>?inputParameters_?=?null;??
??
??/**?
???*?Stores?output?parameters?which?are?retrieved?by?Main?object?to?
???*?obtain?information?from?an?algorithm.
???*/
??protected?Mapject>?outPutParameters_?=?null;
??
?/**???
??*?Launches?the?execution?of?an?specific?algorithm.
??*?@return?a?SolutionSet
?that?is?a?set?of?non?dominated?solutions
??*?as?a?result?of?the?algorithm?execution??
??*/
??public?abstract?SolutionSet?execute()?throws?JMException?;???
??
?/**
??*?Offers?facilities?for?add?new?operators?for?the?algorithm.?To?use?an
??*?operator?an?algorithm?has?to?obtain?it?through?the?
??*?getOperator
?method.
??*?@param?name?The?operator?name
??*?@param?operator?The?operator
??*/
??public?void?addOperator(String?name?Operator?operator){
????if?(operators_?==?null)?{
??????operators_?=?new?HashMap();
????}????????
????operators_.put(nameoperator);
??}?//?addOperator?
??
?/**
??*?Gets?an?operator?through?his?name.?If?the?operator?doesn‘t?exist?or?the?name?
??*?is?wrong?this?method?returns?null.?The?client?of?this?method?have?to?check?
??*?the?result?of?the?method.
??*?@param?name?The?operator?name
??*?@return?The?operator?if?exists?null?in?another?case.
??*/
??public?Operator?getOperator(String?name){
????return?operators_.get(name);
??}?//?getOperator???
??
?/**
??*?Sets?an?input?parameter?to?an?algorithm.?Typically
??*?the?method?is?invoked?by?a?Main?object?before?running?an?algorithm.?
??*?The?parameters?have?to?been?inserted?using?their?name?to?access?them?through?
??*?the?getInputParameter
?method.
??*?@param?name?The?parameter?name
??*?@param?object?object?that?represent?a?parameter?for?the
??*?algorithm.
??*/
??public?void?setInputParameter(String?name?object?object){
????if?(inputParameters_?==?null)?{
??????inputParameters_?=?new?HashMapject>();
????}????????
????inputParameters_.put(nameobject);
??}?//?setInputParameter??
??
?/**
??*?Gets?an?input?parameter?through?its?name.?Typically
??*?the?method?is?invoked?by?an?object?
- 上一篇:android 播放器按鈕圖標
- 下一篇:java web 聊天室 源碼
評論
共有 條評論