<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>binary clauses on Wonderings of a SAT geek</title>
    <link>https://www.msoos.org/tags/binary-clauses/</link>
    <description>Recent content in binary clauses on Wonderings of a SAT geek</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <lastBuildDate>Sun, 14 Apr 2013 17:29:50 +0000</lastBuildDate>
    <atom:link href="https://www.msoos.org/tags/binary-clauses/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>CryptoMinisat 3.1 released</title>
      <link>https://www.msoos.org/2013/04/cryptominisat-3-1-released/</link>
      <pubDate>Sun, 14 Apr 2013 17:29:50 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=1624</guid> 
      <description>&lt;p&gt;CryptoMinisat 3.1 has been &lt;a href=&#34;https://gforge.inria.fr/frs/?group_id=1992&amp;amp;release_id=8008&#34;&gt;released&lt;/a&gt;. The short changelog is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ git diff cryptoms-3.0 cryptoms-3.1 --shortstat
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 84 files changed, 3079 insertions(+), 2751 deletions(-)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The changes made were threefold. First, memory usage has been greatly reduced. This is crucial, because memory usage was over 7GB on certain instances. Secondly, the implication cache wasn&amp;rsquo;t very well-used and an idea that came to my mind &lt;em&gt;greatly&lt;/em&gt; improved performance on most problems. Finally, time limiting of some inprocessing techniques on certain types of problems has been improved.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Failed literal probing and UIP</title>
      <link>https://www.msoos.org/2011/08/failed-literal-probing-and-uip/</link>
      <pubDate>Thu, 04 Aug 2011 09:50:02 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=957</guid> 
      <description>&lt;p&gt;I have just realised that &lt;a href=&#34;https://www.msoos.org/cryptominisat2&#34;&gt;CryptoMiniSat&lt;/a&gt;, having won a number of medals, does one of the most basic things, &lt;a href=&#34;http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=CF33EFCD2F8DC2595B3CB93AB4B02833?doi=10.1.1.1.1941&amp;amp;rep=rep1&amp;amp;type=pdf&#34;&gt;failed literal probing&lt;/a&gt;, &lt;em&gt;all wrong&lt;/em&gt;. Let me tell you why it&amp;rsquo;s all wrong. In essence, failed literal probing is trivial. We enqueue a fact, such as &lt;code&gt;a&lt;/code&gt;, and then propagate it. If this fails, i.e. if two opposing facts such as &lt;code&gt;g&lt;/code&gt; and &lt;code&gt;-g&lt;/code&gt; are derived, we know that &lt;code&gt;a&lt;/code&gt; cannot be true, so we set &lt;code&gt;-a&lt;/code&gt;. Easy. Or maybe not so easy.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Caching</title>
      <link>https://www.msoos.org/2010/11/caching/</link>
      <pubDate>Tue, 23 Nov 2010 13:43:50 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=524</guid> 
      <description>&lt;p&gt;&amp;ldquo;Representation &lt;em&gt;is&lt;/em&gt; the essence of programming&amp;rdquo;
Frederic P. Brooks Jr., &amp;ldquo;The Mythical Man-month&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.msoos.org/wordpress/wp-content/uploads/2010/11/memory.png&#34;&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.msoos.org/wordpress/wp-content/uploads/2010/11/memory.png&#34;&gt;&lt;/a&gt; Looking through the literature on SAT solvers, it is rare to find any algorithm that uses a form of time-memory trade-off. In fact, it is rare to find any algorithm that uses too much memory. This also shows up in practice, as it&amp;rsquo;s rare to find a SAT solver using too much memory. This translates to the following: if a SAT solver can in an effective way utilize the typically abundant memory, that SAT solver will have an advantage. Based on this logic, I think CryptoMiniSat is doing good.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Transitive OTF self-subsuming resolution</title>
      <link>https://www.msoos.org/2010/09/transitive-otf-self-subsuming-resolution/</link>
      <pubDate>Tue, 28 Sep 2010 16:26:51 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=451</guid> 
      <description>&lt;p&gt;The title may be a bit long, but its essence is very simple: we try to shorten learnt clauses. The basic idea was described in &lt;a href=&#34;https://www.msoos.org/on-the-fly-self-subsuming-resolution&#34;&gt;this&lt;/a&gt; post: there is a clause we just derived, e.g.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;d V -e V f V g&lt;/code&gt; (1)&lt;/p&gt;
