problem.addrows
problem.addrows |
Purpose
Adds rows and their coefficient to the problem.
Synopsis
problem.addrows(qrtype, rhs, mstart, mclind, dmatval, range=None, names=None)
Arguments
|
qrtype
|
Character array containing the row types:
|
||||||||||
|
rhs
|
Array containing the right hand side elements.
|
||||||||||
|
mstart
|
Array containing the offsets in the
mclind and
dmatval arrays of the start of the elements for each row.
|
||||||||||
|
mclind
|
Array containing the (contiguous) columns (i.e.
xpress.varobjects, indices, or names) for the elements in each row.
|
||||||||||
|
dmatval
|
Array containing the (contiguous) element coefficients.
|
||||||||||
|
range
|
(optional) Array containing the row range elements. The values in the range array will only be read for
'R' type rows. The entries for other type rows will be ignored.
|
||||||||||
|
names
|
(optional) Array of names to be assigned to each new row.
|
Example
Suppose the current problem is:
Then the following adds the row 8x + 9y + 10z ≤ 25 to the problem and names it
NewRow:
| maximize: | 2x + y + 3z | ||
| subject to: | x + 4y + 2z | ≤ | 24 |
| y + z | ≤ | 5 | |
| 3x + y | ≤ | 20 | |
| x + y + 3z | ≤ | 9 |
p = xpress.problem()
p.addrows(['L'], [25], [0,3], [0,1,2],
dmatval=[8, 9, 10], range=None, names=['NewRow'])
Further information
Range rows are automatically converted to type
L, with an upper bound in the slack. This must be taken into consideration, when retrieving row type, right-hand side values or range information for rows.
Related topics
