00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _CSP_EXAMPLES_Solve_H
00025 #define _CSP_EXAMPLES_Solve_H
00026
00027
00028 #ifndef __cplusplus
00029 #error Must use C++ for Solve.h.
00030 #endif
00031
00032
00033 #include <vector>
00034 #include <string>
00035
00036
00037 std::wostream& printBackdoor(
00038 std::wostream& wos,
00039 const csp::Decomposition& decomposition);
00040 std::wostream& printBranchingAssignments(
00041 std::wostream& wos,
00042 const csp::Decomposition& decomposition);
00043 std::wostream& printLastPathSelections(
00044 std::wostream& wos,
00045 const csp::Decomposition& decomposition);
00046 std::wostream& printSolutionHeuristicMistakes(
00047 std::wostream& wos,
00048 const csp::Decomposition& decomposition);
00049 std::wostream& printNodes(
00050 std::wostream& wos,
00051 const csp::Decomposition& decomposition);
00052 std::wostream& printLeaves(
00053 std::wostream& wos,
00054 const csp::Decomposition& decomposition);
00055 std::wostream& printBacktracks(
00056 std::wostream& wos,
00057 const csp::Decomposition& decomposition);
00058
00059 bool registerProblemSpecificHeuristics(
00060 csp::Decomposition& decomposition,
00061 const std::wstring& name,
00062 const std::vector<std::pair<double, double> >& intervals,
00063 double quality);
00064
00065 csp::Problem* clone(const csp::Problem& problem);
00066
00067 void solubleProblemFFA(const csp::Decomposition& decomposition);
00068 void insolubleProblemFFA(const csp::Decomposition& decomposition);
00069
00070 bool problemIsWorthFFAing(bool hasSolutions);
00071
00072 typedef bool (*callback_type)(
00073 csp::Decomposition& decomposition,
00074 bool& countResources);
00075
00076 bool genericSolutionCallback(
00077 csp::Decomposition& decomposition,
00078 bool& countResources);
00079
00080 csp::Retraction* createRetraction(
00081 csp::Problem& problem,
00082 CommonOptions& options);
00083
00084 csp::Filter* createFilter(
00085 csp::Problem& problem,
00086 csp::Retraction& retraction,
00087 CommonOptions& options);
00088
00089 csp::Decomposition* createDecomposition(
00090 csp::Problem& problem,
00091 csp::Retraction& retraction,
00092 csp::Filter& filter,
00093 CommonOptions& options,
00094 int index = 0);
00095
00096 ulonglong regularSolver(
00097 CommonOptions& options,
00098 bool verbose,
00099 csp::Problem& problem,
00100 bool& timeLimitExceeded,
00101 bool& nodeLimitExceeded,
00102 callback_type solutionCallback = genericSolutionCallback,
00103 callback_type evaluationCallback = 0,
00104 callback_type refutationCallback = 0);
00105
00106 ulonglong driverSolver(
00107 CommonOptions& options,
00108 bool verbose,
00109 csp::Problem& problem,
00110 bool& timeLimitExceeded,
00111 bool& nodeLimitExceeded,
00112 callback_type solutionCallback = genericSolutionCallback);
00113
00114
00115 #endif // _CSP_EXAMPLES_Solve_H
00116
00117
00118
00119