consumes
A task consumes some amount of processing power of a resource when this amount must be made available for the execution of the task. The resource requirement is considered as renewable which means that whenever the tasks ends The processing power that was required is no longer available for processing other tasks. Note that a minimal amount of 0 is possible thus allowing modeling of alternative resources. The type of resource consumption can be defined in several ways:
- By specifying a resource and a constant consumption parameter 'consumption'. In this case the resource consumption is constant other the execution of the task.
- By specifying a resource and a minimal 'minCons' and maximal 'maxCons' consumption parameters: In this case the resource consumption is a decision variable but is constant other the execution of the task.
- By specifying a cpresusage 'usage' (see resusage for further detail).
- By a set of alternative cpresusage 'optUsages': This makes it possible to model alternative resources. The type of resource consumption is defined by the resource usage passed in argument (see resusage for further detail).
- By a set of alternative cpresusage 'optUsages' , a minimal 'minalt' and a maximal 'maxalt' number of alternative resources that must be consumed: Between [minalt..maxalt] alternative consumptions from the set defined will be active which means that several resources will be chosen to be consumed by the task. The type of resource consumption is defined by the resource usage passed in argument (see resusage for further detail).
procedure consumes(task:cptask, consumption:integer, resource:cpresource)
procedure consumes(task:cptask, consumptionMin:integer, consumptionMax, resource:cpresource)
procedure consumes(task:cptask, usage:cpresusage)
procedure consumes(task:cptask, optUsages:set of cpresusage)
procedure consumes(task:cptask, optUsages:set of cpresusage, minalt:integer, maxalt:integer)
task
|
the task
|
consumption
|
constant positive resource consumption
|
minCons
|
minimal resource consumption
|
maxCons
|
maximal resource consumption
|
resource
|
the resource to be consumed
|
usage
|
the resource usage
|
optUsages
|
the set of alternatives resource consumption
|
minalt
|
minimal number of resources that must be consumed
|
maxalt
|
maximal number of resources that may be consumed
|

model "Producer Consumer" uses "kalis" declarations Masonry, Carpentry, Roofing, Windows, Facade, Garden, Plumbing, Ceiling, Painting, MovingIn : cptask ! Declaration of tasks money_available : cpresource ! Resource declaration end-declarations ! 'money_available' is a cumulative resource with max. amount of 29$ set_resource_attributes(money_available,KALIS_DISCRETE_RESOURCE,29) ! Limit resource availability to 20$ in the time interval [0,14] setcapacity(money_available, 0, 14, 20) ! Setting the task durations and predecessor sets set_task_attributes(Masonry , 7 ) set_task_attributes(Carpentry, 3, {Masonry} ) set_task_attributes(Roofing , 1, {Carpentry} ) set_task_attributes(Windows , 1, {Roofing} ) set_task_attributes(Facade , 2, {Roofing} ) set_task_attributes(Garden , 1, {Roofing} ) set_task_attributes(Plumbing , 8, {Masonry} ) set_task_attributes(Ceiling , 3, {Masonry} ) set_task_attributes(Painting , 2, {Ceiling} ) set_task_attributes(MovingIn , 1, {Windows,Facade,Garden,Painting}) ! Setting the resource consumptions consumes(Masonry , 7, money_available ) consumes(Carpentry, 3, money_available ) consumes(Roofing , 1, money_available ) consumes(Windows , 1, money_available ) consumes(Facade , 2, money_available ) consumes(Garden , 1, money_available ) consumes(Plumbing , 8, money_available ) consumes(Ceiling , 3, money_available ) consumes(Painting , 2, money_available ) consumes(MovingIn , 1, money_available ) ! Find the optimal schedule (minimizing the makespan) if cp_minimize(getmakespan) then cp_show_sol else writeln("No solution found") end-if end-model
© 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.