90 {
91 std::ifstream file(input);
92 std::string json_string;
93 std::string line;
94 while (std::getline(file, line)) {
95 json_string += line;
96 }
97
98 nlohmann::json json = nlohmann::json::parse(json_string);
99 std::map<std::string, double> mastery_levels = json["mastery_levels"];
100 std::map<std::string, std::vector<std::string>> dependencies = json["dependencies"];
101 std::map<std::string, double> synergies = json["synergies"];
102 double time = json["time"];
103
104
105 auto initial_state =
new StudyState(mastery_levels, time);
106 auto problem =
new StudyProblem(initial_state, dependencies, synergies);
108
109 if (solution) {
110 std::cout << "Optimal study plan:\n";
111 auto current = solution;
112 while (current) {
113 if (current->action) {
114 std::cout << "Study " << current->action->name << " for " << current->action->cost << " hours\n";
115 }
116 current = current->parent;
117 }
118 } else {
119 std::cout << "No solution found within the given time.\n";
120 }
121 delete problem;
122
123}
virtual std::shared_ptr< Node > search()=0
Search * create_search(SearchAlgorithmIndex search_algorithm_index, Problem *problem)
Factory method to create a search object based on the specified search algorithm.