• 大小: 2.77MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-19
  • 语言: C/C++
  • 标签: 模拟退火  

资源简介

用模拟退火的算法实现最大公共子图的求解问题,使用c++语言

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 

#include 
#include 
#include 
#include 

using namespace sailmcs;

namespace {
SailMCS *mcs_ptr;
}

std::chrono::seconds get_time(const std::string &str) {
std::vector parts;
boost::split(parts str boost::is_any_of(“:“));
int seconds = 0;
size_t n = parts.size();
if(n > 3) {
throw std::invalid_argument(“Invalid time string. Use format [[hh:]mm:]ss.“);
}
for(size_t i = 0; i < std::min((size_t)3 n); ++i) {
seconds += boost::lexical_cast(parts[n-1-i]) * std::pow(60 i);
}
return std::chrono::seconds(seconds);
}

int main(int argc const char **argv) {
try {
TCLAP::CmdLine cmd(
“sailmcs“
“A heuristic algorithm for the multiple maximum common subgraph problem.“
“1.0“ “Simon Larsen .“
);

TCLAP::ValueArg timeArg(“t“ “time“ “Time to run algorithm before terminating. Format: [[hh:]mm:]ss.“ true ““ “time“ cmd);
TCLAP::ValueArg nthreadsArg(““ “nthreads“ “Number of threads to use.“ false 0 “threads“ cmd);
TCLAP::ValueArg outTableArg(“o“ “output-table“ “Write alignment table to file.“ false ““ “path“ cmd);
TCLAP::ValueArg outGraphArg(“g“ “output-graph“ “Writing solution graph to file.“ false ““ “path“ cmd);

TCLAP::ValueArg perturbationArg(“P“ “perturbation“ “Perturbation strategy {pheromone uniform}. Default: pheromone“ false “pheromone“ “strategy“ cmd);
TCLAP::ValueArg lsArg(“L“ “local-search“ “Local search strategy {first best vertex-best}. Default: vertex-best“ false “vertex-best“ “strategy“ cmd);
TCLAP::ValueArg annealingArg(“A“ “annealing“ “Annealing schedule {adaptive linear none}. Default: adaptive“ false “adaptive“ “schedule“ cmd);

TCLAP::ValueArg evaporationArg(“e“ “evaporation“ “Evaporation rate for pheromones [01). Default: 0.3“ false 0.3f “rate“ cmd);
TCLAP::ValueArg minPheromoneArg(“p“ “min-pheromone“ “Minimum amount of pheromone allowed for any pair. Default: 1.0“ false 1.0f “amount“ cmd);
TCLAP::ValueArg uniformPctArg(““ “uniform-pct“ “Number of swap

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-07-10 12:18  sailmcs-master\
     文件         255  2016-07-10 12:18  sailmcs-master\.gitmodules
     文件        1392  2016-07-10 12:18  sailmcs-master\CMakeLists.txt
     文件       35147  2016-07-10 12:18  sailmcs-master\COPYING.txt
     文件        2013  2016-07-10 12:18  sailmcs-master\README.md
     目录           0  2016-07-10 12:18  sailmcs-master\graphio\
     目录           0  2016-07-10 12:18  sailmcs-master\include\
     目录           0  2016-07-10 12:18  sailmcs-master\include\sailmcs\
     文件        1383  2016-07-10 12:18  sailmcs-master\include\sailmcs\Graph.hpp
     文件         234  2016-07-10 12:18  sailmcs-master\include\sailmcs\IAligner.hpp
     文件         664  2016-07-10 12:18  sailmcs-master\include\sailmcs\Runner.hpp
     文件        1002  2016-07-10 12:18  sailmcs-master\include\sailmcs\SailMCS.hpp
     文件         213  2016-07-10 12:18  sailmcs-master\include\sailmcs\SimilarityMatrix.hpp
     文件        2672  2016-07-10 12:18  sailmcs-master\include\sailmcs\Solution.hpp
     文件         832  2016-07-10 12:18  sailmcs-master\include\sailmcs\Verifier.hpp
     目录           0  2016-07-10 12:18  sailmcs-master\include\sailmcs\ils\
     文件        1164  2016-07-10 12:18  sailmcs-master\include\sailmcs\ils\ILS.hpp
     目录           0  2016-07-10 12:18  sailmcs-master\include\sailmcs\ils\perturbate\
     文件         437  2016-07-10 12:18  sailmcs-master\include\sailmcs\ils\perturbate\IPerturbator.hpp
     文件         976  2016-07-10 12:18  sailmcs-master\include\sailmcs\ils\perturbate\Pheromone.hpp
     文件         641  2016-07-10 12:18  sailmcs-master\include\sailmcs\ils\perturbate\Uniform.hpp
     目录           0  2016-07-10 12:18  sailmcs-master\include\sailmcs\ls\
     文件         291  2016-07-10 12:18  sailmcs-master\include\sailmcs\ls\Best.hpp
     文件        1755  2016-07-10 12:18  sailmcs-master\include\sailmcs\ls\Common.hpp
     文件         294  2016-07-10 12:18  sailmcs-master\include\sailmcs\ls\First.hpp
     文件         337  2016-07-10 12:18  sailmcs-master\include\sailmcs\ls\ILocalSearch.hpp
     文件         308  2016-07-10 12:18  sailmcs-master\include\sailmcs\ls\VertexBest.hpp
     目录           0  2016-07-10 12:18  sailmcs-master\include\sailmcs\sa\
     文件        1153  2016-07-10 12:18  sailmcs-master\include\sailmcs\sa\Adaptive.hpp
     文件         518  2016-07-10 12:18  sailmcs-master\include\sailmcs\sa\IAnnealingSchedule.hpp
     文件         992  2016-07-10 12:18  sailmcs-master\include\sailmcs\sa\Linear.hpp
............此处省略29个文件信息

评论

共有 条评论