object.extractLinear
object.extractLinear |
Returns the variables and coefficients of the linear part of any expression.
vars, coef = a.extractLinear()
a
|
An expression or variable.
|
vars
|
A list containing the variable objects composing the linear expression in
a.
|
coef
|
A list containing the corresponding coefficients in the linear expression.
|
import xpress as xp x = xp.var() y = xp.var(name='myvar') a = x + 2*y b = 3*x c = y**2 + x**2 - 6*x d = x**5 - 7*x # nonlinear expression print (a.extractLinear()) # will print "([C1, myvar], [1, 2])" assert (a.extractLinear() == ([x, y], [1, 2])) print (b.extractLinear()) # will print "([C1], [3])" print (c.extractLinear()) # will print "([C1], [-6])" print (d.extractLinear()) # will print "([C1], [-7])"
© 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.