Code Monkey home page Code Monkey logo

metaheuristic's Introduction

metaheuristic

##Trajectory Algorithms:

###呼叫

MH::Trajectory::search(instance, algortihm, init_solution);

###建立Instance:

auto instance = MH::Trajectory::Instance<Encoding>();
  • Encoding是解編碼的類型。

###設定Instance:

  • instance.generationLimit : 搜尋代數限制。
  • 原型uint64_t generationLimit;
  • instance.neighborhood : 產生鄰域解的函式(neighbourhood generator)。
  • 原型std::vector<Encoding> (*neighbourhood)(Encoding &);
  • instance.evaluate : 計算解分數的函式(evaluator)。
  • 原型double (*evaluate)(Encoding &, void *inf);
  • instance.inf : 提供給evaluator的額外資訊
  • void *inf;
  • 請使用reinterpret_cast<void *>()轉型

###建立algorithm: II :

auto II = MH::Trajectory::II<SelectionStrategy>();

或使用別名MH::Trajectory::ItrativeImprovement

  • SelectionStrategy是II的選擇策略,提供兩種。
  • MH::Trajectory::II_BestImproving
  • MH::Trajecotry::II_FirstImproving

SA :

auto SA = MH::Trajectory::SA();

或使用別名MH::Trajectory::SimulatedAnnealing

TS :

auto SA = MH::Trajectory::TS<Encoding, TraitType>();

或使用別名MH::Trajectory::TabuSearch

  • Encoding是解編碼的型別。
  • TraitType是禁忌列表(tabu list)儲存的特徵型別。

###設定algorithm II : 無

SA :

  • SA.epoch_length : epoch長度。
  • uint64_t epoch_length;
  • SA.init_temperature : 初始溫度。
  • double init_temperature;
  • SA.cooling : 降溫函式。
  • double (*cooling)(double);

TS :

  • TS.length : 禁忌列表長度。
  • uint8_t length;
  • TS.trait : 特徵轉換函式。
  • TraitType (*trait)(Encoding&, void *);
  • 注意第二個參數為instance.inf

Evolutioanry Algorithms

###呼叫

MH::Evolutionary::evolution(instance, algorithm, init_solution)

###建立Instance

auto instance = MH::Evolutionary::Instance<Encoding>();
  • Encoding是解編碼的類型。

###設定Instance:

  • instance.generationLimit : 搜尋代數限制。
  • 原型uint64_t generationLimit;
  • instance.neighborhood : 產生鄰域解的函式(neighbourhood generator)。
  • 原型std::vector<Encoding> (*neighbourhood)(Encoding &);
  • instance.evaluate : 計算解分數的函式(evaluator)。
  • 原型double (*evaluate)(Encoding &, void *inf);
  • instance.inf : 提供給evaluator的額外資訊
  • void *inf;
  • 請使用reinterpret_cast<void *>()轉型

###建立algorithm: DE :

auto DE = MH::Evolutionary::DE<Selection, Crossover>();

或使用別名MH::Evolutionary::DifferentialEvolution

  • Selection是DE的選擇策略,提供四種。
  • MH::Evolutionary::DE_Random
  • MH::Evolutionary::DE_Best
  • MH::Evolutionary::DE_CurrentToRandom
  • MH::Evolutionary::DE_CurrentToBest
  • Crossover是DE的交配策略,提供兩種。
  • MH::Evolutionary::DE_Binomial
  • MH::Evolutionary::DE_Exponential

###設定algorithm DE :

  • DE.crossover_rate : 交配機率,必須介於區間(0, 1]。
  • double crossover_rate;
  • DE.current_factor : ToCurrent策略的縮放倍率。
  • 只有使用DE_CurrentToRandomDE_CurrentToBest才須設定。
  • double current_factor;
  • DE.scaling_factor : mutant vector的伸縮倍率。
  • double scaling_factor;
  • DE.num_of_diff_vectors : 產生的mutant vector數量。
  • uint8_t num_of_diff_vectors;

###其他 關於Encoding: 必須提供operator==()的重載版本。

metaheuristic's People

Contributors

jaidtw avatar aigecko avatar chungifei avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.