Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port to gecode >=4.0 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
43 changes: 22 additions & 21 deletions ext/dep_gecode/dep_selector_to_gecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,30 +381,30 @@ void VersionProblem::Finalize()
DEBUG_STREAM.flush();
}
// This branching starts as far as possible from the solution, in order to exercise the optimization functions.
branch(*this, disabled_package_variables, INT_VAR_SIZE_MIN, INT_VAL_MAX);
branch(*this, package_versions, INT_VAR_SIZE_MIN, INT_VAL_MIN);
branch(*this, total_required_disabled, INT_VAL_MAX);
branch(*this, total_induced_disabled, INT_VAL_MAX);
branch(*this, total_suspicious_disabled, INT_VAL_MAX);
branch(*this, total_disabled, INT_VAL_MAX);
branch(*this, at_latest, INT_VAR_SIZE_MIN, INT_VAL_MIN);
branch(*this, total_preferred_at_latest, INT_VAL_MIN);
branch(*this, total_not_preferred_at_latest, INT_VAL_MIN);
branch(*this, disabled_package_variables, INT_VAR_SIZE_MIN(), INT_VAL_MAX());
branch(*this, package_versions, INT_VAR_SIZE_MIN(), INT_VAL_MIN());
branch(*this, total_required_disabled, INT_VAL_MAX());
branch(*this, total_induced_disabled, INT_VAL_MAX());
branch(*this, total_suspicious_disabled, INT_VAL_MAX());
branch(*this, total_disabled, INT_VAL_MAX());
branch(*this, at_latest, INT_VAR_SIZE_MIN(), INT_VAL_MIN());
branch(*this, total_preferred_at_latest, INT_VAL_MIN());
branch(*this, total_not_preferred_at_latest, INT_VAL_MIN());
#else // USE_DUMB_BRANCHING
if (debugLogging) {
DEBUG_STREAM << debugPrefix << " Adding branching (BEST)" << std::endl;
DEBUG_STREAM.flush();
}
// This branching is meant to start with most probable solution
branch(*this, disabled_package_variables, INT_VAR_SIZE_MIN, INT_VAL_MIN);
branch(*this, package_versions, INT_VAR_SIZE_MIN, INT_VAL_MAX);
branch(*this, total_required_disabled, INT_VAL_MIN);
branch(*this, total_induced_disabled, INT_VAL_MIN);
branch(*this, total_suspicious_disabled, INT_VAL_MIN);
branch(*this, total_disabled, INT_VAL_MIN);
branch(*this, at_latest, INT_VAR_SIZE_MIN, INT_VAL_MAX);
branch(*this, total_preferred_at_latest, INT_VAL_MAX);
branch(*this, total_not_preferred_at_latest, INT_VAL_MAX);
branch(*this, disabled_package_variables, INT_VAR_SIZE_MIN(), INT_VAL_MIN());
branch(*this, package_versions, INT_VAR_SIZE_MIN(), INT_VAL_MAX());
branch(*this, total_required_disabled, INT_VAL_MIN());
branch(*this, total_induced_disabled, INT_VAL_MIN());
branch(*this, total_suspicious_disabled, INT_VAL_MIN());
branch(*this, total_disabled, INT_VAL_MIN());
branch(*this, at_latest, INT_VAR_SIZE_MIN(), INT_VAL_MAX());
branch(*this, total_preferred_at_latest, INT_VAL_MAX());
branch(*this, total_not_preferred_at_latest, INT_VAL_MAX());
#endif // USE_DUMB_BRANCHING

if (debugLogging) {
Expand Down Expand Up @@ -612,7 +612,9 @@ VersionProblem * VersionProblem::InnerSolve(VersionProblem * problem, int &iterc
DEBUG_STREAM << "Creating solver" << std::endl << std::flush;
#endif
VersionProblem *best_solution = NULL;
Restart<VersionProblem> solver(problem);
Search::Options o;
o.cutoff = Search::Cutoff::geometric();
RBS<DFS,VersionProblem> solver(problem, o);

#ifdef MEMORY_DEBUG
DEBUG_STREAM << "Starting Solve" << std::endl << std::flush;
Expand All @@ -633,7 +635,7 @@ VersionProblem * VersionProblem::InnerSolve(VersionProblem * problem, int &iterc
DEBUG_STREAM << problem->debugPrefix << "Trial Solution #" << itercount << "===============================" << std::endl;
const Search::Statistics & stats = solver.statistics();
DEBUG_STREAM << problem->debugPrefix << "Solver stats: Prop:" << stats.propagate << " Fail:" << stats.fail << " Node:" << stats.node;
DEBUG_STREAM << " Depth:" << stats.depth << " memory:" << stats.memory << std::endl;
DEBUG_STREAM << " Depth:" << stats.depth << " memory:" << std::endl;
solution->Print(DEBUG_STREAM);
}
}
Expand All @@ -648,7 +650,6 @@ VersionProblem * VersionProblem::InnerSolve(VersionProblem * problem, int &iterc
std::cerr << "Time: " << elapsed_time << "ms ";
const Search::Statistics & final_stats = solver.statistics();
std::cerr << "Stats: " << itercount << " steps, ";
std::cerr << final_stats.memory << " bytes, ";
std::cerr << final_stats.propagate << " props, " << final_stats.node << " nodes, " << final_stats.depth << " depth ";
std::cerr << std::endl << std::flush;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/dep_gecode/dep_selector_to_gecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class Solver {
Solver(VersionProblem *s);
VersionProblem GetNextSolution();
private:
Restart<VersionProblem> solver;
RBS<DFS,VersionProblem> solver;
};

#endif // dep_selector_to_gecode_h