Commit a04eedcc by ZhiangWang033

add cost curve

parent cafbcdea
...@@ -60,16 +60,6 @@ cassert ...@@ -60,16 +60,6 @@ cassert
basic_object.h basic_object.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/basic_object.h /home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/basic_object.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/main.cpp
iostream
-
chrono
-
sstream
-
plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/net.h /home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/net.h
vector vector
- -
...@@ -134,72 +124,6 @@ grid.h ...@@ -134,72 +124,6 @@ grid.h
plc_object.h plc_object.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_object.h /home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_object.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist_cost.cpp
iostream
-
map
-
vector
-
string
-
fstream
-
iomanip
-
algorithm
-
cmath
-
numeric
-
plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist_fd_placer.cpp
iostream
-
map
-
vector
-
string
-
fstream
-
iomanip
-
algorithm
-
cmath
-
numeric
-
plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist_io.cpp
iostream
-
map
-
vector
-
string
-
fstream
-
iomanip
-
algorithm
-
cmath
-
numeric
-
plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist_sa.cpp /home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist_sa.cpp
iostream iostream
- -
...@@ -222,28 +146,6 @@ numeric ...@@ -222,28 +146,6 @@ numeric
plc_netlist.h plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist.h /home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_netlist.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_object.cpp
iostream
-
map
-
vector
-
string
-
fstream
-
iomanip
-
algorithm
-
cmath
-
numeric
-
plc_object.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_object.h
/home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_object.h /home/zf4_projects/macro_placer/TILOS_repo/new_repo/MacroPlacement/CodeElements/SimulatedAnnealing/src/plc_object.h
vector vector
- -
......
...@@ -453,6 +453,11 @@ void PBFNetlist::SimulatedAnnealing(std::vector<float> action_probs, ...@@ -453,6 +453,11 @@ void PBFNetlist::SimulatedAnnealing(std::vector<float> action_probs,
float cur_cost = 0.0; float cur_cost = 0.0;
std::vector<float> cost_list; // we need to plot the cost curve std::vector<float> cost_list; // we need to plot the cost curve
CallFDPlacer(); CallFDPlacer();
std::ofstream f;
f.open(summary_file);
f.close();
for (int num_iter = 0; num_iter < num_iters; num_iter++) { for (int num_iter = 0; num_iter < num_iters; num_iter++) {
// call FDPlacer to update the cost // call FDPlacer to update the cost
CallFDPlacer(); CallFDPlacer();
...@@ -472,13 +477,23 @@ void PBFNetlist::SimulatedAnnealing(std::vector<float> action_probs, ...@@ -472,13 +477,23 @@ void PBFNetlist::SimulatedAnnealing(std::vector<float> action_probs,
} }
cost_list.push_back(cur_cost); cost_list.push_back(cur_cost);
} }
if ((num_iter + 1) % 5 == 0) {
f.open(summary_file, std::ios::out | std::ios::app);
for (auto& value : cost_list)
f << value << std::endl;
f.close();
cost_list.clear();
}
// update the temperature // update the temperature
t = max_temperature * std::exp(t_factor * num_iter / num_iters); t = max_temperature * std::exp(t_factor * num_iter / num_iters);
} }
std::ofstream f; if (cost_list.size() > 0) {
f.open(summary_file); f.open(summary_file, std::ios::out | std::ios::app);
for (auto& value : cost_list) for (auto& value : cost_list)
f << value << std::endl; f << value << std::endl;
f.close(); f.close();
cost_list.clear();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment