This program finds the optimal path of a graph.
It also calculates the path that a person will get, influenced by the present bias (Behavioral Economics).
Suppose we have a graph beginning with s and ending with t.
The available paths from point s to point t are as follows:
- s-a-b-t at a cost of 16+2+2 = 20
- s-c-d-t at a cost of 8+8+8 = 24
- s-c-e-t at a cost of 8+2+16 = 26
The person who is influenced by the present bias, when he is in a node, estimates the cost of the nodes adjacent to the node with a cost degraded by a factor of b<1 and so the cost is:
With b=1/2 the person will take:
-
At the beginning of the node you calculate the cost of the paths:
- s-a-b-t at a cost of 16+(1/2)*2+(1/2)*2 = 20
- s-c-d-t at a cost of 8+(1/2)*8+(1/2)*8 = 24
- s-c-e-t at a cost of 8+(1/2)*2+(1/2)*16 = 26
and selects the node c
-
Starting from node c, calculates:
- c-d-t at a cost of 8+(1/2)*8 = 12
- c-e-t at a cost of 2+(1/2)*16 = 10
and selects the node e
Based on factor b the person will choose s-c-e-t at a cost of 26.
The purpose of the program is, given a graph and a parameter b, to calculate the optimal path and path that a person will be affected by present bias. Parameter b is referred to present bias, and b<1.
The process of executing the program is:
- Clone the repository
- cd
../assignment-2018-1
- Type
python present_bias.py <input_file> <bias_parameter> <start_node> <end_node>