Category Archives: Ideas

Me and ChatGPT

ChatGPT has been all over the new recently. Here is a recent “chat” I had with it:

Me: Generate a variable ordering heuristic for constraint satisfaction problems that has not been tried before.

ChatGPT: One possible variable ordering heuristic for constraint satisfaction problems that has not been tried before is based on the concept of information entropy. Information entropy is a measure of the amount of uncertainty or randomness in a system.

To apply this heuristic, we can first calculate the information entropy of each variable in the constraint satisfaction problem. This can be done by considering the number of possible values that each variable can take and the constraints that are imposed on it. For example, if a variable has a large number of possible values and few constraints, it will have a high level of entropy. On the other hand, if a variable has a small number of possible values and many constraints, it will have a low level of entropy.

Once the entropy of each variable has been calculated, we can order the variables according to their entropy. Specifically, we can assign higher priority to variables with lower entropy, as they will have fewer possibilities and be more constrained. This can help reduce the search space and potentially lead to a more efficient solution.

It is worth noting that this heuristic is just one possible approach and may not always be effective in practice. It is always important to carefully evaluate the performance of any variable ordering heuristic and consider how it may be improved or modified to better fit the specific needs of a particular problem.

Me: Isn’t this just the well known domain over degree approach?

ChatGPT: The domain over degree heuristic is a commonly used variable ordering heuristic for constraint satisfaction problems that aims to reduce the search space by prioritizing variables with fewer possible values (also known as a smaller domain) over those with a larger domain. This is similar to the approach I described, which involves ordering variables according to their entropy, which is also a measure of the number of possible values that a variable can take.

However, there are some key differences between these two approaches. The domain over degree heuristic only considers the number of possible values for each variable and does not take into account the constraints that are imposed on the variable. In contrast, the entropy-based heuristic takes both the number of possible values and the constraints into account when calculating the entropy of each variable.

In addition, the entropy-based heuristic considers the overall level of randomness or uncertainty in the system, while the domain over degree heuristic only looks at the number of possible values for each variable in isolation. This means that the entropy-based heuristic may be able to capture additional information about the structure of the problem and potentially lead to more efficient solutions.

Overall, while the domain over degree heuristic and the entropy-based heuristic are similar in some ways, they differ in their approaches to ordering variables and may have different performance characteristics depending on the specific problem being solved.

I posted this exchange at the Constraints Google Group and Juan Francisco Diaz posted that he approached the originality question by asking GPT:

Do you know papers talking about the entropy-based heuristic approach?

and received the reply:

Yes, there are several papers that discuss the entropy-based heuristic approach for variable ordering in constraint satisfaction problems. Here are a few examples:

  1. “Entropy-based variable and value ordering heuristics for constraint satisfaction problems” by Richard E. Korf and Andrew J. Fellegi (1993) presents an entropy-based variable ordering heuristic and an entropy-based value ordering heuristic, and evaluates their performance on a range of constraint satisfaction problems.
  2. “A comparison of heuristics for the maximum constraint satisfaction problem” by Peter van Beek and Peter van der Wal (1995) compares the performance of the entropy-based heuristic with other variable ordering heuristics on the maximum constraint satisfaction problem, which is a variant of the constraint satisfaction problem in which the goal is to find an assignment that satisfies the maximum number of constraints.
  3. “Efficient entropy-based variable ordering heuristics for graph coloring problems” by Jia-Huai You and T. K. Satyanarayana (2003) presents an entropy-based variable ordering heuristic for graph coloring problems and compares its performance with other heuristics on a variety of graphs.

These papers may provide more detailed information about the entropy-based heuristic approach and its applications to constraint satisfaction problems.

ChatGPT

Register for ChatGPT and ask it “What is a constraint satisfaction problem?”

Then ask it to “Write a program to solve the N-Queens Problem.”

Then start looking for another line of work. 🙂

No, seriously, instead start thinking about how we can use this kind of technology for “progress towards the Holy Grail“. In particular, how we can progress beyond what this technology can do on its own, by working on “bridging CP and ML“. 

Scrabble

