experiment with solver errors

This commit is contained in:
Wolf Vollprecht 2021-11-29 19:22:45 +01:00
parent 7b51c6f899
commit 98d20749be
3 changed files with 35 additions and 0 deletions

View File

@ -53,6 +53,7 @@ namespace mamba
bool is_solved();
bool solve();
std::string problems_to_str();
std::string all_problems_to_str();
const std::vector<MatchSpec>& install_specs() const;
const std::vector<MatchSpec>& remove_specs() const;

View File

@ -354,6 +354,39 @@ namespace mamba
return success;
}
std::string MSolver::all_problems_to_str()
{
std::stringstream problems;
Queue problem_rules;
queue_init(&problem_rules);
Id count = solver_problem_count(m_solver);
for (Id i = 1; i <= count; ++i)
{
Id type, source, target, dep;
solver_findallproblemrules(m_solver, i, &problem_rules);
for (Id j = 0; j < problem_rules.count; ++j)
{
Id type, source, target, dep;
Id r = problem_rules.elements[j];
if (!r)
{
problems << "- [SKIP] no problem rule?\n";
}
else
{
type = solver_ruleinfo(m_solver, r, &source, &target, &dep);
problems << " - "
<< solver_problemruleinfo2str(
m_solver, (SolverRuleinfo) type, source, target, dep)
<< "\n";
}
}
}
queue_free(&problem_rules);
return problems.str();
}
std::string MSolver::problems_to_str()
{
Queue problem_queue;

View File

@ -103,6 +103,7 @@ PYBIND11_MODULE(bindings, m)
.def("set_postsolve_flags", &MSolver::set_postsolve_flags)
.def("is_solved", &MSolver::is_solved)
.def("problems_to_str", &MSolver::problems_to_str)
.def("all_problems_to_str", &MSolver::all_problems_to_str)
.def("solve", &MSolver::solve);
py::class_<History>(m, "History")