// Experiment.java
//
// Authors:
// Antonio J. Nebro <antonio@lcc.uma.es>
// Juan J. Durillo <durillo@lcc.uma.es>
//
// Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jmetal.experiments;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import jmetal.core.Algorithm;
import jmetal.core.Problem;
import jmetal.experiments.util.RBoxplot;
import jmetal.experiments.util.RWilcoxon;
import jmetal.experiments.util.Statistics;
import jmetal.experiments.util.RunExperiment;
import jmetal.util.JMException;
/**
* Abstract class representing jMetal experiments
*/
public abstract class Experiment {
public String experimentName_;
public String[] algorithmNameList_; // List of the names of the algorithms to be executed
public String[] problemList_; // List of problems to be solved
public String[] paretoFrontFile_; // List of the files containing the pareto fronts
// corresponding to the problems in problemList_
public String[] indicatorList_; // List of the quality indicators to be applied
public String experimentBaseDirectory_; // Directory to store the results
public String latexDirectory_; // Directory to store the latex files
public String paretoFrontDirectory_; // Directory containing the Pareto front files
public String outputParetoFrontFile_; // Name of the file containing the output
// Pareto front
public String outputParetoSetFile_; // Name of the file containing the output
// Pareto set
public int independentRuns_; // Number of independent runs per algorithm
public Settings[] algorithmSettings_; // Paremeter settings of each algorithm
//Algorithm[] algorithm_; // jMetal algorithms to be executed
HashMap<String, Object> map_; // Map used to send experiment parameters to threads
public HashMap<String, Boolean> indicatorMinimize_; // To indicate whether an indicator
// is to be minimized. Hard-coded
// in the constructor
public Properties [] problemsSettings_ ;
/**
* Constructor
*
* Contains default settings
*/
public Experiment() {
experimentName_ = "noName";
problemsSettings_ = null ;
map_ = new HashMap<String, Object>();
algorithmNameList_ = null;
problemList_ = null;
paretoFrontFile_ = null;
indicatorList_ = null;
experimentBaseDirectory_ = "";
paretoFrontDirectory_ = "";
latexDirectory_ = "latex";
outputParetoFrontFile_ = "FUN";
outputParetoSetFile_ = "VAR";
algorithmSettings_ = null;
//algorithm_ = null;
independentRuns_ = 0;
indicatorMinimize_ = new HashMap<String, Boolean>();
indicatorMinimize_.put("HV", false);
indicatorMinimize_.put("EPSILON", true);
indicatorMinimize_.put("SPREAD", true);
indicatorMinimize_.put("GD", true);
indicatorMinimize_.put("IGD", true);
} // Constructor
/**
* Runs the experiment
*/
public void runExperiment(int numberOfThreads) throws JMException, IOException {
// Step 1: check experiment base directory
checkExperimentDirectory();
map_.put("experimentDirectory", experimentBaseDirectory_);
map_.put("algorithmNameList", algorithmNameList_);
map_.put("problemList", problemList_);
map_.put("indicatorList", indicatorList_);
map_.put("paretoFrontDirectory", paretoFrontDirectory_);
map_.put("paretoFrontFile", paretoFrontFile_);
map_.put("independentRuns", independentRuns_);
map_.put("outputParetoFrontFile", outputParetoFrontFile_);
map_.put("outputParetoSetFile", outputParetoSetFile_);
map_.put("problemsSettings", problemsSettings_);
//SolutionSet[] resultFront = new SolutionSet[algorithmNameList_.length];
if (problemList_.length < numberOfThreads) {
numberOfThreads = problemList_.length;
System.out.println("Experiments: list of problems is shorter than the " +
"of requested threads. Creating " + numberOfThreads);
} // if
else {
System.out.println("Experiments: creating " + numberOfThreads + " threads");
}
Thread[] p = new RunExperiment[numberOfThreads];
for (int i = 0; i < numberOfThreads; i++) {
//p[i] = new Experiment(map_, i, numberOfThreads, problemList_.length);
p[i] = new RunExperiment(this, map_, i, numberOfThreads, problemList_.length);
p[i].start();
}
try {
for (int i = 0; i < numberOfThreads; i++) {
p[i].join();
}
} catch (InterruptedException ex) {
Logger.getLogger(Experiment.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Runs the experiment
*/
public void runExperiment() throws JMException, IOException {
runExperiment(1);
} // runExperiment
public void checkExperimentDirectory() {
File experimentDirectory;
experimentDirectory = new File(experimentBaseDirectory_);
if (experimentDirectory.exists()) {
System.out.println("Experiment directory exists");
if (experimentDirectory.isDirectory()) {
System.out.println("Experiment directory is a directory");
} else {
System.out.println("Experiment directory is not a directory. Deleting file and creating directory");
}
experimentDirectory.delete();
new File(experimentBaseDirectory_).mkdirs();
} // if
else {
System.out.println("Experiment directory does NOT exist. Creating");
new File(experimentBaseDirectory_).mkdirs();
} // else
} // checkDirectories
/**
* Especifies the settings of each algorith. This method is checked in each
* experiment run
* @param problem Problem to solve
* @param problemId Index of the problem in problemList_
* @param algorithm Array containing the algorithms to execute
* @throws ClassNotFoundException
*/
public abstract void algorithmSettings(String problemName, int problemId, Algorithm[] algorithm) throws ClassNotFoundException;
public static void main(String[] args) throws JMException, IOException {
}
;
public void generateLatexTables() throws FileNotFoundException, IOException {
latexDirectory_ = experimentBaseDirectory_ + "/" + latexDirectory_;
System.out.println("latex directory: " + latexDirectory_);
Vector[][][] data = new Vector[indicatorList_.length][][];
for (int indicator = 0; indicator < indicatorList_.length; indicator++) {
// A data vector per problem
data[indicator] = new Vector[problemList_.length][];
for (int problem = 0; problem < problemList_.length; problem++) {
data[indicator][problem] = new Vector[algorithmNameList_.length];
for (int algorithm = 0; algorithm < algorithmNameList_.length; algorithm++) {
data[indicator][problem][algorithm] = new Vector();
String directory = experimentBaseDirectory_;
directory += "/data/";
directory += "/" + algorithmNameList_[algorithm];
directory += "/" + problemList_[problem];
directory += "/" + indicatorList_[indicato
没有合适的资源?快使用搜索试试~ 我知道了~
每年520节日画图实现源码.zip
共253个文件
java:251个
zip:1个
cvsignore:1个
需积分: 5 1 下载量 129 浏览量
2024-05-24
18:09:42
上传
评论
收藏 828KB ZIP 举报
温馨提示
每年520节日画图实现源码.zip每年520节日画图实现源码.zip每年520节日画图实现源码.zip每年520节日画图实现源码.zip每年520节日画图实现源码.zip每年520节日画图实现源码.zip每年520节日画图实现源码.zip每年520节日画图实现源码.zip每年520节日画图实现源码.zip
资源推荐
资源详情
资源评论
收起资源包目录
每年520节日画图实现源码.zip (253个子文件)
.cvsignore 10B
Experiment.java 26KB
AbYSS.java 20KB
RWilcoxon.java 17KB
Solution.java 15KB
MOEAD_DRA.java 14KB
pMOEAD.java 14KB
SMPSO.java 13KB
AdaptiveGrid.java 13KB
PSO.java 12KB
MOEAD.java 11KB
SolutionSet.java 11KB
OMOPSO.java 11KB
SMSEMOA.java 11KB
IBEA.java 10KB
DifferentialEvolutionCrossover.java 10KB
RunExperiment.java 9KB
Hypervolume.java 9KB
MetricsUtil.java 9KB
LZ09.java 8KB
SinglePointCrossover.java 8KB
Distance.java 8KB
Spea2Fitness.java 7KB
Neighborhood.java 7KB
MOCHC.java 7KB
SBXCrossover.java 7KB
sMOCell1.java 7KB
TwoPointsCrossover.java 7KB
SBXSinglePointCrossover.java 7KB
GeneralizedSpread.java 7KB
sMOCell2.java 7KB
NSGAII_main.java 7KB
Problem.java 7KB
Settings.java 7KB
pMOEAD_main.java 6KB
CellDE.java 6KB
StandardStudy.java 6KB
AbYSS_main.java 6KB
aMOCell1.java 6KB
aMOCell3.java 6KB
FastPGA_main.java 6KB
Variable.java 6KB
PMXCrossover.java 6KB
NSGAII.java 6KB
MOCell.java 6KB
aMOCell2.java 6KB
MOEAD_main.java 6KB
MOCell_main.java 6KB
PropUtils.java 6KB
ssNSGAII.java 6KB
HUXCrossover.java 6KB
SMSEMOA_main.java 6KB
FastPGA.java 6KB
WFG1.java 6KB
Spread.java 6KB
MutationLocalSearch.java 6KB
GDE3.java 6KB
ArrayInt.java 6KB
SPEA2_main.java 6KB
WFG2.java 5KB
IBEA_main.java 5KB
WFG8.java 5KB
PESA2_main.java 5KB
Algorithm.java 5KB
WFG3.java 5KB
Ranking.java 5KB
OMOPSO_main.java 5KB
InvertedGenerationalDistance.java 5KB
Epsilon.java 5KB
XReal.java 5KB
WFG7.java 5KB
NonUniformMutation.java 5KB
PAES_main.java 5KB
GenerationalDistance.java 5KB
Main.java 5KB
acGA.java 5KB
Transformations.java 5KB
Golinski.java 5KB
ProblemFactory.java 5KB
RBoxplot.java 5KB
SMPSO_main.java 5KB
DENSEA.java 5KB
TSP.java 5KB
AdaptiveGridArchive.java 5KB
scGA.java 5KB
Water.java 5KB
PAES.java 5KB
MOCell_Settings.java 5KB
WFG.java 5KB
GDE3_main.java 5KB
WFG5.java 5KB
NSGAIIStudy.java 5KB
ArrayReal.java 5KB
MOEAD_Settings.java 5KB
CellDE_main.java 5KB
BitFlipMutation.java 5KB
DE.java 5KB
NonElitistES.java 5KB
WFG6.java 5KB
gGA.java 5KB
共 253 条
- 1
- 2
- 3
资源评论
北航程序员小C
- 粉丝: 3003
- 资源: 2093
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Docker-compose的Elasticsearch集群每个节点均是独立docker-compose配置而成源码.zip
- 目标检测-零售食品LOGO检测数据集-40000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 目标检测-零售食品LOGO检测数据集-30000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 目标检测-零售食品LOGO检测数据集-20000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 目标检测-零售食品LOGO检测数据集-10000张图-+对应VOC-COCO-YOLO三种格式标签+数据集划分脚本
- 基于GUI+MYSQL+JAVA图书管理系统文档说明+源码(高分大作业项目).zip
- 基于Qt使用C++实现图书管理系统源码+数据库(95分以上).zip
- 基于GUI+MYSQL+JAVA票务管理系统文档介绍+源码+数据库(高分大作业).zip
- Java项目-购物网站系统(java+Servlet+JSP+Mysql)
- 基于MC1496应用电路Multisim仿真源文件,Multisim10以上版本可打开运行.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功