Skip to content

tomyaacov/AI-exercise2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 

Repository files navigation

Introduction to Artificial Intelligence - Assignment 2

Avi Rosen 303079511
Tom Yaacov 305578239

The assignment is written in java as a maven project.

We used GraphStream open source package for graph representaion.

The heuristic functions we chose are:
Game type Heuristic Evaluation Function
Adversarial (zero sum) (SavedA + possibleSavedA/2) - (SavedB + possibleSavedB/2)
Semi-Cooperative (SavedA + possibleSavedA/2) ; (SavedA + possibleSavedA/2) (Sorting is made by first, ties breaken by second)
Fully Cooperative (SavedA + possibleSavedA/2) + (SavedB + possibleSavedB/2)

Rational:
In the adversarial game, each agent tries to maximize the difference between the people he saves and the people the other agent saves. Therefore the hueristic tries to estimate this difference.
In semi-cooperative game, each agent tries to maximize its own score. The agent disregards the other agent score, except that ties are broken cooperatively. Therefore the hueristic estimates the people each agent can save separately and the algorithm sorts by the agent's score first, while ties are breaken by the second agent estimation
In fully cooperative game, both agents aim to maximize the sum of their scores. Therefore the heuristic tries to estimate the sum of scores the 2 agents can save.
Example Scenario:

The following example illustrates a scenario where the optimal behavior differs for the 3 kinds of games:
Input File:
V 5 ; number of vertices n in config (from 1 to n)
E 1 2 W4 ; Edge from vertex 1 to vertex 2, weight 4
E 2 4 W1 ; Edge from vertex 2 to vertex 4, weight 1
E 4 3 W1 ; Edge from vertex 4 to vertex 3, weight 1
E 1 3 W1 ; Edge from vertex 1 to vertex 3, weight 1
E 1 5 W1 ; Edge from vertex 1 to vertex 5, weight 1

V 4 P 3 ; Vertex 4 initially contains 3 person to be rescued
V 1 S ; Vertex 1 contains a hurricane shelter
V 3 P 2 ; Vertex 3 initially contains 2 persons to be rescued
V 5 P 1 ; Vertex 5 initially contains 1 persons to be rescued

D 5 ; Deadline is at time 5

Additional Parameters:
K constant is 0
Cutoff value is 10
Agent 1 initial position is node 2
Agent 2 initial position is node 1

Adversarial (zero sum) output:

Agent 1 initial position is node 2
Agent 2 initial position is node 1

agent 1is in node 1; time is: 4.0; deadline: 5; agent have 0 people in vehicle
Operation failed - agent 2is in node 1; time is: 8.0; deadline: 5; agent have 0 people in vehicle
Simulation over. press to see agents scores

Agent 1 score is 0
Agent 2 score is 0

Semi-Cooperative output:

Agent 1 initial position is node 2
Agent 2 initial position is node 1

agent 1is in node 4; time is: 1.0; deadline: 5; agent have 3 people in vehicle
agent 2is in node 3; time is: 2.0; deadline: 5; agent have 2 people in vehicle
agent 1is in node 3; time is: 3.0; deadline: 5; agent have 3 people in vehicle
agent 2is in node 1; time is: 4.0; deadline: 5; agent have 0 people in vehicle
agent 1is in node 1; time is: 5.0; deadline: 5; agent have 0 people in vehicle
Simulation over. press to see agents scores

Agent 1 score is 3
Agent 2 score is 2

Fully Cooperative output:

Agent 1 initial position is node 2
Agent 2 initial position is node 1

agent 1is in node 4; time is: 1.0; deadline: 5; agent have 3 people in vehicle
agent 2is in node 5; time is: 2.0; deadline: 5; agent have 1 people in vehicle
agent 1is in node 3; time is: 3.0; deadline: 5; agent have 5 people in vehicle
agent 2is in node 1; time is: 4.0; deadline: 5; agent have 0 people in vehicle
agent 1is in node 1; time is: 5.0; deadline: 5; agent have 0 people in vehicle
Simulation over. press to see agents scores

Agent 1 score is 5
Agent 2 score is 1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages