Initializing help system before first use

XPRSaddgencons, XPRSaddgencons64

Purpose
Adds one or more general constraints to the problem. Each general constraint y = f(x1, ..., xn, c1, ..., cn) consists of one or more (input) columns xi, zero or more constant values ci and a resultant (output column) y, different from all xi. General constraints include maximum and minimum (arbitrary number of input columns of any type and arbitrary number of input values, at least one total), and and or (at least one binary input column, no constant values, binary resultant) and absolute value (exactly one input column of arbitrary type, no constant values).
Topic areas
Synopsis
int XPRS_CC XPRSaddgencons(XPRSprob prob, int ncons, int ncols, int nvals, const int contype[], const int resultant[], const int colstart[], const int colind[], const int valstart[], const double val[]);

int XPRS_CC XPRSaddgencons64(XPRSprob prob, int ncons, XPRSint64 ncols, XPRSint64 nvals, const int contype[], const int resultant[], const XPRSint64 colstart[], const int colind[], const XPRSint64 valstart[], const double val[]);
Arguments
prob 
The current problem.
ncons 
The number of general constraints to add.
ncols 
The total number of input variables in general constraints that should be added.
nvals 
The total number of constant values in general constraints that should be added.
contype 
Integer array of length ncons containing the types of the general constraints:
XPRS_GENCONS_MAX (0) 
indicates a maximum constraint;
XPRS_GENCONS_MIN (1) 
indicates a minimum constraint;
XPRS_GENCONS_AND (2) 
indicates an and constraint.
XPRS_GENCONS_OR (3) 
indicates an or constraint;
XPRS_GENCONS_ABS (4) 
indicates an absolute value constraint.
resultant 
Integer array of length ncons containing the indices of the output variables of the general constraints.
colstart 
Integer array of length ncons containing the start index of each general constraint in the colind array.
colind 
Integer array of length ncols containing the input variables in all general constraints.
valstart 
Integer array of length ncons containing the start index of each general constraint in the val array (may be NULL if ncoefs = 0).
val 
Double array of length nvals containing the constant values in all general constraints (may be NULL if ncoefs = 0).
Related controls
Integer
Controls whether dual reductions may be applied to reduce the number of added variables and constraints.

Example
This adds two new general constraints x2 = max(x0, x1, 5) and x3 = |x1|:
int contype[] = {XPRS_GENCONS_MAX, XPRS_GENCONS_ABS};
int resultant[] = {2, 3};
int colstart[] = {0, 2};
int colind[] = {0, 1, 1};
int valstart[] = {0, 1};
double val[] = {5.0};

...
XPRSaddgencons(prob, 2, 3, 1, contype, resultant, colstart, colind, valstart, val);
XPRSmipoptimize(prob,"");
Further information
1. General constraints must be set up before solving the problem. They are converted to additional binary variables, indicator and linear constraints with the exact formulation and number of added entities depending on the performed presolving.
2. Note that using non-binary variables in and/ or constraints or adding constant values to them or absolute value constraints will give an error at solve time.
3. This function cannot be called while the current problem is being solved or when it is in an interrupted state. Use XPRSpostsolve to restore the problem to a non-solving state.
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.