all_different
function all_different(vars:set of cpvar, propagation: integer) : cpctr
function all_different(vars:set of cpvar) : cpctr
function all_different(vars:array(range) of cpvar, propagation:integer) : cpctr
function all_different(vars:array(range) of cpvar) : cpctr
function all_different(vars:cpvarlist, propagation:integer) : cpctr
function all_different(vars:cpvarlist) : cpctr
vars
|
the list of variables
|
propagation
|
Propagation type selected using a constant
KALIS_FORWARD_CHECKING,
KALIS_GEN_ARC_CONSISTENCY
|
The constraints are the following:
- All runners have different positions
- Olivier is not last
- Dominique, Pascal, and Ignace are before Naren and Olivier
- Dominique is better than third
- Philippe is among the first four
- Ignace is neither second nor third
- Pascal is three places higher than Naren
- Neither Ignace nor Dominique are in fourth position
model "all_different example" uses "kalis" declarations PEOPLE = {"Sebastian", "Frederic", "Jan-Georg", "Krzysztof","Maarten","Luca"} ! Set of speakers x: array(PEOPLE) of cpvar ! Time slot per person end-declarations 3 <= x("Sebastian") ; x("Sebastian") <= 6 3 <= x("Frederic") ; x("Frederic") <= 4 2 <= x("Jan-Georg") ; x("Jan-Georg") <= 5 2 <= x("Krzysztof") ; x("Krzysztof") <= 4 3 <= x("Maarten") ; x("Maarten") <= 4 1 <= x("Luca") ; x("Luca") <= 6 ! A different time slot for every person all_different(x) ! Solve the problem if not cp_find_next_sol then writeln("Problem is infeasible") exit(1) end-if ! Solution printout writeln(x) end-model
© 2001-2024 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.