I posted the “Puzzles” blog entry to LinkedIn and Supriyo SB Chatterjee responded by noting that “solving for Scrabble is a CSP too”. (Some time ago Supriyo won the New England Regional Colleges Scrabble Championships.) Indeed it is, an interesting kind of CSP.

When it is your move you need to make a choice that satisfies a number of constraints. You can only use letters from your tray (which you then replace). You have to form a word in the Scrabble Dictionary. You have to place the word to link up properly with what is already on the board. And your move changes the board (and your tray), so you have a “sequence” of problems to solve, where each problem in the sequence is dependent on your solution to the previous one.

I thought of calling this a “sequential CSP”. Of course, there have been many variants of CSP, including some with some form of “sequential” nature. Sequentially Dependent Meta-Constraint Satisfaction Problem: An Application to Video Games seems particularly relevant here. I thought of the acronym “SCSP”, but it has already been used at least twice, for Semiring-based CSP and for Structural CSP. So then I thought “SQCSP”, even though that risks confusion with Quantified CSPs. But there is the Semi-Qualitative Constraint Satisfaction Problem (SQCSP).

Of course, there is another aspect of Scrabble: it is a game, with two adversaries. So actually the adversarial constraint satisfaction paradigm seems relevant here. Looking back I see that Ken, James, Paidi and I didn’t actually use the “ACSP” acronym when we wrote up adversarial constraint satisfaction for ECAI 2004. Perhaps just as well: “a CSP”?

So one outcome of this was the thought that it could be useful to have some kind of list, taxonomy or categorization of the many variants of constraint satisfaction problems. Perhaps even a survey. I’ve posted on the Constraints Google Group asking people to provide pointers to CSP variants and hope to assemble a list to make available at the constraints Resources site.

Back to Scrabble, beyond just finding moves that satisfies the constraints, there are interesting issues of optimization and strategy. For example, do you want to go for a lower value move now to try to set up a high value one later or to prevent your opponent from using a potentially valuable position? I imagine there are books on Scrabble strategy.

Scrabble certainly has been computerized. In a match held way back in 1998, MAVEN defeated World Champion Joel Sherman and runner-up Matt Graham, playing together. But perhaps Scrabble can still inspire new ways of thinking about constraint satisfaction.

Meta

Looking for papers on explanation for constraint satisfaction I ran across Meta-explanation in a Constraint Satisfaction Solver by the pioneering French AI scientist Jacques Pitrat. From the abstract:

Meta-explaining is useful to a human or an artificial researcher in order to learn how to use its knowledge efficiently. For instance, when the system RESEARCHER solves the same prob- lem using two different methods, it can meta-explain why it finds a more elegant solution with one of them. 

It might be interesting to compare Pitrat’s work here to the work I did with Chavalit Likitvivatanavong and Rick Wallace in Deriving Explanations and Implications for Constraint Satisfaction Problems.

Pitrat’s paper is related to a very ambitious — and very “meta” — research agenda that he was pursuing. See A Step toward an Artificial Artificial Intelligence Scientist, Artificial Beings: The Conscience of a Conscious Machine, and his blog. Unfortunately Pitrat passed away recently; the record of a day of tribute can be found here

Inference and Explanation

Twenty-five years ago Mohammed Sqalli and I wrote a paper titled Inference-Based Constraint Satisfaction Supports Explanation. From the abstract:

Constraint satisfaction problems are typically solved using search, augmented by general purpose consistency inference methods. This paper proposes a paradigm shift in which inference is used as the primary problem solving method, and attention is focused on special purpose, domain specific inference methods. While we expect this approach to have computational advantages, we emphasize here the advantages of a solution method that is more congenial to human thought processes.

“Domain specific” may be misleading here. While the inference methods we introduced were motivated by our “case study” — logic puzzles — they involved “global constraints”, which were not tied solely to that specific domain. Introducing global constraints is something of a cottage industry, and there is a Global Constraint Catalog, which currently has hundreds of specialized constraints and many pointers to associated specialized filtering (inference) methods.

Nicolas Beldiceanu and Helmut Simonis developed tools to automate the use of the Catalog: Constraint Seeker, which provided “a web interface to search for global constraints in the global constraint catalog, given positive and negative, fully instantiated (ground) examples”, and Model Seeker, which generated “finite domain constraint models from positive example solutions, for highly structured problems”. Model Seeker “is based on the global constraint catalog, providing the library of constraints that can be used in modeling, and the Constraint Seeker tool”.

