-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (27 loc) · 1.04 KB
/
main.cpp
File metadata and controls
32 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "experiment.h"
#include "config.h"
#include "json.hpp"
#include <iostream>
#include <fstream>
#include <iomanip>
int main() {
const std::string config_filename = "config.json";
Config config;
std::ifstream config_file(config_filename);
if (config_file.is_open()) {
std::cout << "📄 Loading configuration from " << config_filename << "...\n";
json j;
config_file >> j;
config = Config::from_json(j);
} else {
std::cout << "⚠️ " << config_filename << " not found. Creating a default config file.\n";
std::ofstream out_config_file(config_filename);
out_config_file << std::setw(4) << config.to_json() << std::endl;
}
Experiment experiment(config);
experiment.run();
std::cout << "\nSimulation finished. Data saved to 'simulation_log.csv'.\n";
std::cout << "You can now analyze this file, for example, using Python with pandas and matplotlib.\n";
std::cout << "To change parameters, edit '" << config_filename << "' and run again.\n";
return 0;
}