Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ida_star_no_solution_example.cc File Reference

Reference example: IDA* on a DAG where no path to the goal exists. More...

#include <cstddef>
#include <iostream>
#include <limits>
#include <State_Search_IDA_Star.H>
Include dependency graph for ida_star_no_solution_example.cc:

Go to the source code of this file.

Classes

struct  NodeState
 
class  UnreachableGoalDomain
 
struct  UnreachableGoalDomain::Move
 
class  InadmissibleDomain
 
struct  InadmissibleDomain::Move
 

Functions

int main ()
 

Detailed Description

Reference example: IDA* on a DAG where no path to the goal exists.

This example demonstrates the behaviour of IDA* when the goal is completely unreachable. The search exhausts all reachable states and returns SearchStatus::Exhausted with found_solution() == false.

Graph (directed, acyclic):

0 ──► 1 ──► 2
(dead end)
Goal: node 9 (disconnected from the reachable component)

Because the graph is a DAG, IDA* terminates without any depth limit: once all paths from the root are exhausted, next_bound reaches numeric_limits<Distance>::max() and the engine reports Exhausted.

A second scenario below shows an inadmissible (over-estimating) heuristic on a reachable goal: IDA* still finds a solution, though not necessarily the optimal one.

Build and run:

  • cmake --build build --target ida_star_no_solution_example
  • ./build/Examples/ida_star_no_solution_example

Definition in file ida_star_no_solution_example.cc.

Function Documentation

◆ main()

int main ( )

Definition at line 201 of file ida_star_no_solution_example.cc.

References engine.