perkun  0.0.9
ExperimentalAIlanguage
Public Member Functions | Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
perkun::optimizer_with_all_data Class Reference

#include <perkun.h>

Inheritance diagram for perkun::optimizer_with_all_data:
perkun::optimizer perkun::action_iteration_controller perkun::class_with_tracking perkun::dump_controller

Public Member Functions

void declare_values ()
 
void declare_variables_values ()
 
void add_value (const char *s)
 
void create_input_variable (const char *s)
 
void create_hidden_variable (const char *s)
 
void create_output_variable (const char *s)
 
void make_model ()
 
void test_model () const
 
void clear_query ()
 
void assert_query_fact (const char *v, const char *val)
 
int parse (const char *filename)
 
virtual void set_apriori_belief (belief *b) const
 
virtual void print_initial_loop_message () const
 
virtual void print_current_belief ()
 
virtual void get_input (std::map< variable *, value * > &m, bool &eof)
 
virtual void execute (const action *a)
 
- Public Member Functions inherited from perkun::optimizer
 optimizer (collection_of_variables &v, collection_of_values &w, collection_of_visible_states &vs, collection_of_actions &a)
 
float get_consequence_probability (const belief &b1, const action &a, const visible_state &vs) const
 
void populate_belief_for_consequence (const belief &b1, const action &a, const visible_state &vs, belief &target) const
 
const actionget_optimal_action (const belief &b, int n)
 
- Public Member Functions inherited from perkun::class_with_tracking
virtual void dump_stack (std::ostream &s) const
 
virtual void dump_stack_XML (std::ostream &s) const
 
virtual void dump_iteration_report (std::ostream &s) const
 
virtual void dump_iteration_report_XML (std::ostream &s) const
 
- Public Member Functions inherited from perkun::dump_controller
void set_min_report_depth (int d)
 
void set_max_report_depth (int d)
 

Public Attributes

collection_of_values w
 
collection_of_variables v
 
collection_of_actions a
 
collection_of_visible_states vs
 
variablee
 
std::map< variable *, value * > q
 
std::map< variable *, value * > initial_state_query
 
std::map< variable *, value * > action_query
 
beliefcurrent_belief
 
beliefformer_belief
 
const actionformer_action
 
std::list< variable * > list_of_input_variables
 

Protected Member Functions

virtual void dump_belief (std::ostream &s) const
 
virtual void dump_belief_XML (std::ostream &s) const
 
- Protected Member Functions inherited from perkun::optimizer
virtual void on_error_in_populate_belief_for_consequence (const belief &b1, const action &a, const visible_state &vs, belief &target) const
 
- Protected Member Functions inherited from perkun::action_iteration_controller
virtual std::list< action * >::const_iterator get_action_iteration_begin ()
 
virtual void action_iteration_increment (std::list< action * >::const_iterator &target)
 
virtual bool get_action_iteration_terminated (const std::list< action * >::const_iterator &i)
 
 action_iteration_controller (collection_of_actions &a)
 
- Protected Member Functions inherited from perkun::class_with_tracking
virtual decision make_decision (const std::list< tracker * > &s)
 
- Protected Member Functions inherited from perkun::dump_controller
virtual std::string get_stack_file_prefix () const
 
virtual std::string get_iteration_report_file_prefix () const
 
virtual std::string get_belief_file_prefix () const
 
void dump_stack_to_target_stream ()
 
void dump_belief_to_target_stream ()
 
void dump_iteration_report_to_target_stream ()
 

Private Types

enum  mode_type { NONE, DECLARING_VALUES, DECLARING_VARIABLES_VALUES }
 

Private Member Functions

variableget_variable (const char *v)
 
valueget_value (const char *v)
 
bool get_special_command (const char *buffer) const
 
void execute_special_command (const char *buffer)
 
void explain () const
 
void verbose ()
 

Private Attributes

enum perkun::optimizer_with_all_data::mode_type mode
 

Additional Inherited Members

- Protected Types inherited from perkun::class_with_tracking
enum  decision { BREAK, CONTINUE, NONE }
 
- Protected Types inherited from perkun::dump_controller
enum  target_type { COUT = 0x1, CERR = 0x2, SINGLE_FILE = 0x4, ITERATED_FILES = 0x8 }
 
enum  dump_stack_mode_type { dump_stack_as_XML, dump_stack_as_text }
 
enum  dump_belief_mode_type { dump_belief_as_XML, dump_belief_as_text }
 
enum  dump_iteration_report_mode_type { dump_iteration_report_as_XML, dump_iteration_report_as_text }
 
- Protected Attributes inherited from perkun::optimizer
bool verbose_flag
 
- Protected Attributes inherited from perkun::action_iteration_controller
collection_of_actionsmy_actions
 
- Protected Attributes inherited from perkun::class_with_tracking
std::list< tracker * > stack_of_trackers
 
- Protected Attributes inherited from perkun::dump_controller
dump_stack_mode_type dump_stack_mode
 
dump_belief_mode_type dump_belief_mode
 
dump_iteration_report_mode_type dump_iteration_report_mode
 
target_type dump_stack_target
 
target_type dump_belief_target
 
target_type dump_iteration_report_target
 
int min_report_depth
 
int max_report_depth
 
int stack_file_counter
 
int belief_file_counter
 
int iteration_report_file_counter
 

Detailed Description

This is an optimizer containing all the collections internally. In addition it has some methods used by the parser to configure it.

Since the version 0.0.3 perkun is a library, this is the main class to inherit from. The virtual functions can be redefined to control the input and optimal action execution.

You can either use a Perkun code with a "loop" command, then you will probably want to fork and inherit this class with redefinition of the functions "get_input" and "execute". Then you may use the pipes to write/read the data to/from perkun.

Otherwise you may just parse a Perkun code without a "loop" command and implement something similar after the Perkun code is parsed. See the file perkun_c.cc, function perkun_loop to understand the algorithm. The optimizer_with_all_data will contain all the values, variables, actions and visible states after the parse function returns (provided it was succesfull).

Otherwise you may ignore the parser completely and instantiate your own optimizer. It requires the instances of the following collections: values, variables, actions and visible states. All of them need to be configured directly using methods (but then you can forget the Perkun parser).

Member Enumeration Documentation

Mode to distinguish values list from variable values list, parsing time.

Member Function Documentation

void optimizer_with_all_data::execute ( const action a)
virtual

This function executes the current action.

void optimizer_with_all_data::get_input ( std::map< variable *, value * > &  m,
bool &  eof 
)
virtual

This function fills the map m with the pairs (variable,value) corresponding with the input variable values. The flag eof can be optionally set to mark the end of file.

void optimizer_with_all_data::set_apriori_belief ( belief b) const
virtual

This function can be redefined in order to provide a-priori belief. In the redefined version please take into account the visible state of the belief.


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