Initializing help system before first use

# XPRSbranchobject

- java.lang.Object
- - com.dashoptimization.XPRSobject
  - - com.dashoptimization.XPRSbranchobject

- All Implemented Interfaces:
    `java.lang.AutoCloseable`
  Direct Known Subclasses:
    `XpressProblem.BranchObject`

      public class XPRSbranchobject
      extends XPRSobject

  Class encapsulating a branch object

- - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addBounds​(int branch, int nbounds, byte[] bndtype, int[] colind, double[] bndval)` | Adds new bounds to a branch of a user branching object.
    `void` | `addBranches​(int nbranches)` | Adds new, empty branches to a user defined branching object.
    `void` | `addCuts​(int branch, int ncuts, XPRScut[] cutind)` | Adds stored user cuts as new constraints to a branch of a user branching object.
    `void` | `addMsgHandlerListener​(XPRSmsgHandlerListener listener)` | Add a listener for the MsgHandler callback.
    `void` | `addMsgHandlerListener​(XPRSmsgHandlerListener listener, int priority)` | Add a listener for the MsgHandler callback.
    `void` | `addMsgHandlerListener​(XPRSmsgHandlerListener listener, java.lang.Object data)` | Add a listener for the MsgHandler callback.
    `void` | `addMsgHandlerListener​(XPRSmsgHandlerListener listener, java.lang.Object data, int priority)` | Add a listener for the MsgHandler callback.
    `void` | `addRows​(int branch, int nrows, int ncoefs, byte[] rowtype, double[] rhs, int[] start, int[] colind, double[] rowcoef)` | Adds new constraints to a branch of a user branching object.
    `void` | `close()` | Deallocates resources associated with an XPRSobject.
    `int` | `getBounds​(int branch)` | Returns the bounds for a branch of a user branching object.
    `int` | `getBounds​(int branch, int maxbounds, byte[] bndtype, int[] colind, double[] bndval)` | Returns the bounds for a branch of a user branching object.
    `int` | `getBranches()` | Returns the number of branches of a branching object.
    `void` | `getID​(IntHolder p_id)` | Returns the unique identifier assigned to a branching object.
    `java.lang.String` | `getLastError()` | Returns the last error encountered during a call to the given branch object.
    `java.lang.String` | `getLastError​(IntHolder p_msgcode)` | Returns the last error encountered during a call to the given branch object.
    `int` | `getRows​(int branch)` | Returns the constraints for a branch of a user branching object.
    `int` | `getRows​(int branch, int maxrows, IntHolder p_ncoefs, int maxcoefs, byte[] rowtype, double[] rhs, int[] start, int[] colind, double[] rowcoef)` | Returns the constraints for a branch of a user branching object.
    `void` | `removeMsgHandlerListener​(XPRSmsgHandlerListener listener)` | Removes the given MsgHandler listener from the object.
    `void` | `removeMsgHandlerListener​(XPRSmsgHandlerListener listener, java.lang.Object data)` | Removes the given MsgHandler listener with the given data value from the object.
    `void` | `removeMsgHandlerListeners()` | Remove all listeners for the MsgHandler callback
    `void` | `setPreferredBranch​(int branch)` | Specifies which of the child nodes corresponding to the branches of the object should be explored first.
    `void` | `setPriority​(int priority)` | Sets the priority value of a user branching object.
    `int` | `store()` | Commits the branch object to the XPRSprob.
    `void` | `validate​(IntHolder p_status)` | Verifies that a given branching object is valid for branching on the current branch-and-bound node of a MIP solve.

    - ### Methods inherited from class com.dashoptimization.XPRSobject

      `addMsgHandlerListener, addMsgHandlerListener, destroy, isDestroyed`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### store

          public int store()
                    throws XPRSexception

      Commits the branch object to the XPRSprob. Note that the XPRSbranchobject will be invalidated when store() returns. This is a convenience wrapper for `store(IntHolder)`.
      Returns:
        The success status of the operation, if non-zero the operation failed and the object was not stored.
      Throws:
        `XPRSexception`

    - #### close

          public void close()

      Description copied from class: `XPRSobject`
      Deallocates resources associated with an XPRSobject.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in class `XPRSobject`

    - #### addBranches

          public void addBranches​(int nbranches)
                           throws XPRSexception

      Adds new, empty branches to a user defined branching object.

      Examples using `addBranches`:

      - MostViolated.java
      Parameters:
        `nbranches` - Number of new branches to create.
      Throws:
        `XPRSexception`

    - #### getBranches

          public int getBranches()
                          throws XPRSexception

      Returns the number of branches of a branching object.
      Returns:
        The requested information.
      Throws:
        `XPRSexception`

    - #### setPriority

          public void setPriority​(int priority)
                           throws XPRSexception

      Sets the priority value of a user branching object.

      Examples using `setPriority`:

      - MostViolated.java
      Parameters:
        `priority` - The new priority value to assign to the branching object, which must be a number from 0 to 1000. User branching objects are created with a default priority value of 500.
      Throws:
        `XPRSexception`

    - #### setPreferredBranch

          public void setPreferredBranch​(int branch)
                                  throws XPRSexception

      Specifies which of the child nodes corresponding to the branches of the object should be explored first.

      Examples using `setPreferredBranch`:

      - MostViolated.java
      Parameters:
        `branch` - The number of the branch to mark as preferred.
      Throws:
        `XPRSexception`

    - #### addBounds

          public void addBounds​(int branch,
                                int nbounds,
                                byte[] bndtype,
                                int[] colind,
                                double[] bndval)
                         throws XPRSexception

      Adds new bounds to a branch of a user branching object.

      Examples using `addBounds`:

      - MostViolated.java
      Parameters:
        `branch` - The number of the branch to add the new bounds for. This branch must already have been created using `addBranches`. Branches are indexed starting from zero.
        `nbounds` - Number of new bounds to add.
        `bndtype` - Character array of length `nbounds` indicating the type of bounds to add:
        - `L`: Lower bound.
        - `U`: Upper bound.
        `colind` - Integer array of length `nbounds` containing the column indices for the new bounds.
        `bndval` - Double array of length `nbounds` giving the bound values.
      Throws:
        `XPRSexception`

    - #### getBounds

          public int getBounds​(int branch,
                               int maxbounds,
                               byte[] bndtype,
                               int[] colind,
                               double[] bndval)
                        throws XPRSexception

      Returns the bounds for a branch of a user branching object.
      Parameters:
        `branch` - The number of the branch to get the bounds for.
        `maxbounds` - Maximum number of bounds to return.
        `bndtype` - Character array of length `maxbounds` where the types of bounds will be returned:
        - `L`: Lower bound.
        - `U`: Upper bound.
        May be `null` if not required.
        `colind` - Integer array of length `maxbounds` where the column indices will be returned. May be `null` if not required.
        `bndval` - Double array of length `maxbounds` where the bound values will be returned. May be `null` if not required.
      Returns:
        The requested information.
      Throws:
        `XPRSexception`

    - #### getBounds

          public int getBounds​(int branch)
                        throws XPRSexception

      Returns the bounds for a branch of a user branching object.
      Parameters:
        `branch` - The number of the branch to get the bounds for.
      Returns:
        The requested information.
      Throws:
        `XPRSexception`

    - #### addRows

          public void addRows​(int branch,
                              int nrows,
                              int ncoefs,
                              byte[] rowtype,
                              double[] rhs,
                              int[] start,
                              int[] colind,
                              double[] rowcoef)
                       throws XPRSexception

      Adds new constraints to a branch of a user branching object.

      Examples using `addRows`:

      - LoadLP.java
      - Trimloss.java
      Parameters:
        `branch` - The number of the branch to add the new constraints for. This branch must already have been created using `addBranches`. Branches are indexed starting from zero.
        `nrows` - Number of new constraints to add.
        `ncoefs` - Number of non-zero coefficients in all new constraints.
        `rowtype` - Character array of length `nrows` indicating the type of constraints to add:
        - `L`: Less than type.
        - `G`: Greater than type.
        - `E`: Equality type.
        `rhs` - Double array of length `nrows` containing the right hand side values.
        `start` - Integer array of length `nrows` containing the offsets of the `colind` and `rowcoef` arrays of the start of the non zero coefficients in the new constraints.
        `colind` - Integer array of length `ncoefs` containing the column indices for the non zero coefficients.
        `rowcoef` - Double array of length `ncoefs` containing the non zero coefficient values.
      Throws:
        `XPRSexception`

    - #### getRows

          public int getRows​(int branch,
                             int maxrows,
                             IntHolder p_ncoefs,
                             int maxcoefs,
                             byte[] rowtype,
                             double[] rhs,
                             int[] start,
                             int[] colind,
                             double[] rowcoef)
                      throws XPRSexception

      Returns the constraints for a branch of a user branching object.

      Examples using `getRows`:

      - CuttingStock.java
      - FolioHeuristic.java
      - GlobalObjectiveParametrics.java
      - GlobalRHSParametrics.java
      - LoadLP.java
      - Repair.java
      - Tableau.java
      - Trimloss.java
      Parameters:
        `branch` - The number of the branch to get the constraints from.
        `maxrows` - Maximum number of rows to return.
        `p_ncoefs` - Memory location where the number of non zero coefficients in the constraints should be returned.
        `maxcoefs` - Maximum number of non zero coefficients to return.
        `rowtype` - Character array of length `maxrows` where the types of the rows will be returned (may be `null`):
        - `L`: Less than type.
        - `G`: Greater than type.
        - `E`: Equality type.
        `rhs` - Double array of length `maxrows` where the right hand side values will be returned. May be `null` if not required.
        `start` - Integer array of length `maxrows` which will be filled with the offsets of the `colind` and `rowcoef` arrays of the start of the non zero coefficients in the returned constraints. May be `null` if not required.
        `colind` - Integer array of length `maxcoefs` which will be filled with the column indices for the non zero coefficients. May be `null` if not required.
        `rowcoef` - Double array of length `maxcoefs` which will be filled with the non zero coefficient values. May be `null` if not required.
      Returns:
      Throws:
        `XPRSexception`

    - #### getRows

          public int getRows​(int branch)
                      throws XPRSexception

      Returns the constraints for a branch of a user branching object.

      Examples using `getRows`:

      - CuttingStock.java
      - FolioHeuristic.java
      - GlobalObjectiveParametrics.java
      - GlobalRHSParametrics.java
      - LoadLP.java
      - Repair.java
      - Tableau.java
      - Trimloss.java
      Parameters:
        `branch` - The number of the branch to get the constraints from.
      Returns:
      Throws:
        `XPRSexception`

    - #### addCuts

          public void addCuts​(int branch,
                              int ncuts,
                              XPRScut[] cutind)
                       throws XPRSexception

      Adds stored user cuts as new constraints to a branch of a user branching object.
      Parameters:
        `branch` - The number of the branch to add the cuts for. This branch must already have been created using `addBranches`. Branches are indexed starting from zero.
        `ncuts` - Number of cuts to add.
        `cutind` - Array of length `ncuts` containing the pointers to user cuts that should be added to the branch.
      Throws:
        `XPRSexception`

    - #### getID

          public void getID​(IntHolder p_id)
                     throws XPRSexception

      Returns the unique identifier assigned to a branching object.
      Parameters:
        `p_id` - Pointer to an integer where the identifier should be returned.
      Throws:
        `XPRSexception`

    - #### getLastError

          public java.lang.String getLastError()
                                        throws XPRSexception

      Returns the last error encountered during a call to the given branch object.
      Specified by:
        `getLastError` in class `XPRSobject`
      Returns:
        The requested information.
      Throws:
        `XPRSexception`

    - #### getLastError

          public java.lang.String getLastError​(IntHolder p_msgcode)
                                        throws XPRSexception

      Returns the last error encountered during a call to the given branch object.
      Parameters:
        `p_msgcode` - Location where the error code will be returned. Can be `null` if not required.
      Returns:
        The requested information.
      Throws:
        `XPRSexception`

    - #### validate

          public void validate​(IntHolder p_status)
                        throws XPRSexception

      Verifies that a given branching object is valid for branching on the current branch-and-bound node of a MIP solve. The function will check that all branches are non-empty, and if required, verify that the branching object can be presolved.
      Parameters:
        `p_status` - The returned status from checking the provided branching object:
        - `0`: The object is acceptable.
        - `1`: Failed to presolve the object due to dual reductions in presolve.
        - `2`: Failed to presolve the object due to duplicate column reductions in presolve.
        - `3`: The object contains an empty branch.
        - `4`: Failed to presolve the object due to presolve operations requiring relaxation of a row.
        - `5`: Failed to presolve the object due to it becoming nonlinear due to nonlinear eliminations.
      Throws:
        `XPRSexception`

    - #### addMsgHandlerListener

          public void addMsgHandlerListener​(XPRSmsgHandlerListener listener)
                                     throws XPRSexception

      Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.
      Specified by:
        `addMsgHandlerListener` in class `XPRSobject`
      Parameters:
        `listener` - The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.)
      Throws:
        `XPRSexception`

    - #### addMsgHandlerListener

          public void addMsgHandlerListener​(XPRSmsgHandlerListener listener,
                                            java.lang.Object data)
                                     throws XPRSexception

      Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.
      Specified by:
        `addMsgHandlerListener` in class `XPRSobject`
      Parameters:
        `listener` - The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.)
        `data` - An additional object which will be passed down to the callback function
      Throws:
        `XPRSexception`

    - #### addMsgHandlerListener

          public void addMsgHandlerListener​(XPRSmsgHandlerListener listener,
                                            int priority)
                                     throws XPRSexception

      Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.
      Parameters:
        `listener` - The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.)
        `priority` - Listeners with higher priorities are called first
      Throws:
        `XPRSexception`

    - #### addMsgHandlerListener

          public void addMsgHandlerListener​(XPRSmsgHandlerListener listener,
                                            java.lang.Object data,
                                            int priority)
                                     throws XPRSexception

      Add a listener for the MsgHandler callback. Note that an object can have multiple MsgHandler listeners.
      Parameters:
        `listener` - The listener to which the event will be dispatched. (If null, all MsgHandler listeners will be removed.)
        `data` - An additional object which will be passed down to the callback function
        `priority` - Listeners with higher priorities are called first
      Throws:
        `XPRSexception`

    - #### removeMsgHandlerListener

          public void removeMsgHandlerListener​(XPRSmsgHandlerListener listener)
                                        throws XPRSexception

      Removes the given MsgHandler listener from the object.
      Parameters:
        `listener` - The listener to remove.
      Throws:
        `XPRSexception`

    - #### removeMsgHandlerListener

          public void removeMsgHandlerListener​(XPRSmsgHandlerListener listener,
                                               java.lang.Object data)
                                        throws XPRSexception

      Removes the given MsgHandler listener with the given data value from the object.
      Parameters:
        `listener` - The listener to remove.
        `data` - The user data to remove.
      Throws:
        `XPRSexception`

    - #### removeMsgHandlerListeners

          public void removeMsgHandlerListeners()
                                         throws XPRSexception

      Remove all listeners for the MsgHandler callback
      Throws:
        `XPRSexception`

Parent Topic Class Summary

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