Skip to content

Cargo Bike

The Cargo Bike is a product configuration problem written in the COOM[X*] language fragment. As this example contains unbounded cardinalities, the current encoding is not able to solve this natively. Therefore, the COOM Suite offers the --bounds option providing a simple approach which increases the maximum bound in a stepwise manner until reaching a solution. This approach is captured in the following diagram.

Workflow

The maximum bound is either increased in a linear or exponential manner. These are the two alternatives that can be supplied to the --bounds option. Furthermore, the start value for the maximum bound can be controlled with the option --initial-bound (the default is 0).

Acknowledgements

The Cargo Bike example has been provided by denkbares.

Usage

coomsuite solve examples/coom/bike/cargo-bike.coom -u examples/coom/bike/user-input-cargo.coom --bounds linear

Multi-shot solving

By default the standard COOM encoding is used when the --bounds option is active. To avoid repeatedly grounding (and solving) the same parts of the problem, the COOM suite also includes a multi-shot encoding. It can be used by adding the option --multishot.

COOM model

product {
            num /l  0-200   totalVolume
            num /l  0-200   requestedVolume
    0..*    Bag             bags
}

structure Bag {
    Color color
    Size  size
}

enumeration Color { Green Blue Red }

enumeration Size {
    attribute num weight
    attribute num volume

    small   = ( 10 12 )
    medium  = ( 15 16 )
    large   = ( 25 20 )
}

behavior {
    explanation "The total volume is equal to the sum of the volumes of all bags."
    require totalVolume = sum(bags.size.volume)

    explanation "The total volume must be greater than or equal to the requested volume."
    require totalVolume >= requestedVolume
}

Example solution

Solving with max_bound = 1
UNSATISFIABLE

Solving with max_bound = 2
UNSATISFIABLE

Solving with max_bound = 3
Answer: 1
bags[0]
bags[1]
bags[2]
requestedVolume[0] = 60
totalVolume[0]     = 60

bags[0].size[0] = "large"
bags[0].size[0].volume[0] = 20
bags[0].size[0].weight[0] = 25

bags[1].size[0] = "large"
bags[1].size[0].volume[0] = 20
bags[1].size[0].weight[0] = 25

bags[2].size[0] = "large"
bags[2].size[0].volume[0] = 20
bags[2].size[0].weight[0] = 25

SATISFIABLE