Explanation, of course, is a hot topic now in AI — XAI — in particular with regard to combating bias. There has been considerable discussion of a “right to explanation“.

This post was prompted, in particular, by a recent paper on explanation, Efficiently Explaining CSPs with Unsatisfiable Subset Optimization, by Emilio Gamba, Bart Bogaerts, and Tias Guns, which cites Mohammed and me, as well as work I did with Chavalit Likitvivatanavong, and Richard Wallace. This paper builds upon an ECAI-20 paper Step-wise Explanations of Constraint Satisfaction Problems (see the video), which in turn was motivated by the winning entry in the PTHG-19 Workshop‘s Holy Grail Challenge (see the workshop talk). From the abstract:

We build on a recently proposed method for explaining solutions of constraint satisfaction problems. An explanation here is a sequence of simple inference steps, where the simplicity of an inference step is measured by the number and types of constraints and facts used, and where the sequence explains all logical consequences of the problem. We build on these formal foundations and tackle two emerging questions, namely how to generate explanations that are provably optimal (with respect to the given cost metric) and how to generate them efficiently.

Monarch of All I Survey

Kostas Stergiou has published in Artificial Intelligence Review a very interesting “review and evaluation” of adaptive constraint propagation in constraint satisfaction. It surveys, classifies, and advances the subject, and suggests directions for further work.

With the current prominence of machine learning, I was happy to see that Stergiou unearthed an old paper Rick Wallace and I wrote on Selective Relaxation for Constraint Satisfaction Problems, which might be regarded as including an early application of machine learning to CP. That presupposes a rather generous definition of “learning”, which might even apply to another of the cited papers, one I wrote with Dan Sabin on Understanding and Improving the MAC Algorithm. “Adaptation” might be a better term. A more straightforward example of learning is the paper cited that I wrote with Susan Epstein, Rick Wallace and Xingjian Li on Learning Propagation Policies. Kostas concludes his proposals for future work with a timely call for exploring the further potential of machine learning. (Incidentally, I ran across a paper on ArXiv recently that applys deep learning to the related issue of variable ordering.)

I’d like to see more survey papers being published. It occurs to me that every thesis will include the makings of such a paper in a “related work” section or chapter. I would encourage students not just to publish papers based on the novel results in their thesis, but to publish a survey article based on their thesis work as well. The Constraints journal even has a “Surveys Editor”, currently Pascal Van Hentenryck.

I have added a link to Kostas’ paper in the “Surveys/Overviews/Bibliographies” section of my Resources website. If you publish a new survey, or have published one that is not already linked to at the website, let me know so I can link to it.

One Two Three . . . Infinity

The great physicist George Gamow wrote a book entitled One Two Three . . . Infinity: Facts and Speculations of Science, which I recall as one of the books I encountered in my high school library that inspired my interest in mathematics. This post is what I hope will become one of a series on “Where do ideas come from?”. (As always further contributions from readers in the Comments are encouraged.)

“Consistency”, as a form of inference, is arguably what distinguishes the AI approach to constraint satisfaction. “In the beginning” there were three forms of consistency, which were described in terms of the “constraint graph” representation of constraint satisfaction problems: “node consistency”, “arc consistency” and “path consistency”, which involved respectively nodes (vertices), arcs (edges) and paths (sequences of edges leading from one vertex to another). Nodes, arcs, paths: that seemed to cover the possibilities for graph consistency.

However, Montanari demonstrated that path consistency could be reduced to consistency for paths of length 2, involving just 2 edges. Looking at it in terms of the number of vertices involved: node consistency involves just 1, arc consistency 2, path consistency 3. “Node, arc, path” … it isn’t obvious that there is anything more to see here. But “1, 2, 3” … that practically begs to ask the question: Does it stop there; shouldn’t there be a “4-consistency, a 5-consistency, … ? And thus the idea for “k-consistency” was born. Putting this together with an algorithm for achieving k-consistency (and thus ultimately a complete set of solutions, purely by inference) resulted in an MIT AI Memo in 1976, which in 1978 became my first major journal publication.

