Commits (55)
v0.1.0, 22.06.2012 -- Initial release.
v0.1.1, 08.12.2012
* Picos now interfaces GUROBI !
* You can specify an initial solution to *warm-start* mixed integer optimizers.
* Minor bugs with quadratic expressions corrected
* It's possible to return a reference to a constraint added
with add_constraint()
v0.1.2, 10.01.13
bug-fix release, correcting:
* The write_to_file() function for sparse SDPA files.
The function was writing the
coefficients of the lower triangular part
of the constraint matrices
instead of the upper triangle.
* An IndexError occuring with the function
v0.1.3, 17.04.13
* geomean() function implemented, to handle inequalities involving
geometric mean and reformulate them as a set of SOCP constraints.
* Some options ['uboundlimit','lboundlimit'] were added to tell
CPLEX to stop the computation as soon as a given value for the
upper bound (or lower bound) is reached.
* The time used by the solver is now stored in the dictionary
returned bz solve().
* It is possible to get the evolution of the lower and upper bounds
over time, by using the option 'boundMonitor'.
* The weak inequalities operator can now be used.
* Minor bugs corrected (access to the duals of fixed variables with CPLEX,
evaluation of constant affine expressions with a zero coefficient appearing
in the dict of linear terms, number of constraints is now updated in remove_constraint() )
v1.0.0, 19.07.13
* Semidefinite Programming Interface for MOSEK 7.0 !!!
* New options ``handleBarVars`` and ``handleConeVars`` to customize how SOCP and SDPs are passed to MOSEK
(When these options are set to ``True`` , PICOS tries to minimize the number of variables of the
MOSEK instance).
* The function dualize() returns the Lagrangian dual of a Problem.
* The option ``solve_via_dual`` allows the user to pass the dual
of a problem to a solver, instead of the primal problem itself. This can yield important speed-up for
certain problems.
* In addition to the geometric mean function picos.geomean(), it is now possible
to pass rational powers of affine expressions (through an overload of the ``**`` operator), trace of
matrix powers with picos.tracepow(), (generalized) p-norms
with picos.norm(), and nth root of a determinant with
picos.detrootn(). These functions automatically reformulate the entered inequalities
as a set of equivalent SOCP or SDP constraints.
* It is now possible to specify variable bounds directly (rather than adding constraints of the type ``x >= 0`` ).
This can be done with the Keywords ``lower`` and ``upper`` of the function add_variable() ,
or by the methods set_lower(), set_upper(), set_sparse_lower(), and set_sparse_upper() of the class Variable.
* It is now more efficient to update a Problem and resolve it. This is done thanks to the attribute ``passed``
of the classes Constraint and Variable ,
that stores which solvers are already aware of a constraint / variable. There is also an
attribute ``obj_passed`` of the class Problem that lists the solver instances
where the objective function has already been passed. The option ``onlyChangeObjective`` has been
\ No newline at end of file
This diff is collapsed.
# file GENERATED by distutils, do NOT edit
PICOS is a user friendly interface
to several conic and integer programming solvers,
very much like `YALMIP <>`_ under
`MATLAB <>`_.
The main motivation for PICOS is to have the possibility to
enter an optimization problem as a *high level model*,
and to be able to solve it with several *different solvers*.
Multidimensional and matrix variables are handled in a natural fashion,
which makes it painless to formulate a SDP or a SOCP.
This is very useful for educational purposes,
and to quickly implement some models and
test their validity on simple examples.
Furthermore, with PICOS you can take advantage of the
python programming language to read and write data,
construct a list of constraints by using python list comprehensions,
take slices of multidimensional variables, etc.
`Guillaume Sagnol <>`_
Thanks also to
Bertrand Omont
`Elmar Swarat <>`_
# Makefile for Sphinx documentation
# You can set these variables from the command line.
SPHINXBUILD = sphinx-build
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
# the i18n builder cannot share the environment and doctrees with the others
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
-rm -rf $(BUILDDIR)/*
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
@echo "Build finished; now you can process the pickle files."
@echo "Build finished; now you can process the JSON files."
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pyMathProg.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pyMathProg.qhc"
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/pyMathProg"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pyMathProg"
@echo "# devhelp"
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
@echo "Build finished. The text files are in $(BUILDDIR)/text."
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
@echo "The overview file is in $(BUILDDIR)/changes."
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
solve_via_dual avec cvxopt -- something special to do (finir primalize())
probleme qd solve problems 2 times in a row ( avec mosek6, but only at zib (?))
problem avec duals de gurobi pour probleme dsocp de (faire testSOCP5 ?). Bug gurobi -> min example ?
write_to_file --> scaled vars [mettre ds nom variable ?]
file reader
mps writer
dat-s writer with option to desymmetrize the matrices
Better Exception handling in _retrieve_matrix
quad expression of dimension>1 ?
QP avec cvxopt
doc populate et related properties (number_solutions,value_alt,...)
and options
* pool_size=None (solver default) : maximum number of computed
solutions in the solution pool.
* pool_gap = None (0%) : keeps only the solution
within this gap in the pool
duals avec zibopt ?
documenter dat-sx format ?
sqp method and related options:
* step_sqp=1 : 'first step length for the sequential quadratic programming procedure'
* harmonic_steps=True : step at the ith step of the sqp procedure is step_sqp/i]
no string mode.
generaliser les inplace operators (avoid seelfcopy as much as possible)
lancer script add_google_script
Changer CHANGE file
Creer dist file (python sdist)
move to /www and change root-index with 3 <meta tags> and $sed -i 's/href="/href="v013\//g' index.html
Register on pypi (python register, username guillaume.sagnol)
sed -i 's/Picos 0\.1\.0/Picos 0\.1\.1/g' picos/*.py
et change version num dans and
This diff is collapsed.
Sphinx sidebar template: download link.
<h3><a href="download.html">{{ _('Download') }}</a></h3>
<ul class="this-page-menu">
<li><a href="{{'dist/PICOS-'+release+'.tar.gz'}}">{{ _('Latest Version ('+release+')') }}</a></li>
Sphinx sidebar template: local table of contents.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
{%- if display_toc %}
<h3><a href="{{ pathto(master_doc) }}">{{ _('Contents of this page') }}</a></h3>
{{ toc }}
{%- endif %}
files = ['index.html','api.html',
import os
for f in files:
line = fi.readline()
while '</head>' not in line:
line = fi.readline()
fitmp.write(' <script type="text/javascript">\n')
fitmp.write(' var _gaq = _gaq || [];\n')
fitmp.write(" _gaq.push(['_setAccount', 'UA-33037163-1']);\n")
fitmp.write(" _gaq.push(['_trackPageview']);\n")
fitmp.write(" (function() {\n")
fitmp.write(" var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n")
fitmp.write(" ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';\n")
fitmp.write(" var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n")
fitmp.write(" })();\n")
fitmp.write(" </script>\n")
while line:
if 'tar.gz' in line:
ocstring=('''onClick="javascript: _gaq.push(['_trackPageview', '/downloads/version'''
+str(vsplit[0]) +str(vsplit[1]) +str(vsplit[2])
+ '''']);"''')
indtar = line.index('tar.gz') + 7
line = line[:indtar]+' '+ocstring+line[indtar:]
line = fi.readline()
os.system('mv _build/html/'+f+'tmp _build/html/'+f)
.. _api:
The PICOS Reference
.. toctree::
:maxdepth: 2
# -*- coding: utf-8 -*-
# picos documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 1 10:03:01 2012.
# This file is execfile()d with the current directory set to its containing dir.
# Note that not all possible configuration values are present in this
# autogenerated file.
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
intersphinx_cache_limit = 10 # days to keep the cached inventories
intersphinx_mapping = {
'sphinx': ('', None),
'matplotlib':('', None),
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'picos'
copyright = u'2012, Guillaume Sagnol'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# The short X.Y version.
version = '1.0'
# The full version, including alpha/beta/rc tags.
release = '1.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
html_short_title = 'PICOS'
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
html_sidebars = {'**': ['globaltoc.html','localtoc2.html','relations.html', 'sourcelink.html', 'download.html', 'searchbox.html']}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'picosdoc'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'picos.tex', u'picos Documentation',
u'Guillaume Sagnol', 'manual'),
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pymathprog', u'picos Documentation',
[u'Guillaume Sagnol'], 1)
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'picos', u'picos Documentation',
u'Guillaume Sagnol', 'picos', 'python interface to conic optimization solvers.',
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
def setup(app):
from sphinx.util.texescape import tex_replacements
#copying files
import os
print 'copying pyplots files...'
os.system('cp -v pyplots/*.py _build/html/pyplots/')
print 'done.'
print 'copying dist files...'
os.system('cp -v ../dist/* _build/html/dist')
print 'done.'
\ No newline at end of file
.. _constraint:
.. autoclass:: picos.Constraint
.. autoclass:: picos.GeoMeanConstraint
:inherited-members: slack
.. autoclass:: picos.NormP_Constraint
:inherited-members: slack
.. autoclass:: picos.TracePow_Constraint
:inherited-members: slack
.. autoclass:: picos.DetRootN_Constraint
:inherited-members: slack
\ No newline at end of file
.. _download:
The latest version of PICOS can be downloaded here:
`picos-1.0.0 <dist/PICOS-1.0.0.tar.gz>`_
Installation instructions are explained
:ref:`here <requirements>`.
**Older versions**
`picos-0.1.3 <dist/PICOS-0.1.3.tar.gz>`_
`picos-0.1.2 <dist/PICOS-0.1.2.tar.gz>`_
`picos-0.1.1 <dist/PICOS-0.1.1.tar.gz>`_
`picos-0.1.0 <dist/PICOS-0.1.0.tar.gz>`_
\ No newline at end of file
.. _examples:
.. toctree::
:maxdepth: 3
.. _expression:
.. autoclass:: picos.Expression
.. autoclass:: picos.AffinExp
.. _variable:
.. autoclass:: picos.Variable
.. autoclass:: picos.Norm
.. autoclass:: picos.QuadExp
.. autoclass:: picos.LogSumExp
.. autoclass:: picos.GeoMeanExp
.. autoclass:: picos.NormP_Exp
.. autoclass:: picos.TracePow_Exp
.. autoclass:: picos.DetRootN_Exp
\ No newline at end of file