AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
probfd::CostFunction< typename, typename > Class Template Referenceabstract

#include "probfd/cost_function.h"

Description

template<typename, typename>
class probfd::CostFunction< typename, typename >

The interface specifying action and state termination costs, aswell as the goal states of a state space.

This interface communicates the action and termination costs and the goal states of a state space to the MDP algorithms. Users must implement the public methods get_termination_info(const State& state) and get_action_cost(const Action& action).

Example

class MaxProbCostFunction : public CostFunction<State, OperatorID>
{
protected:
TerminationInfo get_termination_info(const State& state) override
{
const bool is_goal = ...;
// Terminate with -1 in goal states, 0 otherwise.
return TerminationInfo(is_goal, is_goal ? -1.0_vt : 0.0_vt);
}
value_t get_action_cost(OperatorID) override
{
// Actions have no cost.
return 0;
}
};
The interface specifying action and state termination costs, aswell as the goal states of a state spa...
Definition fdr_types.h:14
virtual value_t get_action_cost(param_type< Action > action)=0
Gets the cost of an action.
virtual TerminationInfo get_termination_info(param_type< State > state)=0
Returns the cost to terminate in a given state and checks whether a state is a goal.
Specifies the termination cost and goal status of a state.
Definition cost_function.h:13
double value_t
Typedef for the state value type.
Definition aliases.h:7
Template Parameters
State- The state type of the underlying MDP model.
Action- The action type of the underlying MDP model.

Public Member Functions

virtual TerminationInfo get_termination_info (param_type< State > state)=0
 Returns the cost to terminate in a given state and checks whether a state is a goal.
 
virtual value_t get_action_cost (param_type< Action > action)=0
 Gets the cost of an action.
 

Member Function Documentation

◆ get_termination_info()

template<typename , typename >
virtual TerminationInfo probfd::CostFunction< typename, typename >::get_termination_info ( param_type< State > state)
pure virtual

Returns the cost to terminate in a given state and checks whether a state is a goal.

See also
TerminationInfo

Implemented in probfd::CompositeMDP< State, Action >, and probfd::SimpleMDP< State, Action >.

◆ get_action_cost()

template<typename , typename >
virtual value_t probfd::CostFunction< typename, typename >::get_action_cost ( param_type< Action > action)
pure virtual

Gets the cost of an action.

Implemented in probfd::CompositeMDP< State, Action >.