Initializing help system before first use

XPRS_bo_addrows

Purpose
Adds new constraints to a branch of a user branching object.
Topic area
Synopsis
int XPRS_CC XPRS_bo_addrows(XPRSbranchobject bo, int branch, int nrows, int ncoefs, const char rowtype[], const double rhs[], const int start[], const int colind[], const double rowcoef[]);
Arguments
bo 
The user branching object to modify.
branch 
The number of the branch to add the new constraints for. This branch must already have been created using XPRS_bo_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:
Less than type.
Greater than type.
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.
Example
The following function will create a branching object that branches on constraints x_1 + x_2 ≥ 1 or x_1 + x_2 ≤ 0:
XPRSbranchobject CreateConstraintBranch(XPRSprob xp_mip, int icol)
{
  char   cRowType;
  double dRowRHS;
  int    mRowBeg;
  int    mElemCol[2];
  double dElemVal[2];

  XPRSbranchobject bo = NULL;
  int isoriginal = 1;

  /* Create the new object with two empty branches. */
  XPRS_bo_create(&bo, xp_mip, isoriginal);
  XPRS_bo_addbranches(bo, 2);

  /* Add the constraint x1 + x2 >= 1. */
  cRowType = 'G';
  dRowRHS  = 1.0;
  mRowBeg  = 0;
  mElemCol[0] = 0; mElemCol[1] = 1;
  dElemVal[0] = 1.0; dElemVal[1] = 1.0;
  XPRS_bo_addrows
    (bo, 0, 1, 2, &cRowType, &dRowRHS, &mRowBeg, mElemCol, dElemVal);
  /* Add the constraint x1 + x2 <= 0. */
  cRowType = 'L';
  dRowRHS  = 0.0;
  XPRS_bo_addrows
    (bo, 1, 1, 2, &cRowType, &dRowRHS, &mRowBeg, mElemCol, dElemVal);

  /* Set a low priority value so our branch object is picked up */
  /* before the default branch candidates. */
  XPRS_bo_setpriority(bo, 100);

  return bo;
}
Related topics

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