You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/5.7 MB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[91m━━━━\u001b[0m\u001b[90m╺\u001b[0m\u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.6/5.7 MB\u001b[0m \u001b[31m17.4 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[90m╺\u001b[0m\u001b[90m━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.4/5.7 MB\u001b[0m \u001b[31m49.4 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m \u001b[32m5.7/5.7 MB\u001b[0m \u001b[31m64.2 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.7/5.7 MB\u001b[0m \u001b[31m47.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
40
+
"\u001b[?25hUsing default Community Edition License for Colab. Get yours at: https://ampl.com/ce\n",
41
+
"Licensed to AMPL Community Edition License for the AMPL Model Colaboratory (https://ampl.com/colab).\n"
42
+
]
43
+
}
44
+
],
29
45
"source": [
30
46
"# Install AMPL and solvers\n",
31
47
"%pip install -q amplpy pandas numpy scipy\n",
@@ -45,7 +61,8 @@
45
61
"execution_count": 2,
46
62
"id": "b13edf26",
47
63
"metadata": {
48
-
"tags": []
64
+
"tags": [],
65
+
"id": "b13edf26"
49
66
},
50
67
"outputs": [],
51
68
"source": [
@@ -59,18 +76,19 @@
59
76
"id": "a82bd88d-7b16-4c82-b0b7-5dbd0d81b71c",
60
77
"metadata": {
61
78
"jp-MarkdownHeadingCollapsed": true,
62
-
"tags": []
79
+
"tags": [],
80
+
"id": "a82bd88d-7b16-4c82-b0b7-5dbd0d81b71c"
63
81
},
64
82
"source": [
65
83
"We consider here another variant of the Markowitz portfolio optimization problem, which we already encountered in the context of convex optimization [here](../05/markowitz_portfolio.ipynb) and in the context of conic optimization [here](../06/markowitz_portfolio_revisited.ipynb).\n",
66
84
"\n",
67
85
"Assuming there is an initial unit capital $C$ that needs to be invested in a selection of $n$ possible assets, each of them with a unknown return rate $r_i$, $i=1,\\dots,n$. Let $x$ be the vector whose $i$-th component $x_i$ describes the fraction of the capital invested in asset $i$. The return rate vector $r$ can be modelled by a multivariate Gaussian distribution with mean $\\mu$ and covariance $\\Sigma$. Assume there is also a risk-free asset with guaranteed return rate $R$ and let $\\tilde{x}$ the amount invested in that asset. We want to determine the portfolio that maximizes the _expected_ return $\\mathbb{E} ( R \\tilde{x} + r^\\top x )$, which in view of our assumptions rewrites as $ \\mathbb{E} ( R \\tilde{x} + r^\\top x ) = R \\tilde{x} + \\mu^\\top x$.\n",
68
86
"\n",
69
-
"Additionally, we includ a _loss risk chance constraint_ of the form\n",
87
+
"Additionally, we includ a _loss risk chance constraint_ of the form\n",
70
88
"\n",
71
89
"$$\n",
72
90
"\\mathbb{P} ( r^\\top x \\leq \\alpha) \\leq \\beta.\n",
73
-
"$$\n",
91
+
"$$\n",
74
92
"\n",
75
93
"Thanks to the assumption that $r$ is multivariate Gaussian, this chance constraint can be equivalently rewritten as\n",
76
94
"\n",
@@ -97,7 +115,9 @@
97
115
"cell_type": "code",
98
116
"execution_count": 3,
99
117
"id": "1e9ef269",
100
-
"metadata": {},
118
+
"metadata": {
119
+
"id": "1e9ef269"
120
+
},
101
121
"outputs": [],
102
122
"source": [
103
123
"# we import the inverse CDF or quantile function for the standard normal norm.ppf() from scipy.stats\n",
0 commit comments