50struct ArtificialTreeState
56struct ArtificialDecisionTreeDomain
63 using State = ArtificialTreeState;
65 size_t leaf_depth = 2;
67 bool is_goal(
const State &state)
const
69 return state.depth == leaf_depth
and (state.code == 5
or state.code == 6);
74 return state.depth == leaf_depth;
77 void apply(State &state,
const Move &move)
const
79 state.code = state.code*2 + (move.label ==
'R' ? 1u : 0u);
83 void undo(State &state,
const Move &move)
const
86 state.code = (state.code - (move.label ==
'R' ? 1u : 0u))/2;
89 template <
typename Visitor>
90 bool for_each_successor(
const State &state,
Visitor visit)
const
92 if (state.depth >= leaf_depth)
98 return visit(Move{
'R'});
105 for (
const auto &move : path)
114 ArtificialDecisionTreeDomain domain;
124 std::cout <<
"Visited states: " << result.stats.visited_states <<
'\n';
125 std::cout <<
"Expanded states: " << result.stats.expanded_states <<
'\n';
126 std::cout <<
"Solutions found: " << result.stats.solutions_found <<
'\n';
128 for (
auto it =
collector.solutions().get_it(); it.has_curr(); it.next_ne())
129 std::cout <<
"Solution path: " <<
path_signature(it.get_curr().path) <<
'\n';
Umbrella header for the implicit state-space search framework.
Recursive depth-first backtracking over an implicit state space.
Collector that stores accepted solutions in an Aleph list.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
std::string code(Node *root)
Compute a string with the Lukasiewicz`s word of a tree.
Exploration controls shared across engines.
bool stop_at_first_solution
Stop when the first goal is found.