@@ -117,7 +117,7 @@ public static void main(String[] args) {
117
117
IntVar [] t2s = m .intVarArray ("t2s" ,T , 1 ,S );
118
118
sd_counter +=T ;
119
119
120
-
120
+ // UML CSP
121
121
// Stage 2 Machine Link Variables
122
122
IntVar [][] s2m = m .intVarMatrix ("s2m" ,S ,N ,0 ,M );
123
123
md_counter +=S *N ;
@@ -130,8 +130,11 @@ public static void main(String[] args) {
130
130
}
131
131
int [] machinesDomain = IntStream .range (0 , M +1 ).toArray ();
132
132
int [] charDomain = IntStream .range (0 , C +1 ).toArray ();
133
- m .globalCardinality (ArrayUtils .flatten (s2m ), machinesDomain , s2m_occ , true ).post ();;
133
+ m .globalCardinality (ArrayUtils .flatten (s2m ), machinesDomain , s2m_occ , true ).post (); //containment
134
+
134
135
136
+
137
+ // OCL CSP
135
138
// Stage 2 Machine Size CSPs
136
139
for (int i =0 ;i <S ;i ++){
137
140
IntVar darc = m .count ("darc" , 0 , s2m [i ]);
@@ -244,6 +247,19 @@ public static void main(String[] args) {
244
247
Solution solution = m .getSolver ().findSolution ();
245
248
if (solution != null ){
246
249
// System.out.println(solution.toString());
250
+
251
+ for (int i =0 ;i <T ;i ++){
252
+ System .out .println ("Task " +(i +1 )+" : stage=" +t2s [i ].getValue ());
253
+ }
254
+
255
+ for (int i =0 ;i <S ;i ++) {
256
+ String out = "Stage " +(i +1 )+" : machines={" +s2m [i ][0 ].getValue ();
257
+ for (int j =1 ;j <N ;j ++){
258
+ out += "," +s2m [i ][j ].getValue ();
259
+ }
260
+ System .out .println (out +"}" );
261
+ }
262
+
247
263
m .getSolver ().printStatistics ();
248
264
} else {
249
265
System .out .println ("mmh" );
0 commit comments