Initializing help system before first use

# branchobj.addrows

Purpose
Adds new constraints to a branch of a user branching object.
Synopsis
`branchobj.addrows(branch, rowtype, rhs, start, colind, rowcoef)`
Arguments

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:
L | Less than type.
G | Greater than type.
E | Equality type.
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.

Example
The following function will create a branching object that branches on constraints x1 + x2 ≥ 1 or x1 + x2 ≤ 0, where x1 and x2 are instances of xpress.var:

    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

Parent Topic Xpress branch object methods

© 2001-2026 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.