Main problem object
>>> p = MILProgram()
>>> p
<epyglpki.MILProgram object at 0x...>
Add and obtain new constraint object
Parameters: |
|
---|---|
Returns: | constraint object |
Return type: |
>>> p = MILProgram()
>>> c = p.add_constraint()
>>> c
<epyglpki.Constraint object at 0x...>
Add and obtain new variable object
Parameters: |
|
---|---|
Returns: | variable object |
Return type: |
>>> p = MILProgram()
>>> x = p.add_variable()
>>> x
<epyglpki.Variable object at 0x...>
Change or retrieve coefficients (constraint matrix)
Parameters: | coeffs (Mapping of length-2 Sequence, containing one Variable and one Constraint, to Real) – the mapping with coefficients to change ({} to set all coefficients to 0) |
---|---|
Raises: |
|
>>> p = MILProgram()
>>> x = p.add_variable()
>>> y = p.add_variable()
>>> c = p.add_constraint()
>>> d = p.add_constraint()
>>> p.coeffs({(x, c): 3, (d, y): 5.5, (x, d): 0})
>>> x.coeffs()[c] == c.coeffs()[x] == 3
True
>>> y.coeffs()[d] == d.coeffs()[y] == 5.5
True
>>> len(x.coeffs()) == len(d.coeffs()) == 1
True
Return a list of the problem’s constraints
Returns: | a list of the problem’s constraints |
---|---|
Return type: | list of Constraint |
>>> p = MILProgram()
>>> c = p.add_constraint()
>>> p.constraints()
[<epyglpki.Constraint object at 0x...>]
>>> d = p.add_constraint()
>>> w = p.constraints()
>>> (c in w) and (d in w)
True
Obtain integer optimization solver object
Parameters: | controls – set solver control parameters; see IntOptSolver.controls(), parameter controls |
---|---|
Returns: | integer optimization solver object |
Return type: | IntOptSolver |
>>> p = MILProgram()
>>> s = p.intopt()
>>> s
<epyglpki.IntOptSolver object at 0x...>
Obtain interior point solver object
Parameters: | controls – set solver control parameters; see IPointSolver.controls(), parameter controls |
---|---|
Returns: | interior point solver object |
Return type: | IPointSolver |
>>> p = MILProgram()
>>> s = p.ipoint()
>>> s
<epyglpki.IPointSolver object at 0x...>
Change or retrieve problem name
Parameters: | name (str) – the new problem name (omit for retrieval only) |
---|---|
Returns: | the problem name |
Return type: | |
Raises: |
|
>>> p = MILProgram()
>>> p.name()
''
>>> p.name('Programme Linéaire')
'Programme Linéaire'
>>> p.name()
'Programme Linéaire'
>>> p.name('')
''
Obtain objective object
Parameters: |
|
---|---|
Returns: | objective object |
Return type: |
>>> p = MILProgram()
>>> o = p.objective()
>>> o
<epyglpki.Objective object at 0x...>
Read a problem from a file (class method)
Parameters: | |
---|---|
Raises: |
|
Todo
Add doctest
Change, apply and unapply scaling factors
Parameters: |
|
---|---|
Returns: | the scaling factor mapping, which only contains non-1 factors |
Return type: | dict of Variable or Constraint to float |
Raises: |
>>> p = MILProgram()
>>> x = p.add_variable()
>>> y = p.add_variable()
>>> c = p.add_constraint()
>>> d = p.add_constraint()
>>> p.coeffs({(x, c): 3e-100, (d, y): 5.5, (x, d): 1.5e200})
>>> p.scaling()
{}
>>> p.scaling('skip', 'geometric', 'equilibration',
... factors={y: 3})
{<epyglpki.Variable object at 0x...>: 3.329...e-67,
<epyglpki.Variable object at 0x...>: 3.0,
<epyglpki.Constraint object at 0x...>: 1.001...e+166,
<epyglpki.Constraint object at 0x...>: 2.002...e-134}
>>> p.scaling(factors={})
{}
Note
If a scaling algorithm is given, all factors are first set to 1:
>>> p.scaling(factors={d: 5.5})
{<epyglpki.Constraint object at 0x...>: 5.5}
>>> p.scaling('round')
{}
Obtain simplex solver object
Parameters: | controls – set solver and basis factorization control parameters; see SimplexSolver.controls(), parameter controls |
---|---|
Returns: | simplex solver object |
Return type: | SimplexSolver |
>>> p = MILProgram()
>>> s = p.simplex()
>>> s
<epyglpki.SimplexSolver object at 0x...>
A list of the problem’s variables
Returns: | a list of the problem’s variables |
---|---|
Return type: | list of Variable |
>>> p = MILProgram()
>>> x = p.add_variable()
>>> p.variables()
[<epyglpki.Variable object at 0x...>]
>>> y = p.add_variable()
>>> v = p.variables()
>>> (x in v) and (y in v)
True
Write the problem to a file
Parameters: | |
---|---|
Raises: |
|
Todo
Add doctest