&lt;p&gt;where &lt;code&gt;d,e,f,g&lt;/code&gt; are binary variables, &lt;code&gt;-&lt;/code&gt; is binary negation, and &lt;code&gt;V&lt;/code&gt; is the binary OR operator. We can remove a literal from this using &lt;a href=&#34;https://www.msoos.org/self-subsuming-resolution&#34;&gt;self-subsuming resolution&lt;/a&gt; with e.g. the 2-long clause:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Propagating faster</title>
      <link>https://www.msoos.org/2010/07/propagating-faster/</link>
      <pubDate>Mon, 26 Jul 2010 16:13:00 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/wordpress/?p=7</guid> 
      <description>&lt;p&gt;Propagation (BCP) in SAT is the single most expensive operation. The algorithm essentially does the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;while (queue_head &amp;lt; trail.size()) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  Literal p = trail[queue_head];
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  vector&amp;lt;Watch&amp;gt;&amp;amp; thiswatch = watches[p];
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  for (i = thiswatch.begin(); i!=thiswatch[p].end(); i++) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    confl = prop_confl(i-&amp;gt;clause);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    if (confl != NULL) return confl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  queue_head++;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;where the function &lt;code&gt;prop_confl()&lt;/code&gt; executes the propagation or returns a conflict, if necessary.&lt;/p&gt;
&lt;p&gt;The problem with the above function is that clauses come in all shapes and sizes. In &lt;a href=&#34;http://planete.inrialpes.fr/%7Esoos/CryptoMiniSat2/index.php&#34;&gt;CryptoMiniSat&lt;/a&gt;, there are two kinds of clauses, normal clauses and XOR clauses. Naturally, these need to be handled differently. Furthermore, if the clause&amp;rsquo;s size is small, it is more efficient to handle it differently. The way CryptoMiniSat has done this before was to have a separate &amp;quot; &lt;code&gt;watches&lt;/code&gt;&amp;quot; for each of these. As you can guess, this is very suboptimal.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to bit-stuff pointers</title>
      <link>https://www.msoos.org/2010/06/how-to-bit-stuff-pointers/</link>
      <pubDate>Wed, 30 Jun 2010 07:22:00 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/wordpress/?p=12</guid> 
      <description>&lt;p&gt;In my &lt;a href=&#34;?p=13&#34;&gt;last post&lt;/a&gt; I have described a small problem I had regarding a C++ union that had to store a pointer and a value at the same time, plus an indicator that told us which of the two was active:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;class WhatLeadHere {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;public:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    bool wasPointer;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    union{Clause* pointer; uint32_t lit;};
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Martin Maurer has wrote this enlightening email regarding this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Clause * pointer is [..] located at least on a 4 byte boundary (at least when not forced by e.g. #pragma). If it is not at least on a 4 byte boundary, CPU must (at least some of them) do two accesses: one lower DWORD, one upper DWORD, and merge both together, which reduces speed.&lt;/p&gt;
&lt;p&gt;So the lower two bits are always zero :-) Why not move the &amp;ldquo;wasPointer&amp;rdquo; to lower two bits (i think you need only one, have one spare bit). Of course before accessing the &amp;ldquo;pointer&amp;rdquo; (Clause *), you must &amp;ldquo;and&amp;rdquo; the two lower bits back to zero.&lt;/p&gt;
&lt;/blockquote&gt;</description>
    </item>
    <item>
      <title>Propagating binary clauses</title>
      <link>https://www.msoos.org/2010/06/propagating-binary-clauses/</link>
      <pubDate>Sun, 27 Jun 2010 17:48:00 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/wordpress/?p=13</guid> 
      <description>&lt;p&gt;Binary clauses are somewhat special. They are clauses that look like:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-v1 or v20 = true&lt;/code&gt;&lt;br&gt;
&lt;code&gt;-v1 or v21 = true&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;which basically mean: if &lt;code&gt;v1&lt;/code&gt; is TRUE, then both &lt;code&gt;v20&lt;/code&gt; and &lt;code&gt;v21&lt;/code&gt; must be TRUE. We put these clauses into a special datastructure, that looks like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;watchlist[-v1] = v20,v21, ...&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This makes us all very happy, since this datastructure is very simple: just literals (negated or non-negated variables) one after the other, in a very trivial list. This makes the whole thing very compact, and very efficient.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Obvious Child</title>
      <link>https://www.msoos.org/2010/06/the-obvious-child/</link>
      <pubDate>Tue, 08 Jun 2010 14:39:00 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/wordpress/?p=15</guid> 
      <description>&lt;p&gt;The new CryptoMiniSat 2.5.1, codenamed &amp;ldquo;The Obvious Child&amp;rdquo; has been &lt;a href=&#34;https://gforge.inria.fr/frs/shownotes.php?release_id=5231&#34;&gt;released&lt;/a&gt;. It&amp;rsquo;s very close to the system that has been sent into the &lt;a href=&#34;http://baldur.iti.uka.de/sat-race-2010/&#34;&gt;SAT Race&#39;10&lt;/a&gt;. This version of CryptoMS is much better than any versions before: I finally corrected a lot of bugs that went into the 2.4.x series, and added new features to treat binary clauses.&lt;/p&gt;
