Skip to content

City Bike

The City Bike is a product configuration problem written in the COOM[P] language fragment. It contains a simple partonomy with cardinalities different than 1, including optional parts.

Usage

coomsuite solve examples/coom/city-bike.coom

COOM model

product {
            Color   color
    0..1    Basket  basket
            Saddle  saddle
            Wheel   frontWheel
            Wheel   rearWheel
            Carrier carrier
}

structure Basket {
    Position    position
    Color       color
}

structure Carrier {
    0..2 Bag bag
}

structure Bag {
    Capacity capacity
    Material material
}

enumeration Color {
    Silver
    White
    Black
    Blue
}

enumeration Position {
    Front
    Back
}

enumeration Saddle {
    Standard
    Comfort
    Vintage
}

enumeration Wheel {
    attribute num size

    W26 = (  26 )
    W27 = (  27 )
    W28 = (  28 )
    W29 = (  29 )
}

enumeration Capacity {
    attribute num volume

    B10  = ( 10 )
    B20  = ( 20 )
    B50  = ( 50 )
    B100 = (100 )
}

enumeration Material {
    Cotton
    Leather
    Polyester
}

behavior {
    explanation "The color of the bike must match the color of the basket."
    require color = basket.color

    explanation "If the basket is mounted on the front, the front wheel size must be less than 29."
    condition basket.position = Front
    require frontWheel.size < 29

    explanation "If a bag has volume 100, then the size of the rear wheel must be at least 28."
    condition carrier.bag.capacity.volume = 100
    require rearWheel.size >= 28

    explanation "If the saddle is vintage, then the bag must be made of leather."
    condition saddle = Vintage
    require carrier.bag.material = Leather

    explanation "The size of the front wheel must be equal to the size of the rear wheel."
    require frontWheel.size = rearWheel.size
}

behavior Bag {
    combinations  (material     capacity)
    allow         (Leather      B10             )
    allow         (Cotton       (B20, B50)      )
    allow         (Polyester    (B20, B50, B100))
}

Example solution

basket[0]
carrier[0]
saddle[0] = "Comfort"
color[0] = "Blue"
frontWheel[0] = "W29"
frontWheel[0].size[0] = 29
rearWheel[0] = "W29"
rearWheel[0].size[0] = 29
basket[0].color[0] = "Blue"
basket[0].position[0] = "Back"