Initializing help system before first use

XPRS_bo_addrows

XPRS_bo_addrows


Purpose
Adds new constraints to a branch of a user branching object.
Synopsis
int XPRS_CC XPRS_bo_addrows(XPRSbranchobject obranch, int ibranch, int nrows, int nelems, const char crtype[], const double drrhs[], const int mrbeg[], const int mcol[], const double dval[]);
Arguments
obranch 
The user branching object to modify.
ibranch 
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.
nelems 
Number of non-zero coefficients in all new constraints.
crtype 
Character array of length nrows indicating the type of constraints to add:
Less than type.
Greater than type.
Equality type.
drrhs 
Double array of length nrows containing the right hand side values.
mrbeg 
Integer array of length nrows containing the offsets of the mcol and dval arrays of the start of the non zero coefficients in the new constraints.
mcol 
Integer array of length nelems containing the column indices for the non zero coefficients.
dval 
Double array of length nelems 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-2020 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.