Initializing help system before first use

# problem.addcoefs

Purpose
This subroutine is deprecated and will be removed in a future release. Use problem.slpAddCoefs instead.
Add non-linear coefficients to the SLP problem
Synopsis
`problem.addcoefs(rowindex, colindex, factor, fstart, parsed, type, value)`
Arguments

rowindex | Array holding the rows (or their indices or names) for the coefficient.
colindex | Array holding the columns (or their indices or names) for the coefficient.
factor | Array holding factor by which formula is scaled. If None, a value of 1.0 will be used.
fstart | Integer array holding the start position in the arrays Type and Value of the formula for the coefficients. fstart should have an extra entry containing the next position after the end of the last formula.
parsed | Boolean indicating whether the token arrays are formatted as internal unparsed ( parsed=False) or internal parsed reverse Polish ( parsed=True).
type | Array of token types providing the formula for each coefficient.
value | Array of values corresponding to the types in Type.

Example
Assume that the rows and columns of Prob are named Row1, Row2 ..., Col1, Col2 ..., respectively. The following example adds coefficients representing:
Col2 * Col3 + Col6 * Col2 ˆ2 into Row1 and
Col2 ˆ 2 into Row3.

    rowindex = [Row1,Row1,Row3]
    colindex = [Col2,Col6,Col2]

    formulastart = []
    type = []
    value = []

    formulastart.append(len(type))
    type.append(xp.constants.TOK_COL); value.append(3)
    type.append(xp.constants.TOK_EOF); value.append(0)

    formulastart.append(len(type))
    type.append(xp.constants.TOK_COL); value.append(2)
    type.append(xp.constants.TOK_COL); value.append(2)
    type.append(xp.constants.TOK_OP);  value.append(xp.constants.OP_MULTIPLY)
    type.append(xp.constants.TOK_EOF); value.append(0)

    formulastart.append(len(type))
    type.append(xp.constants.TOK_COL); value.append(2)
    type.append(xp.constants.TOK_EOF); value.append(0)

    formulastart.append(len(type))

    p.addcoefs(rowindex, colindex,  None, formulastart, True, Type, Value)

The first coefficient in Row1 is in Col2 and has the formula Col3, so it represents Col2 * Col3.

The second coefficient in Row1 is in Col6 and has the formula Col2 * Col2 so it represents Col6 * Col2 ˆ2. The formulae are described as parsed (parsed=True), so the formula is written as
Col2 Col2 *
rather than the unparsed form
Col2 * Col2

The last coefficient, in Row3, is in Col2 and has the formula Col2, so it represents Col2 * Col2.

Further information

The jth coefficient is made up of two parts: Factor and Formula. Factor is a constant multiplier, which can be provided in the Factor array. If Xpress Nonlinear can identify a constant factor in Formula, then it will use that as well, to minimize the size of the formula which has to be calculated. Formula is made up of a list of tokens in Type and Value starting at formulastart[j]. The tokens follow the rules for parsed or unparsed formulae as indicated by the setting of parsed. The formula must be terminated with an xslp_op_eof token. If several coefficients share the same formula, they can have the same value in fstart. For possible token types and values see the chapter on Formula Parsing in the SLP reference manual.

The addcoef function loads additional items into the SLP problem. The corresponding loadcoefs function deletes any existing items first.

The behaviour for existing coefficients is additive: the formula defined in the parameters are added to any existing formula coefficients. However, due to performance considerations, such duplications should be avoided when possible.

Related topics
problem.slpChgCoef, problem.slpChgCoefStr, problem.slpDelCoefs, problem.slpGetCoefStr, problem.slpLoadCoefs, problem.slpAddCoefs
Parent Topic Deprecated functionality

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