reset password
Author Message
mkuko
Posts: 13
Posted 19:37 Oct 22, 2019 |

From my understanding the initial propagation for SEND MORE MONEY has to happen to get the assignments down to 4.

That is the initial domains sent to the csp needs to be reduced_domains_3 that we see in run_test_case_propagator().

I'm working on two fronts here first being that I want to abstract this so it works with multiple puzzles like the first point in the To Do,

and second how do get the proper column in the csp when the column_propagator is called so we can propagate after every search.

 

I might be going about this completely wrong but so far what I've tried is to create a function that uses generate_domains to get the cols, problem_var_domains and domains

This function then does the following:

1. calls column_propagator on the each column in cols

2. check if the domains changed after iterating through every column

3. if it did change run it again if not return the domains

Unfortunately this doesn't return the exact domains on reduced_domains_3 but return a domain that's equal to reduced_domains_2

When this is run through my csp it finds the solution with 1058 assignments.

 

Any insight into understanding the propagation or where my logic is wrong would be much appreciated, thanks.

 

rabbott
Posts: 1649
Posted 21:50 Oct 22, 2019 |

Not quite following your question. 

A couple of days ago I posted a link to a GitHub account that has the current version of my code. Looking at that will probably help--although it's somewhat late to start trying to work through it.

csp.py includes a function, run_column_propagator, which runs the propagator on all the columns until there are no more changes. It is called from only one place--in the first line of complete_the_assignment. But complete_the_assignment is called recursively to do the search. So run_column_propagator is called after every search step and before the first search step.