/usr/share/polymake/demo/polytope_semantics.ipynb is in polymake-common 3.2r2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | {
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Semantics of Cones and Polytopes\n",
"\n",
"### General Remarks\n",
"\n",
"The general semantics of a [ big object](https///polymake.org/doku.php/howto/lingo#big_object ) in polymake is as follows: a list of properties describes an equivalence class of mathematical objects. Often this equivalence class consists of a single element, but this is not necessary.\n",
"\n",
"As an example an object of class [Polytope](https///polymake.org/release_docs/latest/polytope.html#polytope__Polytope__9) defined by `VERTICES` gives such a single element equivalence class. A typical example of a class with several elements is a polytope given combinatorially, in terms of `VERTICES_IN_FACETS`. An extreme case would be a Polytope object defined by `VOLUME` only, defining the set of polytopes of all possible dimensions which happen to have that volume. While this is not very useful, a similar example would be a Polytope object defined by `F_VECTOR` only. From this it makes sense to derive, e.g., `N_VERTICES` or `H_VECTOR`.\n",
"\n",
"All big objects are immutable as mathematical objects. This means it is possible to add more properties, but only consistent ones. Ideally, these properties pre-exist (since they are logically derived from the input description of the object), and the rules only make them explicit. If a user asks for a property which cannot be derived, this property is set to `undef`. This occurs, e.g., if one asks for the `VERTICES` of a combinatorially defined polytope.\n",
"\n",
"To view the list properties that currently constitute your object, you can use the `properties` method.\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"$p = new Polytope(POINTS=>[[1,2],[1,3]]);"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"name: p\n",
"type: Polytope<Rational>\n",
" \n"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"$p->properties;"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
" POINTS\n",
" 1 2\n",
" 1 3\n",
" \n",
" \n",
" CONE_AMBIENT_DIM\n",
" 2\n",
"\n",
"\n",
"## Objects of type `Polytope`\n",
"\n",
"Polytope theory is nice because this is where combinatorics meets metric geometry. For mathematical software dealing with such objects it is necessary to get the semantics straight. Below we describe some pitfalls.\n",
"\n",
"### With coordinates: Geometry\n",
"\n",
"Being non-empty is recorded in the property `FEASIBLE`. This is `true` if and only if the polytope is not empty.\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1\n",
"\n"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print cube(3)->FEASIBLE;"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"A non-empty polytope in R^n is encoded as its homogenization in R^{n+1}. Hence, any non-empty polytope has at least one facet (which may be the far hyperplane [1,0,0,...,0]) and one vertex. \n",
"\n",
"\n",
"### Without coordinates: Combinatorics\n",
"\n",
"`VERTICES_IN_FACETS` always describes the combinatorics of a bounded polytope: this is any polytope which is projectively equivalent to the polyhedron defined by `VERTICES` or `POINTS` or dually modulo its `LINEALITY_SPACE`.\n",
"\n",
"Each property must clearly specify if it depends on the geometry or only on the combinatorics.\n",
"\n",
"### Special Cases\n",
"\n",
"Most of what comes below is a consequence of the design decisions explained above.\n",
"\n",
"#### Empty polytopes\n",
"\n",
"With the introduction of the `Cone` class and redefining `Polytope` as a derived class (in version 2.9.10) this raises the question of how to deal with empty polytopes.\n",
"This is a bit subtle as the cone over an empty polytope does not have a canonical definition. Most text books hence exclude this case. For them a polytope is never empty. There was a time when this was also polymake's point of view (until version 2.3).\n",
"\n",
"However, this was changed for the reason that often people generate systems of inequalities and then look at the feasible region. Most of the time they obtain a polytope and proceed, but sometimes it fails, and the region is empty. It is therefore necessary to give a definition of the empty polytope (geometrically) which is consistent:\n",
"\n",
"An empty polytope is recognized by `FEASIBLE == false`. Such a polytope is required to have `VERTICES` and `FACETS` empty.\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"$e = new Polytope(POINTS=>[]);\n",
"print $e->FEASIBLE;"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
" \n",
"\n"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print $e->FACETS;"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"This is totally different from having `VERTICES` or `FACETS` undefined (see above).\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
" polytope > print $nc->FACETS;\n",
"polymake: WARNING: available properties insufficient to compute 'FACETS'\n",
"\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"$nc = new Polytope(VERTICES_IN_FACETS => cube(2)->VERTICES_IN_FACETS);"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Zero-dimensional polytopes\n",
"\n",
"A zero-dimensional polytope is a single point. In our model it has one vertex and one facet (the far hyperplane).\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"$z = new Polytope(POINTS=>[[1,2,3]]);"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1 0 0\n",
"\n"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print $z->FACETS;"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"`VERTICES_IN_FACETS` is a 1-by-1 matrix with a zero entry. This means that the single vertex does *not* lie on the single facet.\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{}\n",
"\n"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print $z->VERTICES_IN_FACETS;"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"Such a polytope is both simple and simplicial, i.e. it is a simplex.\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1,1\n",
"\n"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print $z->SIMPLICIAL,\",\",$z->SIMPLE;"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"#### Zero-dimensional fans\n",
"\n",
"A zero-dimensional fan can e.g. be defined via\n",
"\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"$f = new fan::PolyhedralFan(RAYS=>[], MAXIMAL_CONES=>[[]]);"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"### Summing Up\n",
"\n",
"For instance we have four possibilities which can occur for `VERTICES`. The property\n",
"\n",
"* does not exist (it is not listed in `properties`): This basically means that the property is not derived/calculated, yet.\n",
"\n",
"* exists and is set to `undef`: Polymake is not able to derive this property with the given properties. The polytope may be empty or not.\n",
"\n",
"* exists and is empty: So the polytope is empty.\n",
"\n",
"* exists and is neither set to `undef` nor is empty: Our polytope is not empty and the property returns what you expect.\n",
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "polymake",
"language": "polymake",
"name": "polymake"
},
"language_info": {
"codemirror_mode": "perl",
"file_extension": ".pm",
"mimetype": "text/x-polymake",
"name": "polymake"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|