AI-ExpertSystem-Advanced

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        Used when a fact is negative, aka, a fact doesn't happen.

    * FACT_SIGN_POSITIVE
        Used for those facts that happen.

    * FACT_SIGN_UNSURE
        Used when there's no straight answer of a fact, eg, we don't know if
        an answer will change the result.

Methods
  shoot($rule, $algorithm)
    Shoots the given rule. It will do the following verifications:

    *   Each of the facts (causes) will be compared against the
        initial_facts_dict, inference_facts and asked_facts (in this order).

    *   If any initial, inference or asked fact matches with a cause but
        it's negative then all of its goals (usually only one by rule) will
        be copied to the inference_facts with a negative sign, otherwise a
        positive sign will be used.

    *   Will add the rule to the shot_rules hash.

  is_rule_shot($rule)
    Verifies if the given $rule has been shot.

  get_goals_by_rule($rule)
    Will ask the knowledge_db for the goals of the given $rule.

    A AI::ExpertSystem::Advanced::Dictionary will be returned.

  get_causes_by_rule($rule)
    Will ask the knowledge_db for the causes of the given $rule.

    A AI::ExpertSystem::Advanced::Dictionary will be returned.

  is_fact_negative($dict_name, $fact)
    Will check if the given $fact of the given dictionary ($dict_name) is
    negative.

  copy_to_inference_facts($facts, $sign, $algorithm, $rule)
    Copies the given $facts (a dictionary, usually goal(s) of a rule) to the
    inference_facts dictionary. All the given goals will be copied with the
    given $sign.

    Additionally it will add the given $algorithm and $rule to the inference
    facts. So later we can know how we got to a certain inference fact.

  compare_causes_with_facts($rule)
    Compares the causes of the given $rule with:

    *   Initial facts

    *   Inference facts

    *   Asked facts

    It will be couting the matches of all of the above dictionaries, so for
    example if we have four causes, two make match with initial facts, other
    with inference and the remaining one with the asked facts, then it will
    evaluate to true since we have a match of the four causes.

  get_causes_match_factor($rule)
    Similar to compare_causes_with_facts() but with the difference that it
    will count the "match factor" of each matched cause and return the total
    of this weight.

    The match factor is used by the mixed() algorithm and is useful to know
    if a certain rule should be shoot or not even if not all of the causes
    exist in our facts.

    The *match factor* is calculated in two ways:

    *   Will do a sum of the weight for each matched cause. Please note that
        if only one cause of a rule has a specified weight then the
        remaining causes will default to the total weight minus 1 and then
        divided with the total number of causes (matched or not) that don't
        have a weight.

    *   If no weight is found with all the causes of the given rule, then
        the total number of matches will be divided by the total number of
        causes.

  is_goal_in_our_facts($goal)
    Checks if the given $goal is in:

    1   The initial facts

    2   The inference facts

    3   The asked facts

  remove_last_ivisited_rule()
    Removes the last visited rule and return its number.

  visit_rule($rule, $total_causes)
    Adds the given $rule to the end of the visited_rules.

  copy_to_goals_to_check($rule, $facts)
    Copies a list of facts (usually a list of causes of a rule) to
    goals_to_check_dict.

    The rule ID of the goals that are being copied is also stored in the
    hahs.

  ask_about($fact)
    Uses viewer to ask the user for the existence of the given $fact.

    The valid answers are:

    + or FACT_SIGN_POSITIVE
        In case user knows of it.

    - or FACT_SIGN_NEGATIVE
        In case user doesn't knows of it.

    ~ or FACT_SIGN_UNSURE
        In case user doesn't have any clue about the given fact.

  get_rule_by_goal($goal)
    Looks in the knowledge_db for the rule that has the given goal. If a



( run in 0.908 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )