- Programming language: C++
- Metaheuristic algorithms: Simulated Annealing (SA), Tabu Search (TB)
- Benchmark function: Deception Problem
- Objective function: Maximize ( f(x) = |\text{b2b}(x) - 2^{bit - 2}| )
void RunALG(int bit, int run, int iter)
Runs SA algorithmvoid Init(vector<int>& sol, int& value)
Generates a random initial solutionvector<int> Neighbor(const vector<int>& sol)
Generates a neighbor by multi-bit mutationvoid Evaluation(const vector<int>& sol, int& value)
Evaluates the solution’s fitness valuevoid T_cooldown(double& temp)/void T_reheat(double& temp)
Controls the temperature schedulevoid Create_Vrecord(const string& filename, const vector<double>& content)
Outputs fitness values to a.txtfile
void RunALG(int bit, int run, int iter, int tabu_size, int tweak_num)
Runs Tabu Searchvector<int> Init()
Initializes a solution and sets initial bestvector<int> Tweak(const vector<int>& origin_sol)
Generatestweak_numtweaked neighborsint Evaluation(const vector<int>& sol)
Calculates the fitness of a solution for Deceptionvoid Create_Record(const string& filename, const vector<T>& content)
Outputs records to.txt, supports multiple data types via templates
- Bit Length:
bit = (4 or 10) - Number of Independent Runs:
run = (e.g., 30) - Number of Iterations per Run:
iter = (1000 for SA / 5000 for TB) pop_size = unused (placeholder)- Type of Algorithm:
algo_type = SA / TB - For Tabu Search:
- Size of Tabu List:
tabu_size = 5 - Times of Tweak:
tweak_num = 20
- Size of Tabu List:
values_of_run~30_SA_{bit}.txtvalues_average_SA_{bit}.txtplot_SA.pltresult_Deception_SimulatedAnnealing_{bit}.png
fitness_of_run_1~30_TB_bit_size_tweak.txtfitness_average_TB_bit_size_tweak.txtplot_TB.pltresult_Deception_TB_bit_size_tweak.png
- Open the solution
deception.sln - Press
Ctrl + F5to build
- Open CMD or PowerShell
- Navigate to the project folder
- Run:
g++ main.cpp deception.cpp SimulatedAnnealing.cpp Tabu.cpp -o deception.exe.\deception.exe bit run iter pop_size algo_typeExamples:
.\deception.exe 10 30 1000 1 SA
.\deception.exe 10 30 5000 0 TBThen:
Please type tabu_size = (your input)
Please type tweak_num = (your input)
- Install gnuplot
- Run:
gnuplot plot_SA.plt
gnuplot plot_TB.pltGenerated PNGs will be found in the working directory
deception/
|
├── main.cpp
├── deception.cpp / deception.h
├── SimulatedAnnealing.cpp / SimulatedAnnealing.h
├── Tabu.cpp / Tabu.h
│
├── results/ ← output files (.txt, .png)
└── README.md ← this file
- Simulated Annealing performs well in avoiding local optima by probabilistic acceptance of worse solutions.
- Tabu Search maintains a memory structure to avoid revisiting explored areas, which helps in escaping plateaus.
- Tabu Search is more sensitive to
tweak_numandtabu_sizeparameters. - Both algorithms are suitable for deception landscapes due to their non-greedy mechanisms.
- Objective function tailored for deceptive landscape
- C++ implementation with modular design
- Exportable logs and gnuplot-ready visualization scripts
- Interactive runtime configuration via command-line and user input
- Advanced metaheuristic algorithm implementation
- Custom fitness landscape evaluation (deception)
- Iterative local search (SA) and memory-based search (TB)
- Parameter-driven control of neighborhood exploration
- Integration with gnuplot for visual output
- Runtime I/O and template-based logging



