Changes between Initial Version and Version 1 of Ticket #24837


Ignore:
Timestamp:
02/28/18 10:49:45 (4 years ago)
Author:
jipilab
Comment:

Once the tutorial is merged in #22572, we should change the "tips" page accordingly...


New commits:

7cf1a56first version

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24837

    • Property Status changed from new to needs_review
    • Property Authors changed from to Jean-Philippe Labbé
    • Property Dependencies changed from to #22572
    • Property Branch changed from to u/jipilab/24837
    • Property Commit changed from to 7cf1a562e411bb1307b906c173d04f177d66fc0f
  • Ticket #24837 – Description

    initial v1  
    22
    33{{{
     4    sage: Cube = polytopes.cube()
     5    sage: TCube = Cube.truncation()
    46    sage: Nice_repr = TCube.repr_pretty_Hrepresentation(separator='\n')
    5 sage: print(Nice_repr)
    6 1 >= x0
    7 1 >= x1
    8 3*x1 + 7 >= 3*x0 + 3*x2
    9 x0 + 1 >= 0
    10 x1 + 1 >= 0
    11 3*x0 + 7 >= 3*x1 + 3*x2
    12 3*x0 + 3*x1 + 7 >= 3*x2
    13 3*x0 + 3*x2 + 7 >= 3*x1
    14 3*x0 + 3*x1 + 3*x2 + 7 >= 0
    15 x2 + 1 >= 0
    16 1 >= x2
    17 3*x1 + 3*x2 + 7 >= 3*x0
    18 3*x2 + 7 >= 3*x0 + 3*x1
    19 7 >= 3*x0 + 3*x1 + 3*x2
     7    sage: print(Nice_repr)
     8    1 >= x0
     9    1 >= x1
     10    3*x1 + 7 >= 3*x0 + 3*x2
     11    x0 + 1 >= 0
     12    x1 + 1 >= 0
     13    3*x0 + 7 >= 3*x1 + 3*x2
     14    3*x0 + 3*x1 + 7 >= 3*x2
     15    3*x0 + 3*x2 + 7 >= 3*x1
     16    3*x0 + 3*x1 + 3*x2 + 7 >= 0
     17    x2 + 1 >= 0
     18    1 >= x2
     19    3*x1 + 3*x2 + 7 >= 3*x0
     20    3*x2 + 7 >= 3*x0 + 3*x1
     21    7 >= 3*x0 + 3*x1 + 3*x2
    2022}}}
     23
     24In the new version it gives:
     25
     26{{{
     27    sage: print(TCube.Hrepresentation_str())
     28                    -x0 >= -1
     29                    -x1 >= -1
     30    -3*x0 + 3*x1 - 3*x2 >= -7
     31                     x0 >= -1
     32                     x1 >= -1
     33     3*x0 - 3*x1 - 3*x2 >= -7
     34     3*x0 + 3*x1 - 3*x2 >= -7
     35     3*x0 - 3*x1 + 3*x2 >= -7
     36     3*x0 + 3*x1 + 3*x2 >= -7
     37                     x2 >= -1
     38                    -x2 >= -1
     39    -3*x0 + 3*x1 + 3*x2 >= -7
     40    -3*x0 - 3*x1 + 3*x2 >= -7
     41    -3*x0 - 3*x1 - 3*x2 >= -7
     42
     43    sage: print(TCube.Hrepresentation_str(latex=True))
     44    \begin{array}{rcl}
     45                                   -x_{0} & \geq & -1 \\
     46                                   -x_{1} & \geq & -1 \\
     47    -3 \, x_{0} + 3 \, x_{1} - 3 \, x_{2} & \geq & -7 \\
     48                                    x_{0} & \geq & -1 \\
     49                                    x_{1} & \geq & -1 \\
     50     3 \, x_{0} - 3 \, x_{1} - 3 \, x_{2} & \geq & -7 \\
     51     3 \, x_{0} + 3 \, x_{1} - 3 \, x_{2} & \geq & -7 \\
     52     3 \, x_{0} - 3 \, x_{1} + 3 \, x_{2} & \geq & -7 \\
     53     3 \, x_{0} + 3 \, x_{1} + 3 \, x_{2} & \geq & -7 \\
     54                                    x_{2} & \geq & -1 \\
     55                                   -x_{2} & \geq & -1 \\
     56    -3 \, x_{0} + 3 \, x_{1} + 3 \, x_{2} & \geq & -7 \\
     57    -3 \, x_{0} - 3 \, x_{1} + 3 \, x_{2} & \geq & -7 \\
     58    -3 \, x_{0} - 3 \, x_{1} - 3 \, x_{2} & \geq & -7
     59    \end{array}
     60}}}
     61
     62The `style` parameter allows to change the way to print the H-relations:
     63
     64{{{
     65sage: P = polytopes.permutahedron(3)
     66sage: print(P.Hrepresentation_str(style='<='))
     67-x0 - x1 - x2 == -6
     68      x1 + x2 <=  5
     69           x2 <=  3
     70           x1 <=  3
     71          -x1 <= -1
     72     -x1 - x2 <= -3
     73          -x2 <= -1
     74}}}
     75
     76In order to make the function more apparent, deprecation of the current function is perhaps a good idea and change the name to `Hrepresentation_str`.