# HG changeset patch
# User deba
# Date 1176914080 0
# Node ID 07c4f9bcb4d59d8256e190620dc90965be4c2da7
# Parent 6a567c0f1214cbff44adadfd52be2e0405a5ac87
Demo program for SAT problems
diff -r 6a567c0f1214 -r 07c4f9bcb4d5 demo/Makefile.am
--- a/demo/Makefile.am Wed Apr 11 07:34:40 2007 +0000
+++ b/demo/Makefile.am Wed Apr 18 16:34:40 2007 +0000
@@ -13,7 +13,8 @@
demo/strongly_connected_orientation.lgf \
demo/sub_gad_input.lgf \
demo/u_components.lgf \
- demo/steiner.lgf
+ demo/steiner.lgf \
+ demo/sat-2.in
if WANT_DEMO
@@ -40,7 +41,9 @@
demo/simann_maxcut_demo \
demo/disjoint_paths_demo \
demo/strongly_connected_orientation \
- demo/steiner_demo
+ demo/steiner_demo \
+ demo/sat-2 \
+ demo/sat
if HAVE_GLPK
noinst_PROGRAMS += demo/lp_demo demo/lp_maxflow_demo demo/mip_demo
@@ -107,4 +110,8 @@
demo_strongly_connected_orientation_SOURCES = demo/strongly_connected_orientation.cc
-demo_steiner_demo_SOURCES=demo/steiner_demo.cc
\ No newline at end of file
+demo_steiner_demo_SOURCES=demo/steiner_demo.cc
+
+demo_sat_2_SOURCES=demo/sat-2.cc
+
+demo_sat_SOURCES=demo/sat.cc
\ No newline at end of file
diff -r 6a567c0f1214 -r 07c4f9bcb4d5 demo/sat-2.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/sat-2.cc Wed Apr 18 16:34:40 2007 +0000
@@ -0,0 +1,157 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2007
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+/// \ingroup demos
+/// \file
+/// \brief Solver for SAT-2 problems.
+///
+/// This demo progam solves the SAT-2 problem, i.e. the boolean
+/// satisfiability problem where each disjuction consists at most 2
+/// terms.
+///
+/// The program generates a graph from the boolean expression. Two
+/// nodes are assigned to each boolean variable, an x and a
+/// not x nodes. If there is an x or y disjunction
+/// in the formula, then the not x => y and the not y =>
+/// x edges are added to the graph. If there is a single
+/// x term disjunction in the formula then the not x
+/// =>x edge is added to the graph.
+///
+/// The boolean formula could be satified if and only if the
+/// x and not x nodes are in different strongly connected
+/// components. A feasible solution could be get from the current
+/// component numbering.
+///
+/// \include sat-2.cc
+
+#include
+#include
+#include
+#include
+#include