1 / 6

gerald +donald --------- robert ---------

gerald +donald --------- robert ---------. gerald +donald --------- robert ---------. Variables g e r a l d o n b t. Domains value in range [0..9]. Observations g can’t be zero d can’t be zero r can’t be zero t is even (observation due to Christine).

rainer
Télécharger la présentation

gerald +donald --------- robert ---------

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. gerald +donald --------- robert ---------

  2. gerald +donald --------- robert --------- Variables g e r a l d o n b t Domains value in range [0..9] Observations g can’t be zero d can’t be zero r can’t be zero t is even (observation due to Christine) These are unary constraints All variables take different values binary constraints?

  3. gerald +donald --------- robert --------- d + 10.l + 100.a + 1000.r + 10000.e + 100000.g + d + 10.l + 100.a + 1000.n + 10000.o + 100000.d = t + 10.r + 100.e + 1000.b + 10000.o + 100000.r

  4. d + 10.l + 100.a + 1000.r + 10000.e + 100000.g + d + 10.l + 100.a + 1000.n + 10000.o + 100000.d = t + 10.r + 100.e + 1000.b + 10000.o + 100000.r gerald +donald --------- robert --------- Observations g can’t be zero d can’t be zero r can’t be zero t is even (observation due to Christine) Introduce carries t + 10.carry1 = 2.d r + 10.carry2 = l + l + carry1 e + 10.carry3 = a + a + carry2 b + 10.carry4 = r + n + carry3 o + 10.carry5 = e + o + carry4 r = g + d + carry5

  5. [gerald() : Problem -> let p := makeProblem("CRYPT-ARITHMETIC: gerald + donald = robert",13), g := makeIntVar(p,"g",0 ,9), e := makeIntVar(p,"e",0 ,9), r := makeIntVar(p,"r",0 ,9), a := makeIntVar(p,"a",0 ,9), l := makeIntVar(p,"l",0 ,9), d := makeIntVar(p,"d",0, 9), o := makeIntVar(p,"o",0 ,9), n := makeIntVar(p,"n",0 ,9), b := makeIntVar(p,"b",0 ,9), t := makeIntVar(p,"t",0, 9), letters := set(g,e,r,a,l,d,o,n,b,t), word1 := makeBoundIntVar(p,"gerald",0,999999), word2 := makeBoundIntVar(p,"donald",0,999999), word3 := makeBoundIntVar(p,"robert",0,999999) in (for i in (1 .. 9) for j in (i + 1 .. 10) post(p,letters[i] !== letters[j]), post(p, list(100000,10000,1000,100,10,1) scalar list(g,e,r,a,l,d) == word1), post(p, list(100000,10000,1000,100,10,1) scalar list(d,o,n,a,l,d) == word2), post(p, list(100000,10000,1000,100,10,1) scalar list(r,o,b,e,r,t) == word3), post(p, word1 + word2 == word3), p)]

More Related