📄 solutionea.h
字号:
#ifndef SOLUTIONEA_H#define SOLUTIONEA_H#include <vector>#include "Solution.h"#include "Problem.h"#include "Control.h"#include "Random.h"/*SolutionEA.hThe class SolutionEA is a derived class of Solution implemeting a solution in the VRPSD with the preventive restocking policy.It contains permutation based crossover and mutation methods, some based on the PGA code by Peter Ross and Emma Hart, for a simple evolutionary algorithm.*/class SolutionEA : public Solution { //A solution used for the evolutionary algorithm is actually a solution for //the VRPSD with pre-emptive restocking. //In addition it contains crossover and mutation methods used by the EA.public: SolutionEA( Random* rnd, Control& control, Problem* ); void no_crossover(SolutionEA* parent1, SolutionEA* parent2); void pmx_crossover(SolutionEA* parent1, SolutionEA* parent2); void ox_crossover(SolutionEA* parent1, SolutionEA* parent2); void edge_crossover(SolutionEA* parent1, SolutionEA* parent2); void inverover(SolutionEA* pop, int popSize); void swap_mute(double rate); void obm_mute(double rate); void inversion(double rate);protected: int addToList(int* adj_list, int len, int val); void removeFromList(int* adj_list, int len, int val);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -