diff --git a/.gitignore b/.gitignore
index d340a43..b9bdf52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
# Ignore the build and lib dirs
build/
lib/
+vs/
# Ignore any executables
bin/
@@ -18,3 +19,299 @@ nbproject/
*.xcworkspacedata
*.xcuserstate
*.xcsettings
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+**/Properties/launchSettings.json
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Typescript v1 declaration files
+typings/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..018e88f
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,78 @@
+cmake_minimum_required(VERSION 3.6)
+project(jMetalCpp)
+set(CMAKE_CXX_STANDARD 11)
+
+function (ListToString result delim)
+ list(GET ARGV 2 temp)
+ math(EXPR N "${ARGC}-1")
+ foreach(IDX RANGE 3 ${N})
+ list(GET ARGV ${IDX} STR)
+ set(temp "${temp}${delim}${STR}")
+ endforeach()
+ set(${result} "${temp}" PARENT_SCOPE)
+endfunction(ListToString)
+
+
+define_property(GLOBAL PROPERTY SOURCE_LIST BRIEF_DOCS "Global list of source code" FULL_DOCS "Global list of source code")
+set_property(GLOBAL PROPERTY SOURCE_LIST "")
+
+macro(LIST_APPEND var)
+ set_property(GLOBAL APPEND PROPERTY SOURCE_LIST "${var}")
+endmacro(LIST_APPEND)
+
+define_property(GLOBAL PROPERTY HEADER_LIST BRIEF_DOCS "Global list of header code" FULL_DOCS "Global list of header code")
+set_property(GLOBAL PROPERTY HEADER_LIST "")
+
+macro(LIST_APPEND_HEADER var)
+ set_property(GLOBAL APPEND PROPERTY HEADER_LIST "${var}")
+endmacro(LIST_APPEND_HEADER)
+
+include_directories(
+ ${PROJECT_SOURCE_DIR}/src
+ ${PROJECT_SOURCE_DIR}/src/core
+ ${PROJECT_SOURCE_DIR}/src/encodings
+ ${PROJECT_SOURCE_DIR}/src/encodings/solutionType
+ ${PROJECT_SOURCE_DIR}/src/encodings/variable
+ ${PROJECT_SOURCE_DIR}/src/experiments
+ ${PROJECT_SOURCE_DIR}/src/experiments/main
+ ${PROJECT_SOURCE_DIR}/src/experiments/settings
+ ${PROJECT_SOURCE_DIR}/src/experiments/util
+ ${PROJECT_SOURCE_DIR}/src/main
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/gde3
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/mochc
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/moead
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/nsgaII
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/omopso
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/paes
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/singleObjective
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/singleObjective/cmaes
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/singleObjective/cmaes/utils
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/singleObjective/differentialEvolution
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/singleObjective/geneticAlgorithm
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/singleObjective/particleSwarmOptimization
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/smpso
+ ${PROJECT_SOURCE_DIR}/src/metaheuristics/smsemoa
+ ${PROJECT_SOURCE_DIR}/src/operators
+ ${PROJECT_SOURCE_DIR}/src/operators/crossover
+ ${PROJECT_SOURCE_DIR}/src/operators/mutation
+ ${PROJECT_SOURCE_DIR}/src/operators/selection
+ ${PROJECT_SOURCE_DIR}/src/problems
+ ${PROJECT_SOURCE_DIR}/src/problems/DTLZ
+ ${PROJECT_SOURCE_DIR}/src/problems/LZ09
+ ${PROJECT_SOURCE_DIR}/src/problems/singleObjective
+ ${PROJECT_SOURCE_DIR}/src/problems/singleObjective/cec2005Competition
+ ${PROJECT_SOURCE_DIR}/src/problems/ZDT
+ ${PROJECT_SOURCE_DIR}/src/qualityIndicator
+ ${PROJECT_SOURCE_DIR}/src/qualityIndicator/fastHypervolume
+ ${PROJECT_SOURCE_DIR}/src/qualityIndicator/main
+ ${PROJECT_SOURCE_DIR}/src/qualityIndicator/util
+ ${PROJECT_SOURCE_DIR}/src/util
+ ${PROJECT_SOURCE_DIR}/src/util/archive
+ ${PROJECT_SOURCE_DIR}/src/util/comparators
+ ${PROJECT_SOURCE_DIR}/src/util/wrapper
+ )
+add_subdirectory(${PROJECT_SOURCE_DIR}/src)
+get_property(my_source_list GLOBAL PROPERTY SOURCE_LIST)
+get_property(my_header_list GLOBAL PROPERTY HEADER_LIST)
+add_library(${PROJECT_NAME} ${my_source_list} ${my_header_list})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..babc786
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_subdirectory(core)
+add_subdirectory(encodings)
+add_subdirectory(experiments)
+add_subdirectory(main)
+add_subdirectory(metaheuristics)
+add_subdirectory(operators)
+add_subdirectory(problems)
+add_subdirectory(qualityIndicator)
+add_subdirectory(util)
diff --git a/src/core/Algorithm.cpp b/src/core/Algorithm.cpp
index ff53e0c..c6e9c66 100644
--- a/src/core/Algorithm.cpp
+++ b/src/core/Algorithm.cpp
@@ -20,7 +20,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see .
-
#include
@@ -28,16 +27,18 @@
* Constructor
* @param problem
**/
-Algorithm::Algorithm(Problem *problem) {
- problem_ = problem;
+Algorithm::Algorithm(Problem *problem)
+{
+ problem_ = problem;
}
/**
* Destructor
*/
-Algorithm::~Algorithm() {
- delete problem_;
+Algorithm::~Algorithm()
+{
+ delete problem_;
} // ~Algorithm
@@ -48,8 +49,9 @@ Algorithm::~Algorithm() {
* @param name The operator name
* @param operator The operator
**/
-void Algorithm::addOperator(string name, Operator * operator_) {
- operators_[name] = operator_;
+void Algorithm::addOperator(std::string name, Operator * operator_)
+{
+ operators_[name] = operator_;
}
@@ -60,8 +62,9 @@ void Algorithm::addOperator(string name, Operator * operator_) {
* @param name The operator name
* @return The operator if exists, null in another case.
**/
-Operator * Algorithm::getOperator(string name) {
- return operators_[name];
+Operator * Algorithm::getOperator(std::string name)
+{
+ return operators_[name];
}
@@ -74,8 +77,9 @@ Operator * Algorithm::getOperator(string name) {
* @param object Object that represent a parameter for the
* algorithm.
**/
-void Algorithm::setInputParameter(string name, void *value) {
- inputParameters_[name] = value;
+void Algorithm::setInputParameter(std::string name, void *value)
+{
+ inputParameters_[name] = value;
}
@@ -86,8 +90,9 @@ void Algorithm::setInputParameter(string name, void *value) {
* @return Object representing the parameter or null if the parameter doesn't
* exist or the name is wrong
**/
-void * Algorithm::getInputParameter(string name) {
- return inputParameters_[name];
+void * Algorithm::getInputParameter(std::string name)
+{
+ return inputParameters_[name];
}
@@ -99,8 +104,9 @@ void * Algorithm::getInputParameter(string name) {
* @param name The output parameter name
* @param object Object representing the output parameter
**/
-void Algorithm::setOutputParameter(string name, void *value) {
- outputParameters_[name] = value;
+void Algorithm::setOutputParameter(std::string name, void *value)
+{
+ outputParameters_[name] = value;
}
@@ -111,8 +117,9 @@ void Algorithm::setOutputParameter(string name, void *value) {
* @return Object representing the output parameter, or null if the parameter
* doesn't exist or the name is wrong.
**/
-void * Algorithm::getOutputParameter(string name) {
- return outputParameters_[name];
+void * Algorithm::getOutputParameter(std::string name)
+{
+ return outputParameters_[name];
}
@@ -120,6 +127,7 @@ void * Algorithm::getOutputParameter(string name) {
* Returns the problem to solve
* @return Problem The problem to solve
**/
-Problem * Algorithm::getProblem() {
- return problem_;
+Problem * Algorithm::getProblem()
+{
+ return problem_;
}
diff --git a/src/core/Algorithm.h b/src/core/Algorithm.h
index d9db7ea..59937c5 100644
--- a/src/core/Algorithm.h
+++ b/src/core/Algorithm.h
@@ -23,6 +23,7 @@
#ifndef __ALGORITHM__
#define __ALGORITHM__
+#include "JMetalHeader.h"
#include
#include
#include
@@ -35,26 +36,30 @@
* The class declares an abstract method called execute, which
* defines the behavior of the algorithm.
**/
-class Algorithm {
+
+using namespace JMetal;
+
+class Algorithm
+{
public:
- Algorithm(Problem *problem);
- virtual ~Algorithm();
- virtual SolutionSet * execute() = 0; // this launch the execution
- // of an algorithm
- void addOperator(string name, Operator *operator_);
- Operator * getOperator(string name);
- void setInputParameter(string name, void *value);
- void * getInputParameter(string name);
- void setOutputParameter(string name, void *value);
- void * getOutputParameter(string name);
- Problem * getProblem();
+ Algorithm(Problem *problem);
+ virtual ~Algorithm();
+ virtual SolutionSet * execute() = 0; // this launch the execution
+ // of an algorithm
+ void addOperator(std::string name, Operator *operator_);
+ Operator * getOperator(std::string name);
+ void setInputParameter(std::string name, void *value);
+ void * getInputParameter(std::string name);
+ void setOutputParameter(std::string name, void *value);
+ void * getOutputParameter(std::string name);
+ Problem * getProblem();
protected:
- Problem *problem_;
- map operators_;
- map inputParameters_;
- map outputParameters_;
+ Problem *problem_ = nullptr;
+ MapOfStringOperatorPtr operators_;
+ MapOfStringFunct inputParameters_;
+ MapOfStringFunct outputParameters_;
}; // Algorithm
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
new file mode 100644
index 0000000..ca3372a
--- /dev/null
+++ b/src/core/CMakeLists.txt
@@ -0,0 +1,3 @@
+file(GLOB SOURCES "*.cpp" "*.h")
+ListToString(SOURCES ";" ${SOURCES})
+LIST_APPEND("${SOURCES}")
diff --git a/src/core/JMetalHeader.h b/src/core/JMetalHeader.h
new file mode 100644
index 0000000..20964a0
--- /dev/null
+++ b/src/core/JMetalHeader.h
@@ -0,0 +1,37 @@
+#ifndef __JMETAL_HEADER__
+#define __JMETAL_HEADER__
+
+#ifdef MSVC
+ #ifdef _DEBUG
+ #define snew new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
+ #endif
+#else
+ #define snew new
+#endif
+
+#include
+#include