From: Danielle Bolan Date: Wed, 13 Aug 2014 08:59:08 +0000 (+0200) Subject: Add license to examples X-Git-Tag: 1.0~74 X-Git-Url: https://scm.cri.mines-paristech.fr/git/linpy.git/commitdiff_plain/197818714e75c2353ed8b7c9fec653f1212f13ae?hp=7fff25bf40e4db570565586fb49165d1675002c2 Add license to examples --- diff --git a/examples/bac2014.py b/examples/bac2014.py index 775be66..3c69100 100755 --- a/examples/bac2014.py +++ b/examples/bac2014.py @@ -1,4 +1,21 @@ #!/usr/bin/env python3 +# +# Copyright 2014 MINES ParisTech +# +# This file is part of LinPy. +# +# LinPy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LinPy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LinPy. If not, see . from linpy import * diff --git a/examples/diamonds.py b/examples/diamonds.py index 0978d4c..fdf1cc7 100755 --- a/examples/diamonds.py +++ b/examples/diamonds.py @@ -1,4 +1,21 @@ #!/usr/bin/env python3 +# +# Copyright 2014 MINES ParisTech +# +# This file is part of LinPy. +# +# LinPy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LinPy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LinPy. If not, see . import matplotlib.pyplot as plt diff --git a/examples/menger.py b/examples/menger.py index d8a74d4..064219e 100755 --- a/examples/menger.py +++ b/examples/menger.py @@ -1,4 +1,21 @@ #!/usr/bin/env python3 +# +# Copyright 2014 MINES ParisTech +# +# This file is part of LinPy. +# +# LinPy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LinPy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LinPy. If not, see . import argparse diff --git a/examples/nsad2010.py b/examples/nsad2010.py index 9359315..91a85b4 100755 --- a/examples/nsad2010.py +++ b/examples/nsad2010.py @@ -1,4 +1,21 @@ #!/usr/bin/env python3 +# +# Copyright 2014 MINES ParisTech +# +# This file is part of LinPy. +# +# LinPy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LinPy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LinPy. If not, see . from linpy import * diff --git a/examples/squares.py b/examples/squares.py index ea48fe4..89be192 100755 --- a/examples/squares.py +++ b/examples/squares.py @@ -1,6 +1,25 @@ #!/usr/bin/env python3 +# +# Copyright 2014 MINES ParisTech +# +# This file is part of LinPy. +# +# LinPy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LinPy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LinPy. If not, see . from linpy import * +import matplotlib.pyplot as plt +from matplotlib import pylab a, x, y, z = symbols('a x y z') @@ -13,7 +32,6 @@ sq6 = Le(1, x) & Le(x, 2) & Le(1, y) & Le(y, 3) sq7 = Le(0, x) & Le(x, 2) & Le(0, y) & Eq(z, 2) & Le(a, 3) p = Le(2*x+1, y) & Le(-2*x-1, y) & Le(y, 1) - universe = Polyhedron([]) q = sq1 - sq2 e = Empty @@ -60,19 +78,27 @@ print('lexographic max of sq2:', sq2.lexmax()) #test lexmax() print() print('Polyhedral hull of sq1 + sq2 is:', q.aspolyhedron()) #test polyhedral hull print() -print('is sq1 bounded?', sq1.isbounded()) #unbounded should return True +print('is sq1 bounded?', sq1.isbounded()) #bounded should return True print('is sq5 bounded?', sq5.isbounded()) #unbounded should return False print() print('sq6:', sq6) -print('sq6 simplified:', sq6.sample()) -print() -print(universe.project([x])) -print('sq7 with out constraints involving y and a', sq7.project([a, z, x, y])) #drops dims that are passed -print() -print('sq1 has {} parameters'.format(sq1.num_parameters())) +print('sample Polyhedron from sq6:', sq6.sample()) print() -print('does sq1 constraints involve x?', sq1.involves_dims([x])) +print('sq7 with out constraints involving y and a', sq7.project([a, z, x, y])) print() print('the verticies for s are:', p.vertices()) -print() -print(p.plot()) + + +# plotting the intersection of two squares +square1 = Le(0, x) & Le(x, 2) & Le(0, y) & Le(y, 2) +square2 = Le(1, x) & Le(x, 3) & Le(1, y) & Le(y, 3) + +fig = plt.figure() +plot = fig.add_subplot(1, 1, 1, aspect='equal') +square1.plot(plot, facecolor='red', alpha=0.3) +square2.plot(plot, facecolor='blue', alpha=0.3) + +squares = Polyhedron(square1 + square2) +squares.plot(plot, facecolor='blue', alpha=0.3) + +pylab.show() diff --git a/examples/tesseract.py b/examples/tesseract.py index 0a57188..bf338f7 100755 --- a/examples/tesseract.py +++ b/examples/tesseract.py @@ -1,4 +1,21 @@ #!/usr/bin/env python3 +# +# Copyright 2014 MINES ParisTech +# +# This file is part of LinPy. +# +# LinPy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LinPy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LinPy. If not, see . from linpy import *