Symphony 1.0
Loading...
Searching...
No Matches
Problem Class Referenceabstract

Represents an abstract problem that needs to be solved. More...

#include <definitions.h>

Inheritance diagram for Problem:
Collaboration diagram for Problem:

Public Member Functions

 Problem ()
 Constructor for the Problem class.
 
virtual ~Problem ()
 Virtual destructor for the Problem class.
 
virtual Stateinitial_state ()
 Retrieves the initial state of the problem.
 
virtual bool goal_test (State *state)=0
 Tests if a given state satisfies the goal condition.
 
virtual std::vector< std::shared_ptr< Action > > actions (std::shared_ptr< State > state)=0
 Retrieves the set of actions applicable to a given state.
 
virtual double heuristic (State *state)=0
 Computes a heuristic estimate for a given state.
 

Public Attributes

Stateinitial_state_
 Pointer to the initial state of the problem.
 

Detailed Description

Represents an abstract problem that needs to be solved.

This class defines the structure of a problem, including its initial state, goal test, actions, and heuristics. It should be extended by the user to implement specific problem-solving logic.

Definition at line 63 of file definitions.h.

Constructor & Destructor Documentation

◆ Problem()

Problem::Problem ( )
inline

Constructor for the Problem class.

Definition at line 68 of file definitions.h.

68{}

◆ ~Problem()

virtual Problem::~Problem ( )
inlinevirtual

Virtual destructor for the Problem class.

Definition at line 73 of file definitions.h.

73{}

Member Function Documentation

◆ actions()

virtual std::vector< std::shared_ptr< Action > > Problem::actions ( std::shared_ptr< State state)
pure virtual

Retrieves the set of actions applicable to a given state.

This method must be implemented by the user to define the available actions for a specific state.

Parameters
stateThe current state.
Returns
A vector of actions applicable to the given state.

Implemented in MazeProblem, StudyProblem, TaskScheduler, and VacuumCleaner.

Referenced by BreadthFirstSearch::search(), AStarSearch::search(), and BeamSearch::search().

◆ goal_test()

virtual bool Problem::goal_test ( State state)
pure virtual

Tests if a given state satisfies the goal condition.

This method must be implemented by the user to define the goal state criteria.

Parameters
stateThe state to test.
Returns
True if the state satisfies the goal condition, false otherwise.

Implemented in MazeProblem, StudyProblem, TaskScheduler, and VacuumCleaner.

Referenced by BreadthFirstSearch::search(), AStarSearch::search(), and BeamSearch::search().

◆ heuristic()

virtual double Problem::heuristic ( State state)
pure virtual

Computes a heuristic estimate for a given state.

This method must be implemented by the user to define a heuristic function for the problem.

Parameters
stateThe state for which to compute the heuristic.
Returns
A heuristic estimate of the cost to reach the goal from the given state.

Implemented in MazeProblem, StudyProblem, TaskScheduler, and VacuumCleaner.

Referenced by BreadthFirstSearch::search(), AStarSearch::search(), and BeamSearch::search().

◆ initial_state()

virtual State * Problem::initial_state ( )
inlinevirtual

Retrieves the initial state of the problem.

Returns
A pointer to the initial state.

Reimplemented in StudyProblem.

Definition at line 80 of file definitions.h.

80{ return initial_state_; }
State * initial_state_
Pointer to the initial state of the problem.

References initial_state_.

Referenced by BreadthFirstSearch::search(), AStarSearch::search(), and BeamSearch::search().

Member Data Documentation

◆ initial_state_

State* Problem::initial_state_

Pointer to the initial state of the problem.

Definition at line 113 of file definitions.h.

Referenced by initial_state(), MazeProblem::MazeProblem(), TaskScheduler::TaskScheduler(), and VacuumCleaner::VacuumCleaner().


The documentation for this class was generated from the following file: