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¶
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))
}