There are two meta lessons here with regard to the question “where do ideas come from”.

The first is the importance of representation. A classic example is Kaplan and Simon’s investigation of the mutilated chessboard problem. Here, it was the switch from talking about different graph structures — nodes, arcs, and paths — to talking about the number of vertices involved. Another representational shift — from viewing constraints as represented by edges to viewing them as represented by nodes (in an “augmented” constraint graph) — enabled the algorithm I devised to achieve higher order consistency.

The second is the notion of extrapolation, as an instance of the even broader concepts of generalization and completion. Here “1, 2, 3” suggests “k”. It just doesn’t seem right that we would have to stop at 3. 🙂

Of course, we don’t actually go to infinity — unless we consider problems with an infinite number of variables. Hmm, that’s an idea …

Microplates, Avenues and Smorgasbords

An entry by Maria Andreina Francisco in a thread at the Constraint Google Group engendered several thoughts, which I thought I’d collect into a blog post. Italics are excerpts from Maria’s entry. 

I’m currently a postdoc at a pharmaceutical bioinformatics group.  

It is always exciting to hear about CP applications to bioinformatics. The last International Workshop on Constraint-Based Methods for Bioinformatics I’m aware of (the 12th, WCB’16) was in 2016. There was one scheduled for 2018, but I’m not sure if it took place, or if there has been one since; does anyone know? Is it time for another? In any case, I’ve added Andreina’s ModRef 2020 contribution on microplate layout design to my nascent page of Sample Applications of CP

I share Alexander’s experience that building a first proof of concept with minizinc is quick and painless, but getting it to work on larger instances with more complex constraints… well, not so quick and painless. 

It appears that there is a research “avenue” opportunity here, which may be difficult to “enter”, but very rewarding if new entrances can be found. Can we conduct some fundamental research addressing the difficulties of practial implementation, especially with regards to “scaling up”? 

For example, I once heard an observation from a practioner that a perceived drawback of CP for end users was that seemingly small changes to the model could have unpredictably big effects on solution time. Somehow that seems like a problem that could be amenable to some fundamental research. 

Some sort of general comment would be that I think it was easier to write models when I knew less about CP.  Nowadays I imagine a model in my head only to realise that all the pieces are not all available in one solver and I need to decide which solver/parts I want to keep and rethink the rest. 

The idea that it could be easier to write models when you know less about CP, because all the pieces you want aren’t available in one solver, is an interesting take on things. Could a ’smorgasbord’ approach — as opposed to a ‘portfolio’ approach 🙂 be implemented that allowed one to pick and choose and assemble the pieces one needed, as needed? Or better yet could one automate this, build a system that analyzed the problem and automatically assembled the pieces to build and operate on an appropriate model? Back to my “Holy Grail” hobbyhorse. 🙂

Erdős-Faber-Lovász

Mathematicians have recently “proven” the Erdős-Faber-Lovász coloring conjecture. I put “proven” in quotes because the proof only works for “large enough” hypergraphs, a restriction that I think is rather cavalierly addressed in the linked article. Nevertheless, it would be interesting to consider whether some of the techniques used in the proof could be adapted for general constraint satisfaction problem solving. At least one technique they use seems already to be related to a CP staple: “hardest first (fail first)” ordering; perhaps some readers can identify others. Even more interesting would be if some of the methods used in the proof suggest new CP techniques. And it would be exciting if any existing CP techniques suggest alternative or improved proofs of the conjecture.

Impact

I recently connected, via Linkedin, with the Director of Constraint Programming Research and DevelopmentI at Oracle. He told me that the Dynamic CSP features of Oracle’s Solver are based on concepts presented in some papers I wrote years ago with a student, Dan Sabin. I promptly passed that info on to Dan.

I believe this sort of “knowledge transfer” or “impact” often “flys under the radar”. Aside from patent or paper citations there is no formal mechanism for acknowledging such influence. I would encourage folks in industry to take a moment now and then to send a note to academics, or speak with them at a conference, and let them know that their work has been helpful. This is gratifying and useful for academics, and, who knows, might encourage further productive interaction.