Initializing help system before first use

xor

Purpose
Create an exclusive or expression.
Synopsis
function xor(c1:log_or_linctr,c2:log_or_linctr):logctr
Arguments
c1 
A linear constraint ( linctr) or logical expression ( logctr)
c2 
A linear constraint ( linctr) or logical expression ( logctr)
Return value
A new logctr representing the expression.
Example
This example shows how to state an exclusive 'or' constraint that expresses the disjunction between two tasks with start time sj and fixed duration Dj. A non-exclusive 'or' relation can be stated by using the or operator as shown in the last line (constraint L).
declarations
 R=1..2
 C: array(range) of linctr  ! Linear constraints
 L: logctr                  ! Logical constraint
 s: array(R) of mpvar       ! Decision variables (start times)
 D: array(R) of real        ! Data (durations)
end-declarations

C(1):= s(1)+D(1)>=s(2)      ! Define (temporary) linear constraints
C(2):= s(2)+D(2)>=s(1)

xor(C(1), C(2))             ! State an exclusive 'or'
forall(j in 1..2) C(j):=0   ! Delete the auxiliary constraints

! The same 'xor' constraint can be stated by:
xor(s(1)+D(1)>=s(2), s(2)+D(2)>=s(1))

! A non-exclusive 'or' relation is stated by using the 'or' operator:
L:= s(1)+D(1)>=s(2) or s(2)+D(2)>=s(1)  
Further information
1. This function creates a logctr constraint representing an exclusive or condition: either c1 or c2 is valid, not both.
2. The helper package 'advmod' must be loaded if this function is used:
uses 'advmod'

Related topics
Module

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