Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions content/combinatorial/simulated-annealing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
template<class T, class repr>
struct simulated_annealing {
T val;
double get_time(){ return chrono::duration<double>(chrono::high_resolution_clock::now().time_since_epoch()).count(); }
double get_time(){
return chrono::duration<double>(
chrono::high_resolution_clock::now().time_since_epoch()
).count();
}
double P(double old_val, double new_val, double temp) { return exp(((old_val-new_val))/temp); }
simulated_annealing(double time_limit, double t_i, double t_f, repr & q){
q.init();
Expand All @@ -35,4 +39,4 @@ struct simulated_annealing {
}
}
}
};
};