Skip to contents

Declares one partition of a program(): size items, each in one of parts parts (see part_var()). part_var() builds these for you.

Usage

partition_decl(size, parts, start = integer(), fixed = FALSE)

Arguments

size

How many items, at least 1.

parts

How many parts, at least 2.

start

The assignment the search starts from: start[i] is the part of item i, a whole number from 1 to parts. integer() leaves the start to the service.

fixed

Whether the partition is fixed at start, which must then be given. This is how evaluate() and resample() keep the assignment of a solution.

Value

A plain list without a class, with the fields kind = "partition", size, parts, start and fixed. It is an element of the named list a program() takes as structures, and the element's name is the name ir_struct_ref() refers to.

Examples

# five people in two teams, people 1 to 3 starting in team 1
structures <- list(teams = partition_decl(5, 2, start = c(1, 1, 1, 2, 2)))