Initializing help system before first use

xpress.setConstraintOperatorsEnabled

Purpose
Enables or disables the behaviour where comparing two expressions using the ==, <= or >= operators creates a new constraint.
Synopsis
xpress.setConstraintOperatorsEnabled(enabled)
Argument
enabled 
True if comparing two expressions should create a new constraint, False if comparing two expressions should return a Boolean.
Example
The example below disables constraint operators until a subsequent call to xpress.setConstraintOperatorsEnabled(True):
xpress.setConstraintOperatorsEnabled(False)
The example below disables constraint operators for the duration of the following code block, and then automatically re-enables them afterwards:
with xpress.setConstraintOperatorsEnabled(False):
  run_unit_tests()
Further information
1. By default, an expression like x == y, where x and y are xpress.var objects creates a new constraint, fixing x and y to the same value. This is sometimes not the desired behaviour, for example during unit testing, where you might want to determine whether two expressions have the same algebraic form.
2. Whether or not constraint operators are enabled, constraints can always be created using the xpress.constraint constructors (or xpress.eq, xpress.leq and xpress.geq functions), and expressions can always be compared for equality using xpress.is_equal.
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.