File: pulp.rst

package info (click to toggle)
python-pulp 1.6.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,596 kB
  • sloc: python: 6,006; sh: 12; makefile: 5
file content (107 lines) | stat: -rw-r--r-- 2,144 bytes parent folder | download | duplicates (4)
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
=====================================
:mod:`pulp`:  Pulp classes
=====================================
.. module:: pulp

.. currentmodule:: pulp
 
.. autosummary:: 

   LpProblem
   LpVariable
   LpAffineExpression
   LpConstraint
   LpConstraint.makeElasticSubProblem
   FixedElasticSubProblem

.. todo::   LpFractionConstraint, FractionElasticSubProblem

The LpProblem Class
-------------------

.. autoclass:: LpProblem
   :show-inheritance:

   Three important attributes of the problem are:

   .. attribute:: objective

      The objective of the problem, an :obj:`LpAffineExpression`

   .. attribute:: constraints

      An :class:`ordered dictionary<odict.OrderedDict>` of
      :class:`constraints<LpConstraint>` of the problem - indexed by their names.

   .. attribute:: status 

      The return :data:`status <pulp.constants.LpStatus>`
      of the problem from the solver.

   Some of the more important methods:

   .. automethod:: solve
   .. automethod:: roundSolution
   .. automethod:: setObjective
   .. automethod:: writeLP

Variables and Expressions
-------------------------

.. autoclass:: LpElement
    :members:

----

.. autoclass:: LpVariable
   :members:

Example:

>>> x = LpVariable('x',lowBound = 0, cat='Continuous')
>>> y = LpVariable('y', upBound = 5, cat='Integer')

gives  :math:`x \in [0,\infty)`, :math:`y \in (-\infty, 5]`, an
integer.

----

.. autoclass:: LpAffineExpression
   :show-inheritance:

   In brief, :math:`\textsf{LpAffineExpression([(x[i],a[i]) for i in
   I])} = \sum_{i \in I} a_i x_i` where  (note the order):

    *   ``x[i]`` is an :class:`LpVariable`
    *   ``a[i]`` is a numerical coefficient. 

----

.. autofunction::  lpSum


Constraints
-----------
.. autoclass::  LpConstraint
   :show-inheritance:
   :members: makeElasticSubProblem

.. include::  documentation/elastic.rst

.. autoclass:: FixedElasticSubProblem
   :show-inheritance:
   :members:

Combinations  and Permutations
------------------------------

.. autofunction::  combination

.. autofunction::  allcombinations

.. autofunction::  permutation

.. autofunction::  allpermutations

.. autofunction::  value