diff options
Diffstat (limited to 'Domains/crossingScenario/queries/crossingScenarioQueries.vql')
-rw-r--r-- | Domains/crossingScenario/queries/crossingScenarioQueries.vql | 280 |
1 files changed, 199 insertions, 81 deletions
diff --git a/Domains/crossingScenario/queries/crossingScenarioQueries.vql b/Domains/crossingScenario/queries/crossingScenarioQueries.vql index 2b67e14c..d1c72820 100644 --- a/Domains/crossingScenario/queries/crossingScenarioQueries.vql +++ b/Domains/crossingScenario/queries/crossingScenarioQueries.vql | |||
@@ -223,17 +223,23 @@ pattern define_placedOn_actorOnHorizLane(a : Actor, hl:Lane_Horizontal) { | |||
223 | //Actor | 223 | //Actor |
224 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 224 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |
225 | 225 | ||
226 | /////---------------- | ||
226 | //Xpos and Ypos Bounds | 227 | //Xpos and Ypos Bounds |
228 | /////---------------- | ||
227 | 229 | ||
228 | private pattern helper_getXAndBounds(cs:CrossingScenario, a:Actor, | 230 | private pattern helper_horiz_getXAndBounds(cs:CrossingScenario, a:Actor, |
229 | xMax:java Double, xP:java Double) { | 231 | xMax:java Double, xP:java Double) { |
232 | Actor.placedOn(a, hl); | ||
233 | Lane_Horizontal(hl); | ||
230 | CrossingScenario.actors(cs, a); | 234 | CrossingScenario.actors(cs, a); |
231 | CrossingScenario.xSize(cs, xMax); | 235 | CrossingScenario.xSize(cs, xMax); |
232 | Actor.xPos(a, xP); | 236 | Actor.xPos(a, xP); |
233 | } | 237 | } |
234 | 238 | ||
235 | private pattern helper_getYAndBounds(cs:CrossingScenario, a:Actor, | 239 | private pattern helper_vert_getYAndBounds(cs:CrossingScenario, a:Actor, |
236 | yMax:java Double, yP:java Double) { | 240 | yMax:java Double, yP:java Double) { |
241 | Actor.placedOn(a, vl); | ||
242 | Lane_Vertical(vl); | ||
237 | CrossingScenario.actors(cs, a); | 243 | CrossingScenario.actors(cs, a); |
238 | CrossingScenario.ySize(cs, yMax); | 244 | CrossingScenario.ySize(cs, yMax); |
239 | Actor.yPos(a, yP); | 245 | Actor.yPos(a, yP); |
@@ -241,87 +247,109 @@ private pattern helper_getYAndBounds(cs:CrossingScenario, a:Actor, | |||
241 | 247 | ||
242 | @Constraint(severity="error", key={cs}, message="x") | 248 | @Constraint(severity="error", key={cs}, message="x") |
243 | pattern define_actor_maxXp(cs:CrossingScenario, a:Actor) { | 249 | pattern define_actor_maxXp(cs:CrossingScenario, a:Actor) { |
244 | Actor.placedOn(a, hl); | 250 | find helper_horiz_getXAndBounds(cs, a, xMax, xP); |
245 | Lane_Horizontal(hl); | ||
246 | find helper_getXAndBounds(cs, a, xMax, xP); | ||
247 | check(xP >= xMax);} | 251 | check(xP >= xMax);} |
248 | 252 | ||
249 | @Constraint(severity="error", key={cs}, message="x") | 253 | @Constraint(severity="error", key={cs}, message="x") |
250 | pattern define_actor_minXp(cs:CrossingScenario, a:Actor) { | 254 | pattern define_actor_minXp(cs:CrossingScenario, a:Actor) { |
251 | Actor.placedOn(a, hl); | 255 | find helper_horiz_getXAndBounds(cs, a, xMax, xP); |
252 | Lane_Horizontal(hl); | ||
253 | find helper_getXAndBounds(cs, a, xMax, xP); | ||
254 | check(xP <= 0-xMax);} | 256 | check(xP <= 0-xMax);} |
255 | 257 | ||
256 | @Constraint(severity="error", key={cs}, message="x") | 258 | @Constraint(severity="error", key={cs}, message="x") |
257 | pattern define_actor_maxYp(cs:CrossingScenario, a:Actor) { | 259 | pattern define_actor_maxYp(cs:CrossingScenario, a:Actor) { |
258 | Actor.placedOn(a, vl); | 260 | find helper_vert_getYAndBounds(cs, a, yMax, yP); |
259 | Lane_Vertical(vl); | ||
260 | find helper_getYAndBounds(cs, a, yMax, yP); | ||
261 | check(yP >= yMax);} | 261 | check(yP >= yMax);} |
262 | 262 | ||
263 | @Constraint(severity="error", key={cs}, message="x") | 263 | @Constraint(severity="error", key={cs}, message="x") |
264 | pattern define_actor_minYp(cs:CrossingScenario, a:Actor) { | 264 | pattern define_actor_minYp(cs:CrossingScenario, a:Actor) { |
265 | Actor.placedOn(a, vl); | 265 | find helper_vert_getYAndBounds(cs, a, yMax, yP); |
266 | Lane_Vertical(vl); | ||
267 | find helper_getYAndBounds(cs, a, yMax, yP); | ||
268 | check(yP <= 0-yMax);} | 266 | check(yP <= 0-yMax);} |
269 | 267 | ||
268 | /////---------------- | ||
270 | //Xspeed and Yspeed bounds | 269 | //Xspeed and Yspeed bounds |
270 | /////---------------- | ||
271 | 271 | ||
272 | //TODO THIS IS HARD_CODED | 272 | //TODO THIS IS HARD_CODED |
273 | //@Constraint(severity="error", key={a}, message="x") | ||
274 | //pattern define_actor_maxXs(a:Actor) { | ||
275 | // Actor.xSpeed(a, xS); | ||
276 | // check(xS >= 100.0);} | ||
277 | // | ||
278 | //@Constraint(severity="error", key={a}, message="x") | ||
279 | //pattern define_actor_minXs(a:Actor) { | ||
280 | // Actor.xSpeed(a, xS); | ||
281 | // check(xS <= 0-100.0);} | ||
282 | // | ||
283 | ////TODO THIS IS HARD_CODED | ||
284 | //@Constraint(severity="error", key={a}, message="x") | ||
285 | //pattern define_actor_maxYs(a:Actor) { | ||
286 | // Actor.ySpeed(a, yS); | ||
287 | // check(yS >= 100.0);} | ||
288 | // | ||
289 | //@Constraint(severity="error", key={a}, message="x") | ||
290 | //pattern define_actor_minYs(a:Actor) { | ||
291 | // Actor.ySpeed(a, yS); | ||
292 | // check(yS <= 0-100.0);} | ||
293 | //END Hard-coded stuff | ||
294 | |||
295 | ////TODO May be required | ||
296 | /////////xPos of every actor mmust be within bounds defined in CS | ||
297 | //@Constraint(severity="error", key={l}, message="1 Actor") | ||
298 | //pattern define_actor_xPosWithinCSbounds(cs:CrossingScenario, a:Actor) { | ||
299 | // | ||
300 | //} | ||
301 | // | ||
302 | ////TODO May be required | ||
303 | /////////yPos of every actor mmust be within bounds defined in CS | ||
304 | //@Constraint(severity="error", key={l}, message="2 Actor") | ||
305 | //pattern define_actor_yPosWithinCSbounds(cs:CrossingScenario, a:Actor) { | ||
306 | // | ||
307 | //} | ||
308 | 273 | ||
274 | /////////VERTICAL LANE | ||
275 | @Constraint(severity="error", key={a}, message="7 Actor") | ||
276 | pattern define_actor_actorOnVertLaneHasxSpeed0(a:Actor) { | ||
277 | Actor.placedOn(a, vl); | ||
278 | Lane_Vertical(vl); | ||
279 | Actor.xSpeed(a, xSpeed); | ||
280 | check(xSpeed != 0); | ||
281 | } | ||
282 | |||
283 | private pattern helper_vert_getYSpeedAndBounds(cs:CrossingScenario, a:Actor, | ||
284 | ySpeedMax:java Double, ySpeed:java Double) { | ||
285 | Actor.placedOn(a, vl); | ||
286 | Lane_Vertical(vl); | ||
287 | CrossingScenario.actors(cs, a); | ||
288 | CrossingScenario.maxYSpeed(cs, ySpeedMax); | ||
289 | Actor.ySpeed(a, ySpeed); | ||
290 | } | ||
291 | |||
292 | @Constraint(severity="error", key={cs}, message="x") | ||
293 | pattern define_actor_actorOnVertLaneMinYs(cs:CrossingScenario, a:Actor) { | ||
294 | find helper_vert_getYSpeedAndBounds(cs, a, ySMax, yS); | ||
295 | check(yS <= 0-ySMax); | ||
296 | } | ||
297 | |||
298 | @Constraint(severity="error", key={cs}, message="x") | ||
299 | pattern define_actor_actorOnVertLaneMaxYs(cs:CrossingScenario, a:Actor) { | ||
300 | find helper_vert_getYSpeedAndBounds(cs, a, ySMax, yS); | ||
301 | check(yS >= ySMax); | ||
302 | } | ||
303 | |||
304 | /////////HORIZONTAL LANE | ||
305 | @Constraint(severity="error", key={a}, message="7 Actor") | ||
306 | pattern define_actor_actorOnHorizLaneHasySpeed0(a:Actor) { | ||
307 | Actor.placedOn(a, hl); | ||
308 | Lane_Horizontal(hl); | ||
309 | Actor.ySpeed(a, ySpeed); | ||
310 | check(ySpeed != 0); | ||
311 | } | ||
312 | |||
313 | private pattern helper_horiz_getXSpeedAndBounds(cs:CrossingScenario, a:Actor, | ||
314 | xSpeedMax:java Double, xSpeed:java Double) { | ||
315 | Actor.placedOn(a, hl); | ||
316 | Lane_Horizontal(hl); | ||
317 | CrossingScenario.actors(cs, a); | ||
318 | CrossingScenario.maxXSpeed(cs, xSpeedMax); | ||
319 | Actor.xSpeed(a, xSpeed); | ||
320 | } | ||
321 | |||
322 | @Constraint(severity="error", key={cs}, message="x") | ||
323 | pattern define_actor_actorOnHorizLaneMinXs(cs:CrossingScenario, a:Actor) { | ||
324 | find helper_horiz_getXSpeedAndBounds(cs, a, xSMax, xS); | ||
325 | check(xS <= 0-xSMax); | ||
326 | } | ||
327 | |||
328 | @Constraint(severity="error", key={cs}, message="x") | ||
329 | pattern define_actor_actorOnHorizLaneMaxXs(cs:CrossingScenario, a:Actor) { | ||
330 | find helper_horiz_getXSpeedAndBounds(cs, a, xSMax, xS); | ||
331 | check(xS >= xSMax); | ||
332 | } | ||
333 | |||
334 | /////---------------- | ||
335 | /////WIDTH and LENGTH | ||
336 | /////---------------- | ||
309 | 337 | ||
310 | ///////pedestrian-width (3) //TODO Derived? | 338 | ///////pedestrian-width (3) |
311 | @Constraint(severity="error", key={p}, message="3 Actor") | 339 | @Constraint(severity="error", key={p}, message="3 Actor") |
312 | pattern define_actor_pedestrianWidth(p:Pedestrian) { | 340 | pattern define_actor_pedestrianWidth(p:Pedestrian) { |
313 | Pedestrian.width(p, w); | 341 | Pedestrian.width(p, w); |
314 | check(w != 1.0); | 342 | check(w != 1.0); |
315 | } | 343 | } |
316 | 344 | ||
317 | /////////pedestrian-width (4) //TODO Derived? | 345 | /////////pedestrian-width (4) |
318 | @Constraint(severity="error", key={p}, message="4 Actor") | 346 | @Constraint(severity="error", key={p}, message="4 Actor") |
319 | pattern define_actor_pedestrianLength(p:Pedestrian) { | 347 | pattern define_actor_pedestrianLength(p:Pedestrian) { |
320 | Pedestrian.length(p, l); | 348 | Pedestrian.length(p, l); |
321 | check(l != 1.0); | 349 | check(l != 1.0); |
322 | } | 350 | } |
323 | 351 | ||
324 | /////////actor-width (5) //TODO Derived? | 352 | /////////actor-width (5) |
325 | @Constraint(severity="error", key={v}, message="5 Actor") | 353 | @Constraint(severity="error", key={v}, message="5 Actor") |
326 | pattern define_actor_vehicleWidth(v:Vehicle) { | 354 | pattern define_actor_vehicleWidth(v:Vehicle) { |
327 | Vehicle.placedOn(v, lane); | 355 | Vehicle.placedOn(v, lane); |
@@ -335,7 +363,7 @@ pattern define_actor_vehicleWidth(v:Vehicle) { | |||
335 | check(w != 3.0); | 363 | check(w != 3.0); |
336 | } | 364 | } |
337 | 365 | ||
338 | /////////actor-width (6) //TODO Derived? | 366 | /////////actor-width (6) |
339 | @Constraint(severity="error", key={v}, message="6 Actor") | 367 | @Constraint(severity="error", key={v}, message="6 Actor") |
340 | pattern define_actor_vehicleLength(v:Vehicle) { | 368 | pattern define_actor_vehicleLength(v:Vehicle) { |
341 | Vehicle.placedOn(v, lane); | 369 | Vehicle.placedOn(v, lane); |
@@ -349,23 +377,10 @@ pattern define_actor_vehicleLength(v:Vehicle) { | |||
349 | check(l != 1.0); | 377 | check(l != 1.0); |
350 | } | 378 | } |
351 | 379 | ||
352 | /////////xSpeed of actor on verticalLane is 0 | 380 | /////---------------- |
353 | @Constraint(severity="error", key={a}, message="7 Actor") | 381 | /////DERIVED FEATURES |
354 | pattern define_actor_actorOnVertLaneHasxSpeed0(a:Actor, vl:Lane_Vertical) { | 382 | /////---------------- |
355 | Actor.placedOn(a, vl); | ||
356 | Actor.xSpeed(a, xSpeed); | ||
357 | check(xSpeed != 0); | ||
358 | } | ||
359 | |||
360 | /////////ySpeed of actor on horizontalLane is 0 | ||
361 | @Constraint(severity="error", key={a}, message="8 Actor") | ||
362 | pattern define_actor_actorOnHoriLaneHasySpeed0(a:Actor, hl:Lane_Horizontal) { | ||
363 | Actor.placedOn(a, hl); | ||
364 | Actor.ySpeed(a, ySpeed); | ||
365 | check(ySpeed != 0); | ||
366 | } | ||
367 | 383 | ||
368 | //<<NEW>> Derived Features | ||
369 | private pattern helper_getCoords(a1:Actor, | 384 | private pattern helper_getCoords(a1:Actor, |
370 | a2: Actor, x1:java Double, x2:java Double, y1:java Double, y2:java Double) { | 385 | a2: Actor, x1:java Double, x2:java Double, y1:java Double, y2:java Double) { |
371 | Actor.xPos(a1, x1); | 386 | Actor.xPos(a1, x1); |
@@ -410,8 +425,6 @@ private pattern helper_actorsAreFar(a1: Actor, a2: Actor) { | |||
410 | //check(dx^2 + dy^2 > 20^2) | 425 | //check(dx^2 + dy^2 > 20^2) |
411 | check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) > 20*20); | 426 | check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) > 20*20); |
412 | } | 427 | } |
413 | |||
414 | //<<END NEW>> | ||
415 | 428 | ||
416 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 429 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |
417 | //Relation | 430 | //Relation |
@@ -428,7 +441,57 @@ pattern define_relation_noSelfRelation(a1:Actor, a2:Actor) { | |||
428 | //////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 441 | //////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |
429 | //CollisionExists | 442 | //CollisionExists |
430 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 443 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |
431 | 444 | ||
445 | |||
446 | //<<QUALTATIF ABSTRACTION>> | ||
447 | |||
448 | @Constraint(severity="error", key={a1, a2}, message="x") | ||
449 | pattern collisionExists_qualAbstr(a1:Actor, a2:Actor) { | ||
450 | CollisionExists.source(ce, a1); | ||
451 | CollisionExists.target(ce, a2); | ||
452 | Actor.placedOn(a1, vl1); | ||
453 | Lane_Vertical(vl1); | ||
454 | Actor.placedOn(a2, vl2); | ||
455 | Lane_Vertical(vl2); | ||
456 | } or { | ||
457 | CollisionExists.source(ce, a1); | ||
458 | CollisionExists.target(ce, a2); | ||
459 | Actor.placedOn(a1, hl1); | ||
460 | Lane_Horizontal(hl1); | ||
461 | Actor.placedOn(a2, hl2); | ||
462 | Lane_Horizontal(hl2); | ||
463 | } | ||
464 | |||
465 | //<<END QUALITATIF ABSTRACTION>> | ||
466 | /* | ||
467 | //// | ||
468 | //VS VisionBlocked | ||
469 | //// | ||
470 | //TODO Very prone to corner cases | ||
471 | |||
472 | @Constraint(severity="error", key={a1, a2}, message="x") | ||
473 | pattern collisionExists_vsVisionBlocked(a1:Actor, a2:Actor) { | ||
474 | VisionBlocked.source(vb, a1); | ||
475 | VisionBlocked.target(vb, a2); | ||
476 | neg find helper_collidingActors(a1, a2); | ||
477 | } or { | ||
478 | VisionBlocked.source(vb, a1); | ||
479 | VisionBlocked.target(vb, a2); | ||
480 | neg find helper_collidingActors(a2, a1); | ||
481 | } | ||
482 | |||
483 | private pattern helper_collidingActors(a1:Actor, a2:Actor){ | ||
484 | CollisionExists.source(vb, a1); | ||
485 | CollisionExists.target(vb, a2); | ||
486 | } | ||
487 | |||
488 | //<<END QUALITATIF ABSTRACTION>> | ||
489 | |||
490 | //// | ||
491 | //CollisionExists - Time | ||
492 | //// | ||
493 | |||
494 | |||
432 | @Constraint(severity="error", key={c}, message="x") | 495 | @Constraint(severity="error", key={c}, message="x") |
433 | pattern collisionExists_timeWithinBound(ss:CrossingScenario, c:CollisionExists) { | 496 | pattern collisionExists_timeWithinBound(ss:CrossingScenario, c:CollisionExists) { |
434 | CrossingScenario.relations(ss, c); | 497 | CrossingScenario.relations(ss, c); |
@@ -441,6 +504,10 @@ pattern collisionExists_timeNotNegative(c:CollisionExists) { | |||
441 | CollisionExists. collisionTime(c, cTime); | 504 | CollisionExists. collisionTime(c, cTime); |
442 | check(cTime <= 0.0);} | 505 | check(cTime <= 0.0);} |
443 | 506 | ||
507 | //// | ||
508 | //CollisionExists - Physical Positioniung | ||
509 | //// | ||
510 | |||
444 | private pattern helper_getCollExistsTime(a1:Actor, a2: Actor, cTime:java Double) { | 511 | private pattern helper_getCollExistsTime(a1:Actor, a2: Actor, cTime:java Double) { |
445 | CollisionExists.source(c, a1); | 512 | CollisionExists.source(c, a1); |
446 | CollisionExists.target(c, a2); | 513 | CollisionExists.target(c, a2); |
@@ -459,6 +526,8 @@ private pattern helper_getAllYCoords(a1:Actor, a2: Actor, | |||
459 | l1:java Double, l2:java Double, yPos1:java Double, yPos2:java Double, | 526 | l1:java Double, l2:java Double, yPos1:java Double, yPos2:java Double, |
460 | ySpeed1:java Double, ySpeed2:java Double) { | 527 | ySpeed1:java Double, ySpeed2:java Double) { |
461 | 528 | ||
529 | CollisionExists.source(c, a1); | ||
530 | CollisionExists.target(c, a2); | ||
462 | find helper_getYCoords(a1, l1, yPos1, ySpeed1); | 531 | find helper_getYCoords(a1, l1, yPos1, ySpeed1); |
463 | find helper_getYCoords(a2, l2, yPos2, ySpeed2); | 532 | find helper_getYCoords(a2, l2, yPos2, ySpeed2); |
464 | } | 533 | } |
@@ -474,9 +543,11 @@ private pattern helper_getXCoords(a:Actor, l:java Double, | |||
474 | private pattern helper_getAllXCoords(a1:Actor, a2: Actor, | 543 | private pattern helper_getAllXCoords(a1:Actor, a2: Actor, |
475 | w1:java Double, w2:java Double, xPos1:java Double, xPos2:java Double, | 544 | w1:java Double, w2:java Double, xPos1:java Double, xPos2:java Double, |
476 | xSpeed1:java Double, xSpeed2:java Double) { | 545 | xSpeed1:java Double, xSpeed2:java Double) { |
477 | 546 | ||
478 | find helper_getYCoords(a1, w1, xPos1, xSpeed1); | 547 | CollisionExists.source(c, a1); |
479 | find helper_getYCoords(a2, w2, xPos2, xSpeed2); | 548 | CollisionExists.target(c, a2); |
549 | find helper_getXCoords(a1, w1, xPos1, xSpeed1); | ||
550 | find helper_getXCoords(a2, w2, xPos2, xSpeed2); | ||
480 | } | 551 | } |
481 | 552 | ||
482 | @Constraint(severity="error", key={a1}, message="x") | 553 | @Constraint(severity="error", key={a1}, message="x") |
@@ -504,7 +575,7 @@ pattern collisionExists_defineCollision_y2(a1:Actor, a2:Actor) { | |||
504 | pattern collisionExists_defineCollision_x1(a1:Actor, a2:Actor) { | 575 | pattern collisionExists_defineCollision_x1(a1:Actor, a2:Actor) { |
505 | 576 | ||
506 | find helper_getCollExistsTime(a1, a2, cTime); | 577 | find helper_getCollExistsTime(a1, a2, cTime); |
507 | find helper_getAllYCoords(a1, a2, w1, w2, xPos1, xPos2, xSpeed1, xSpeed2); | 578 | find helper_getAllXCoords(a1, a2, w1, w2, xPos1, xPos2, xSpeed1, xSpeed2); |
508 | 579 | ||
509 | //check(x_1_left > x_2_right) | 580 | //check(x_1_left > x_2_right) |
510 | check((xPos1 + (xSpeed1 * cTime)) - (w1/2) > (xPos2 + (xSpeed2 * cTime)) + (w2/2)); | 581 | check((xPos1 + (xSpeed1 * cTime)) - (w1/2) > (xPos2 + (xSpeed2 * cTime)) + (w2/2)); |
@@ -515,13 +586,13 @@ pattern collisionExists_defineCollision_x2(a1:Actor, a2:Actor) { | |||
515 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 | 586 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 |
516 | 587 | ||
517 | find helper_getCollExistsTime(a1, a2, cTime); | 588 | find helper_getCollExistsTime(a1, a2, cTime); |
518 | find helper_getAllYCoords(a1, a2, w1, w2, xPos1, xPos2, xSpeed1, xSpeed2); | 589 | find helper_getAllXCoords(a1, a2, w1, w2, xPos1, xPos2, xSpeed1, xSpeed2); |
519 | 590 | ||
520 | //check(x_1_right < x_2_left) | 591 | //check(x_1_right < x_2_left) |
521 | check((xPos1 + (xSpeed1 * cTime)) + (w1/2) < (xPos2 + (xSpeed2 * cTime)) - (w2/2)); | 592 | check((xPos1 + (xSpeed1 * cTime)) + (w1/2) < (xPos2 + (xSpeed2 * cTime)) - (w2/2)); |
522 | } | 593 | } |
523 | 594 | ||
524 | 595 | */ | |
525 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 596 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |
526 | //VisionBlocked | 597 | //VisionBlocked |
527 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 598 | ///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |
@@ -545,6 +616,24 @@ pattern visionBlocked_qualAbstr(a1:Actor, a2:Actor) { | |||
545 | Actor.placedOn(a1, l); | 616 | Actor.placedOn(a1, l); |
546 | Actor.placedOn(a2, l); | 617 | Actor.placedOn(a2, l); |
547 | } | 618 | } |
619 | |||
620 | @Constraint(severity="error", key={a1, a2}, message="x") | ||
621 | pattern visionBlocked_qualAbstr2(a1:Actor, a2:Actor) { | ||
622 | VisionBlocked.source(ce, a1); | ||
623 | VisionBlocked.target(ce, a2); | ||
624 | Actor.placedOn(a1, vl1); | ||
625 | Lane_Vertical(vl1); | ||
626 | Actor.placedOn(a2, vl2); | ||
627 | Lane_Vertical(vl2); | ||
628 | } or { | ||
629 | VisionBlocked.source(ce, a1); | ||
630 | VisionBlocked.target(ce, a2); | ||
631 | Actor.placedOn(a1, hl1); | ||
632 | Lane_Horizontal(hl1); | ||
633 | Actor.placedOn(a2, hl2); | ||
634 | Lane_Horizontal(hl2); | ||
635 | } | ||
636 | |||
548 | //<<END QUALITATIF ABSTRACTION>> | 637 | //<<END QUALITATIF ABSTRACTION>> |
549 | 638 | ||
550 | @Constraint(severity="error", key={a1, a2}, message="x") | 639 | @Constraint(severity="error", key={a1, a2}, message="x") |
@@ -571,8 +660,7 @@ pattern visionBlocked_ites_notOnSameVertLine(a1:Actor, a2:Actor, vb:VisionBlocke | |||
571 | check(x1 == x2); | 660 | check(x1 == x2); |
572 | } | 661 | } |
573 | 662 | ||
574 | //OPTIONS 1: everything is from a single check expression containing ITEs | 663 | //TODO refactor? |
575 | //Currently unhandled bygenerator | ||
576 | @Constraint(severity="error", key={a1, vb}, message="x") | 664 | @Constraint(severity="error", key={a1, vb}, message="x") |
577 | pattern visionBlocked_ites_top(a1:Actor, a2:Actor, vb:VisionBlocked) { | 665 | pattern visionBlocked_ites_top(a1:Actor, a2:Actor, vb:VisionBlocked) { |
578 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 | 666 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 |
@@ -596,6 +684,7 @@ pattern visionBlocked_ites_top(a1:Actor, a2:Actor, vb:VisionBlocked) { | |||
596 | < ((y1-y2)/(x1-x2))); | 684 | < ((y1-y2)/(x1-x2))); |
597 | } | 685 | } |
598 | 686 | ||
687 | //TODO refactor? | ||
599 | @Constraint(severity="error", key={a1, vb}, message="x") | 688 | @Constraint(severity="error", key={a1, vb}, message="x") |
600 | pattern visionBlocked_ites_bottom(a1:Actor, a2:Actor, vb:VisionBlocked) { | 689 | pattern visionBlocked_ites_bottom(a1:Actor, a2:Actor, vb:VisionBlocked) { |
601 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 | 690 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 |
@@ -619,6 +708,35 @@ pattern visionBlocked_ites_bottom(a1:Actor, a2:Actor, vb:VisionBlocked) { | |||
619 | > ((y1-y2)/(x1-x2))); | 708 | > ((y1-y2)/(x1-x2))); |
620 | } | 709 | } |
621 | 710 | ||
711 | @Constraint(severity="error", key={a1, a2}, message="x") | ||
712 | pattern visionBlocked_blockerNotToRightOfBoth(a1:Actor, a2:Actor) { | ||
713 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 | ||
714 | VisionBlocked.source(vb, a1); | ||
715 | VisionBlocked.target(vb, a2); | ||
716 | VisionBlocked.blockedBy(vb, aBlocker); | ||
717 | |||
718 | Actor.xPos(a1, x1); | ||
719 | Actor.xPos(a2, x2); | ||
720 | Actor.xPos(aBlocker, xBlocker); | ||
721 | |||
722 | check( x1 < xBlocker && x2 < xBlocker); | ||
723 | } | ||
724 | |||
725 | @Constraint(severity="error", key={a1, a2}, message="x") | ||
726 | pattern visionBlocked_blockerNotToLeftOfBoth(a1:Actor, a2:Actor) { | ||
727 | //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 | ||
728 | VisionBlocked.source(vb, a1); | ||
729 | VisionBlocked.target(vb, a2); | ||
730 | VisionBlocked.blockedBy(vb, aBlocker); | ||
731 | |||
732 | Actor.xPos(a1, x1); | ||
733 | Actor.xPos(a2, x2); | ||
734 | Actor.xPos(aBlocker, xBlocker); | ||
735 | |||
736 | check( x1 > xBlocker && x2 > xBlocker); | ||
737 | } | ||
738 | |||
739 | |||
622 | /////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 740 | /////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |
623 | //SeparationDistance | 741 | //SeparationDistance |
624 | /////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// | 742 | /////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// |