Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
tutorial:optimization [2017/07/29 08:40] – [Input: lp2poly] saved file oroehrig | user_guide:tutorials:optimization [2019/01/25 10:56] – ↷ Links adapted because of a move operation oroehrig | ||
---|---|---|---|
Line 11: | Line 11: | ||
There are several other tutorials that cover similar topics: | There are several other tutorials that cover similar topics: | ||
- | * [[tutorial: | + | * [[user_guide: |
- | * [[tutorial: | + | * [[user_guide: |
- | * [[tutorial: | + | * [[user_guide: |
- | * [[tutorial: | + | * [[user_guide: |
This tutorial is targeted towards the optimization community, since, surprisingly, | This tutorial is targeted towards the optimization community, since, surprisingly, | ||
+ | You can find files of the example LPs in the folder '' | ||
===== Input: lp2poly ===== | ===== Input: lp2poly ===== | ||
Line 35: | Line 36: | ||
</ | </ | ||
- | Thus, the file describes a 0/1-cube in three dimensions. It should be easy to adapt this format to other cases (If for example '' | + | Thus, the file describes a 0/1-cube in three dimensions. It should be easy to adapt this format to other cases (If for example '' |
- | + | ||
- | Let us, for the sake of the example, save this in the file '' | + | |
- | < | + | |
- | > open(my $f, '> c3t.lp' | + | |
- | > Subject to\n C1: x1 + x2 + x3 <= 2 | + | |
- | > Bounds\n 0 <= x1 <= 1\n 0 <= x2 <= 1\n 0 <= x3 <= 1 | + | |
- | > End"; close $f; | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | + | ||
- | We create a polytope from the file via: | + | |
< | < | ||
- | polytope > $f=lp2poly(' | + | polytope > $f=lp2poly(' |
</ | </ | ||
The polytope '' | The polytope '' | ||
Line 99: | Line 88: | ||
polytope > $p-> | polytope > $p-> | ||
</ | </ | ||
- | {{ :tutorial: | + | {{ user_guide: |
The minimal and maximal faces can be visualized via | The minimal and maximal faces can be visualized via | ||
Line 105: | Line 94: | ||
polytope > $p-> | polytope > $p-> | ||
</ | </ | ||
- | {{ :tutorial: | + | {{ user_guide: |
Line 144: | Line 133: | ||
We assume that the above information is contained in the file '' | We assume that the above information is contained in the file '' | ||
< | < | ||
- | polytope > $f=lp2poly(' | + | polytope > $f=lp2poly(' |
polytope > $p = new Polytope< | polytope > $p = new Polytope< | ||
</ | </ | ||
Line 204: | Line 193: | ||
End | End | ||
</ | </ | ||
- | {{ :tutorial: | + | {{ user_guide: |
We now assume that the example is contained in the file '' | We now assume that the example is contained in the file '' | ||
< | < | ||
- | polytope > $f = lp2poly(' | + | polytope > $f = lp2poly(' |
polytope > $pin = new Polytope< | polytope > $pin = new Polytope< | ||
</ | </ | ||
Line 273: | Line 262: | ||
</ | </ | ||
- | {{ :tutorial: | + | {{ user_guide: |
Note that the upper right part (including the red vertices) arises from truncation of the polyhedron for visualization. | Note that the upper right part (including the red vertices) arises from truncation of the polyhedron for visualization. | ||
Line 302: | Line 291: | ||
In this example there are two integral variables '' | In this example there are two integral variables '' | ||
< | < | ||
- | polytope > $m=lp2poly(' | + | polytope > $m=lp2poly(' |
polytope > $p = new Polytope< | polytope > $p = new Polytope< | ||
</ | </ | ||
Line 322: | Line 311: | ||
===== Integral Polytopes and Total Unimodularity ===== | ===== Integral Polytopes and Total Unimodularity ===== | ||
- | As explained in the previous example, the integral points in a polytope are of particular interest in discrete optimization. These points are called //lattice points// in polymake and the corresponding convex hull //lattice polytope//. The handling of such polytopes is explained in more detail in the [[tutorial: | + | As explained in the previous example, the integral points in a polytope are of particular interest in discrete optimization. These points are called //lattice points// in polymake and the corresponding convex hull //lattice polytope//. The handling of such polytopes is explained in more detail in the [[user_guide: |
Of particular interest for discrete optimization are properties of the orginal inequality system to define a lattice polytope, i.e., a polytope such that all of its vertices are integral (this can be tested by checking the property '' | Of particular interest for discrete optimization are properties of the orginal inequality system to define a lattice polytope, i.e., a polytope such that all of its vertices are integral (this can be tested by checking the property '' | ||
Line 345: | Line 334: | ||
In the second example, we reuse the file '' | In the second example, we reuse the file '' | ||
< | < | ||
- | polytope > $f=lp2poly(' | + | polytope > $f=lp2poly(' |
polytope > $p = new Polytope< | polytope > $p = new Polytope< | ||
</ | </ | ||
Line 389: | Line 378: | ||
Let us test whether the inequality system of this example is TDI. Thus, we first load the data as usual: | Let us test whether the inequality system of this example is TDI. Thus, we first load the data as usual: | ||
< | < | ||
- | polytope > $f = lp2poly(' | + | polytope > $f = lp2poly(' |
polytope > $p = new Polytope< | polytope > $p = new Polytope< | ||
</ | </ | ||
Line 453: | Line 442: | ||
As before we read in the file using '' | As before we read in the file using '' | ||
< | < | ||
- | polytope > $f = lp2poly(' | + | polytope > $f = lp2poly(' |
polytope > $p = new Polytope< | polytope > $p = new Polytope< | ||
</ | </ |