Skip to content

Instantly share code, notes, and snippets.

@mayt1992
Created May 17, 2017 15:23
Show Gist options
  • Save mayt1992/6e361c5d63854c49e093fc79d8f0b5f5 to your computer and use it in GitHub Desktop.
Save mayt1992/6e361c5d63854c49e093fc79d8f0b5f5 to your computer and use it in GitHub Desktop.
port_risk.ahp for R
Version: 2.0
Alternatives: &alternatives
Port 1:
Port 2:
Goal:
name: Port Risk
description: >
Evaluate Port Risk in the perspective of “the Belt and Road” Initiative.
preferences:
pairwise:
- [Political, Economic, 1/5]
- [Political, Social, 3]
- [Political, Technological, 1/3]
- [Political, Environmental, 5]
- [Political, Legal, 5]
- [Economic, Social, 7]
- [Economic, Technological, 7]
- [Economic, Environmental, 7]
- [Economic, Legal, 1/5]
- [Social, Technological, 1/3]
- [Social, Environmental, 3]
- [Social, Legal, 1/5]
- [Technological, Environmental, 3]
- [Technological, Legal, 1/5]
- [Environmental, Legal, 1/3]
children:
Political:
preferences:
pairwise:
- [Degree of Democracy, Political Stability, 2]
- [Degree of Democracy, Tariffs, 5]
- [Political Stability, Tariffs, 3]
children:
Degree of Democracy:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Political Stability:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Tariffs:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Economics:
preferences:
pairwise:
- [GDP Growth Rate, Openness, 2]
- [GDP Growth Rate, Income Inequality, 5]
- [GDP Growth Rate, Unemployment Rate, 3]
- [Openness, Income Inequality, 3]
- [Openness, Unemployment Rate, 3]
- [Income Inequality, Unemployment Rate, 3]
children:
GDP Growth Rate:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Openness:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Income Inequality:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Unemployment Rate:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Social:
preferences:
pairwise:
- [Incidents of Piracy and Armed Robbery, Education Level, 2]
- [Incidents of Piracy and Armed Robbery, Disease Rate, 5]
- [Incidents of Piracy and Armed Robbery, Control of Corruption, 3]
- [Incidents of Piracy and Armed Robbery, Ethnic Diversity, 3]
- [Education Level, Disease Rate, 3]
- [Education Level, Control of Corruption, 3]
- [Education Level, Ethnic Diversity, 3]
- [Disease Rate, Control of Corruption, 3]
- [Disease Rate, Ethnic Diversity, 3]
- [Control of Corruption, Ethnic Diversity, 3]
children:
Incidents of Piracy and Armed Robbery:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Education Level:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Disease Rate:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Control of Corruption:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Ethnic Diversity:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Technological:
preferences:
pairwise:
- [R&D Activity, Potential Innovation, 2]
children:
R&D Activity:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Potential Innovation:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Environmental:
preferences:
pairwise:
- [Natural Disaster, Structural Constrains, 1/3]
children:
Natural Disaster:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Structural Constrains:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
Legal:
children:
Rule of Law:
preference:
score:
- Port 1: 1
- Port 1: 2
children: *alternatives
> library(ahp)
> ahpFile <- system.file("extdata", "port_risk.ahp", package="ahp")
> port_riskAhp <- Load(ahpFile)
> library(data.tree)
> print(port_riskAhp, filterFun = isNotLeaf)
> Visualize(port_riskAhp)
> Calculate(port_riskAhp)
> print(port_riskAhp, priority = function(x) x$parent$priority["Total", x$name])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment