branchobj.addrows
branchobj.addrows(branch, rowtype, rhs, start, colind, rowcoef)
branch
|
The number of the branch to add the new constraints for. This branch must already have been created using
branchobj.addbranches. Branches are indexed starting from zero.
|
||||||
rowtype
|
Character array indicating the type of constraints to add:
|
||||||
rhs
|
Array containing the right-hand side values.
|
||||||
start
|
Array containing the offsets in the
colind and
rowcoef arrays of the start of the nonzero coefficients for each new constraint. The array must contain one more element than the number of rows to add, with the last element being the total number of coefficients across all rows.
|
||||||
colind
|
Array containing the columns for the nonzero coefficients.
|
||||||
rowcoef
|
Array containing the nonzero coefficient values.
|
def CreateConstraintBranch(prob, x1, x2): # Create the new object with two empty branches. bo = xpress.branchobj(prob, isoriginal=True) bo.addbranches(2) # Add the constraints to the branching object # x1 + x2 >= 1 # x1 + x2 <= 0 bo.addrows(0, ['G'], [1.0], [0], [x1, x2], [1.0, 1.0]) bo.addrows(1, ['L'], [0.0], [0], [x1, x2], [1.0, 1.0]) # Set a low priority value so our branch object is picked up # before the default branch candidates. bo.setpriority(100) return bo
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.