&lt;p&gt;The release name is the &lt;a href=&#34;http://www.paulsimon.com/node/112&#34;&gt;song title&lt;/a&gt; by Paul Simon. I am a fan of the 60&amp;rsquo;s for many reasons. It was the time when &lt;a href=&#34;http://en.wikipedia.org/wiki/R._D._Laing&#34;&gt;Laing&lt;/a&gt; wrote his first books, &lt;a href=&#34;http://www.sciencedirect.com/science?_ob=ArticleURL&amp;amp;_udi=B8H4J-4NRKWK7-2&amp;amp;_user=10&amp;amp;_coverDate=04%2F30%2F1959&amp;amp;_rdoc=2&amp;amp;_fmt=high&amp;amp;_orig=browse&amp;amp;_srch=doc-info%28%23toc%2342608%231959%23999479997%23654711%23FLP%23display%23Volume%29&amp;amp;_cdi=42608&amp;amp;_sort=d&amp;amp;_docanchor=&amp;amp;_ct=29&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=5fe3e6800c80474f03f7e79ea5f84ee9&#34;&gt;empathy&lt;/a&gt; was first scientifically demonstrated for animals, the days of &lt;a href=&#34;http://en.wikipedia.org/wiki/I_Have_a_Dream&#34;&gt;I have a dream&lt;/a&gt;, the &lt;a href=&#34;http://en.wikipedia.org/wiki/Apollo_11&#34;&gt;landing&lt;/a&gt; on the moon, and the take-off of Simon&amp;amp;Garfunkel.; Some interesting times, shall we say.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Being dumb is part of the deal</title>
      <link>https://www.msoos.org/2010/05/being-dumb-is-part-of-the-deal/</link>
      <pubDate>Wed, 26 May 2010 18:36:00 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/wordpress/?p=17</guid> 
      <description>&lt;p&gt;In my &lt;a href=&#34;?p=18&#34;&gt;last post&lt;/a&gt;, I presented a fast and easy way to add binary clauses to the clause database of &lt;a href=&#34;http://en.wikipedia.org/wiki/Boolean_satisfiability_problem&#34;&gt;SAT solvers&lt;/a&gt;, and I conjectured that since the algorithm was so simple, there must be something wrong with it. I was, in fact, right. I ran a cluster &lt;a href=&#34;https://www.grid5000.fr/mediawiki/index.php/Special:G5KExperiments?menu=renderexperiment&amp;amp;id=643&#34;&gt;experiment&lt;/a&gt;, and it turned out that adding all those binary clauses was slowing down the solving.&lt;/p&gt;
&lt;p&gt;My first reaction was of course: how on Earth? Binary clauses are &amp;ldquo;good&amp;rdquo;: both &lt;a href=&#34;http://minisat.se/&#34;&gt;MiniSat&lt;/a&gt; and &lt;a href=&#34;http://www.cril.univ-artois.fr/%7Eaudemard/&#34;&gt;Glucose&lt;/a&gt; try to amass these clauses as much as possible. So what can possibly be wrong? Well, redundant information, for a start. Let&amp;rsquo;s assume that we know that&lt;/p&gt;</description>
    </item>
    <item>
      <title>I must be dumb</title>
      <link>https://www.msoos.org/2010/05/i-must-be-dumb/</link>
      <pubDate>Sun, 23 May 2010 17:44:00 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/wordpress/?p=18</guid> 
      <description>&lt;p&gt;Apparently, hyper-binary resolution is &lt;a href=&#34;http://fmv.jku.at/biere/talks/Biere-Dagstuhl09-talk.pdf&#34;&gt;not easy&lt;/a&gt;. However, I have been reading the &lt;a href=&#34;http://www.cs.technion.ac.il/%7Egershman/papers/sat05_full.pdf&#34;&gt;paper&lt;/a&gt; by Gershman and Strichman, and they make it sound like it&amp;rsquo;s the easiest thing of all &amp;ndash; especially if you don&amp;rsquo;t do it the way they are doing it, of course.&lt;/p&gt;
&lt;p&gt;Hyper-binary resolution is essentially very easy. Let&amp;rsquo;s say you have three clauses:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-a V b
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-a V c
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;d V -b V -c
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(where &lt;code&gt;V&lt;/code&gt; is the binary OR, &lt;code&gt;-&lt;/code&gt; is the binary negation, and each line must be satisfied)&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
