generated from potassco/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravel-bike-simplified.lp
140 lines (127 loc) · 6.44 KB
/
travel-bike-simplified.lp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
part("product").
part("Carrier").
part("Frame").
integer("product.totalVolume").
range("product.totalVolume",0,200).
integer("product.requestedVolume").
range("product.requestedVolume",200,200).
discrete("Bag").
domain("Bag","B20").
domain("Bag","B50").
domain("Bag","B100").
discrete("Bag.volume").
domain("Bag.volume",20).
domain("Bag.volume",50).
domain("Bag.volume",100).
type("root","product").
type("root.totalVolume[0]","product.totalVolume").
type("root.requestedVolume[0]","product.requestedVolume").
type("root.carrier[0]","Carrier").
type("root.frame[0]","Frame").
type("root.frame[0].bag[0]","Bag").
type("root.frame[0].bag[1]","Bag").
type("root.carrier[0].bag[0]","Bag").
type("root.carrier[0].bag[1]","Bag").
type("root.carrier[0].bag[2]","Bag").
type("root.frame[0].bag[0].volume[0]","Bag.volume").
type("root.frame[0].bag[1].volume[0]","Bag.volume").
type("root.carrier[0].bag[0].volume[0]","Bag.volume").
type("root.carrier[0].bag[1].volume[0]","Bag.volume").
type("root.carrier[0].bag[2].volume[0]","Bag.volume").
index("root.totalVolume[0]",0).
index("root.requestedVolume[0]",0).
index("root.carrier[0]",0).
index("root.frame[0]",0).
index("root.frame[0].bag[0]",0).
index("root.frame[0].bag[1]",1).
index("root.carrier[0].bag[0]",0).
index("root.carrier[0].bag[1]",1).
index("root.carrier[0].bag[2]",2).
index("root.carrier[0].bag[2].volume[0]",0).
index("root.carrier[0].bag[1].volume[0]",0).
index("root.carrier[0].bag[0].volume[0]",0).
index("root.frame[0].bag[1].volume[0]",0).
index("root.frame[0].bag[0].volume[0]",0).
parent("root.totalVolume[0]","root").
parent("root.requestedVolume[0]","root").
parent("root.carrier[0]","root").
parent("root.frame[0]","root").
parent("root.frame[0].bag[0]","root.frame[0]").
parent("root.frame[0].bag[1]","root.frame[0]").
parent("root.carrier[0].bag[0]","root.carrier[0]").
parent("root.carrier[0].bag[1]","root.carrier[0]").
parent("root.carrier[0].bag[2]","root.carrier[0]").
parent("root.carrier[0].bag[2].volume[0]","root.carrier[0].bag[2]").
parent("root.carrier[0].bag[1].volume[0]","root.carrier[0].bag[1]").
parent("root.carrier[0].bag[0].volume[0]","root.carrier[0].bag[0]").
parent("root.frame[0].bag[1].volume[0]","root.frame[0].bag[1]").
parent("root.frame[0].bag[0].volume[0]","root.frame[0].bag[0]").
constraint((0,"count(root.carrier.bag)+count(root.frame.bag)<=4"),"boolean").
binary("count(root.carrier.bag)+count(root.frame.bag)<=4","count(root.carrier.bag)+count(root.frame.bag)","<=","4").
binary("count(root.carrier.bag)+count(root.frame.bag)","count(root.carrier.bag)","+","count(root.frame.bag)").
function("count(root.carrier.bag)","count","root.carrier.bag").
set("root.carrier[0].bag[0]","root.carrier.bag").
set("root.carrier[0].bag[1]","root.carrier.bag").
set("root.carrier[0].bag[2]","root.carrier.bag").
function("count(root.frame.bag)","count","root.frame.bag").
set("root.frame[0].bag[0]","root.frame.bag").
set("root.frame[0].bag[1]","root.frame.bag").
number("4",4).
constraint((1,"root.totalVolume[0]=sum(root.carrier.bag.volume)+sum(root.frame.bag.volume)"),"boolean").
binary("root.totalVolume[0]=sum(root.carrier.bag.volume)+sum(root.frame.bag.volume)","root.totalVolume[0]","=","sum(root.carrier.bag.volume)+sum(root.frame.bag.volume)").
binary("sum(root.carrier.bag.volume)+sum(root.frame.bag.volume)","sum(root.carrier.bag.volume)","+","sum(root.frame.bag.volume)").
function("sum(root.carrier.bag.volume)","sum","root.carrier.bag.volume").
set("root.carrier[0].bag[2].volume[0]","root.carrier.bag.volume").
set("root.carrier[0].bag[1].volume[0]","root.carrier.bag.volume").
set("root.carrier[0].bag[0].volume[0]","root.carrier.bag.volume").
function("sum(root.frame.bag.volume)","sum","root.frame.bag.volume").
set("root.frame[0].bag[1].volume[0]","root.frame.bag.volume").
set("root.frame[0].bag[0].volume[0]","root.frame.bag.volume").
constraint((2,"root.totalVolume[0]>=root.requestedVolume[0]"),"boolean").
binary("root.totalVolume[0]>=root.requestedVolume[0]","root.totalVolume[0]",">=","root.requestedVolume[0]").
constraint(("Bag","root.frame[0].bag[0]"),"table").
constraint(("Bag","root.frame[0].bag[1]"),"table").
constraint(("Bag","root.carrier[0].bag[0]"),"table").
constraint(("Bag","root.carrier[0].bag[1]"),"table").
constraint(("Bag","root.carrier[0].bag[2]"),"table").
column(("Bag","root.frame[0].bag[0]"),0,1,"root.frame[0].bag[0].volume[0]").
column(("Bag","root.frame[0].bag[1]"),0,1,"root.frame[0].bag[1].volume[0]").
column(("Bag","root.carrier[0].bag[0]"),0,1,"root.carrier[0].bag[0].volume[0]").
column(("Bag","root.carrier[0].bag[1]"),0,1,"root.carrier[0].bag[1].volume[0]").
column(("Bag","root.carrier[0].bag[2]"),0,1,"root.carrier[0].bag[2].volume[0]").
column(("Bag","root.frame[0].bag[0]"),0,0,"root.frame[0].bag[0]").
column(("Bag","root.frame[0].bag[1]"),0,0,"root.frame[0].bag[1]").
column(("Bag","root.carrier[0].bag[0]"),0,0,"root.carrier[0].bag[0]").
column(("Bag","root.carrier[0].bag[1]"),0,0,"root.carrier[0].bag[1]").
column(("Bag","root.carrier[0].bag[2]"),0,0,"root.carrier[0].bag[2]").
allow("Bag",(0,1),"B20").
allow("Bag",(0,2),"B50").
allow("Bag",(0,0),"B100").
allow("Bag",(1,0),100).
allow("Bag",(1,2),50).
allow("Bag",(1,1),20).
constraint(("root.totalVolume",1),"lowerbound").
constraint(("root.requestedVolume",1),"lowerbound").
constraint(("root.carrier",1),"lowerbound").
constraint(("root.frame",1),"lowerbound").
constraint(("root.carrier[0].bag",0),"lowerbound").
constraint(("root.frame[0].bag",0),"lowerbound").
constraint(("root.frame[0].bag[0].volume",1),"lowerbound").
constraint(("root.frame[0].bag[1].volume",1),"lowerbound").
constraint(("root.carrier[0].bag[0].volume",1),"lowerbound").
constraint(("root.carrier[0].bag[1].volume",1),"lowerbound").
constraint(("root.carrier[0].bag[2].volume",1),"lowerbound").
set("root.totalVolume[0]","root.totalVolume").
set("root.requestedVolume[0]","root.requestedVolume").
set("root.carrier[0]","root.carrier").
set("root.frame[0]","root.frame").
set("root.carrier[0].bag[0]","root.carrier[0].bag").
set("root.carrier[0].bag[1]","root.carrier[0].bag").
set("root.carrier[0].bag[2]","root.carrier[0].bag").
set("root.frame[0].bag[0]","root.frame[0].bag").
set("root.frame[0].bag[1]","root.frame[0].bag").
set("root.frame[0].bag[0].volume[0]","root.frame[0].bag[0].volume").
set("root.frame[0].bag[1].volume[0]","root.frame[0].bag[1].volume").
set("root.carrier[0].bag[0].volume[0]","root.carrier[0].bag[0].volume").
set("root.carrier[0].bag[1].volume[0]","root.carrier[0].bag[1].volume").
set("root.carrier[0].bag[2].volume[0]","root.carrier[0].bag[2].volume").