| |||||||||||||||||||
| |||||||||||||||||||
|
Introductory example: constraint handling Description Introductory example: scheduling meetings, stated using disequality constraints; default
enumeration.
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
meeting.mos
(!****************************************************************
CP example problems
===================
file meeting.mos
````````````````
Introductory example.
(c) 2008 Artelys S.A. and Fair Isaac Corporation
*****************************************************************!)
model "Meeting"
uses "kalis"
declarations
MEETINGS = {'A','B','C','D'} ! Set of meetings
TIME = 1..3 ! Set of time slots
plan: array(MEETINGS) of cpvar ! Time slot per meeting
end-declarations
forall(m in MEETINGS) setdomain(plan(m), TIME)
! Respect incompatibilities
plan('A') <> plan('B')
plan('A') <> plan('D')
plan('B') <> plan('C')
plan('B') <> plan('D')
! Solve the problem
if not cp_find_next_sol then
writeln("Problem is infeasible")
exit(1)
end-if
! Solution printing
forall(m in MEETINGS)
writeln("Meeting ", m, ": ", getsol(plan(m)))
end-model
| |||||||||||||||||||
| © Copyright 2025 Fair Isaac Corporation. |