1 / 58

Specialised (user defined) constraints in JChoco

Specialised (user defined) constraints in JChoco. 2 examples: max and subtour elimination. Consider the following contraint. This can be implemented in JChoco using primitives as follows. Due to Chris Unsworth. Could I define my own constraint to do this? Why would I want to do that?.

dian
Download Presentation

Specialised (user defined) constraints in JChoco

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Specialised (user defined) constraints in JChoco 2 examples: max and subtour elimination

  2. Consider the following contraint This can be implemented in JChoco using primitives as follows

  3. Due to Chris Unsworth

  4. Could I define my own constraint to do this? Why would I want to do that? • Possibly: • more compact • faster • more propagation

  5. V[0] = max(v[1],v[2],…,v[n-1]) Define a constraint called Max that extends AbstractLargeIntConstraint

  6. Methods to be implemented V[0] = max(v[1],v[2],…,v[n-1]) initiation inf: lower bound sup: upper bound removal of value instantiate

  7. V[0] = max(v[1],v[2],…,v[n-1]) A demo Cart before the horse?

  8. V[0] = max(v[1],v[2],…,v[n-1]) Note: output always has a 4 or a 5 in it

  9. We haven’t used them yet, but …. Backtrackable Variables (Stored*)

  10. Small TSP’s

  11. The single successor model An array of n variables • “single successor” model of a graph • Limits what kind of graph can be modelled • out-degree of 1 But this aint enough

  12. The single successor model NOT A TOUR! 1 2 3 0 5 6 7 4 4 5 6 7 0 1 2 3 We need subtour elimination

  13. Yikes! Show me a picture! Associate with each variable next[i] the following reversible variables • When making an instantiation • next[i] = j • We now join the path that ends in i to path that starts with j • If the path involves less that n vertices/cities • next[e[j]] != s[i] • i.e. we cannot close that loop!

  14. 6 s[6] = 8 8 e[8] = 6 s[7] = 5 7 4 e[5] = 7 5 next[1] = 5 1 s[1] = 0 2 3 0 e[0] = 1

  15. 6 s[6] = 8 8 e[8] = 6 s[7] = 0 7 4 5 1 2 3 0 e[0] = 7

  16. 6 s[6] = 8 8 e[8] = 6 s[7] = 0 7 4 5 next[7] ≠ 0 Otherwise we have a subtour/loop This is the “propagation” . 1 2 3 0 e[0] = 7 Note: this is a constraint that may be used in a richer problem

  17. Example application: knight’s tour

  18. Wot! Show me a picture!

  19. Is there a dvo heuristic for this?

More Related