GithubHelp home page GithubHelp logo

lina994 / ai_ass4 Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 82 KB

Probabilistic reasoning using Bayes networks, with scenarios similar to the hurricane evacuation problem environment. Introduction to Artificial Intelligence 2019 Ben-Gurion University.

Java 100.00%

ai_ass4's Introduction

Hurricane Evacuation Problem: Locate the Blockages and Evacuees

Probabilistic reasoning using Bayes networks, with scenarios similar to the hurricane evacuation problem environment of assignment 1.

Using the following principles:

  • Artificial Intelligence:
    • Reasoning under uncertainty
    • Bayesian Networks
    • Enumeration (Enumeration Ask and Enumerate All)
    • Probability Reasoning
  • Topological sort
  • OOP, Files I/O

Domain Description

  • Binary-valued occupation of vertices (contains people to be evacuated, or not).

  • Binary random variable Fl(v) standing in for "flooding" at vertex v.

  • Binary random variable Ev(v) standing in for "people to evacuate" at each vertex v.

  • Binary variable B(e) standing in for "blocked" for each edge e.

  • The flooding events are assumed independent, with known distributions.

  • The blockages are noisy-or distributed given the flooding at incident vertices, with

    • pi = (1 - qi) = 0.6 * 1/w(e).
  • There are people at vertex v, with noisy or distributions given all the edge blockages at all edges incident on v, with:

    • pi = (1 - qi) = 0.8 for an edge with weight greater then 4.
    • pi = (1 - qi) = 0.4 for shorter edges.
  • All noisy-or node have a leakage probability of 0.001, that is, they are true with probability 0.001 when all the causes are inactive.

types of BN nodes

  • Blockages (one for each edge).
  • Flooding (one for each vertex).
  • Evacuees present (one for each vertex).

Running

Input

file.txt file include graph description and parameters such as P(Fl(v)=true)) For example:

#T 4           ; number of vertices n in graph (from 1 to n)
#V 1 F 0.2     ; Vertex 1, probability flooding 0.2
#V 2 F 0.4     ; Vertex 2, probability flooding 0.4
#E1 1 2 W1     ; Edge1 between vertices 1 and 2, weight 1
#E2 2 3 W3     ; Edge2 between vertices 2 and 3, weight 3
#E3 3 4 W3     ; Edge3 between vertices 3 and 4, weight 3
#E4 2 4 W4     ; Edge4 between vertices 2 and 4, weight 4

Graph visualization

graph

We will get the following Bayesian network:

graph


Additional input will be provided by the user via the terminal:

  • Locations where flooding, blockages, or evacuees are reported either present or absent.
  • Reset evidence list to empty.

Once evidence is instantiated, you can perform reasoning about:

  • Probability that each of the vertices contains evacuees.
  • Probability that each of the vertices is flooded.
  • Probability that each of the edges is blocked.
  • Probability that a certain path is free from blockages.
  • Path from a given location to a goal that has the highest probability of being free from blockages.

For example:

Please enter an action:
'e' for adding edge evidence
'v' for adding vertex evidence
'q' for quit
'pr' for Probability Reasoning
'reset' for reset evidence list
'printEv' for printing the evidence list
> v
Please enter vertex number (starting from 1)
> 1
Please enter the number of the report:
1 - Flooding
2 - no Flooding
3 - Evacuees
4 - no Evacuees
> 1
Please enter an action:
'e' for adding edge evidence
'v' for adding vertex evidence
'q' for quit
'pr' for Probability Reasoning
'reset' for reset evidence list
'printEv' for printing the evidence list
> pr
Please enter an action:
1 for print probability for each of the vertices (enumeration)
2 for print posterior probabilities for each of the vertices ()
3 for print probability of path
4 for print path with highest probability
> 1
...
Please enter an action:
'e' for adding edge evidence
'v' for adding vertex evidence
'q' for quit
'pr' for Probability Reasoning
'reset' for reset evidence list
'printEv' for printing the evidence list
> q

Output

  • Detailed output will be displayed in the terminal
  • A summary will be saved in the results.txt file

Authors

Official assignment description

assignment 4

ai_ass4's People

Contributors

lina994 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.