View Javadoc

1   /*******************************************************************************
2    * SAT4J: a SATisfiability library for Java Copyright (C) 2004, 2012 Artois University and CNRS
3    *
4    * All rights reserved. This program and the accompanying materials
5    * are made available under the terms of the Eclipse Public License v1.0
6    * which accompanies this distribution, and is available at
7    *  http://www.eclipse.org/legal/epl-v10.html
8    *
9    * Alternatively, the contents of this file may be used under the terms of
10   * either the GNU Lesser General Public License Version 2.1 or later (the
11   * "LGPL"), in which case the provisions of the LGPL are applicable instead
12   * of those above. If you wish to allow use of your version of this file only
13   * under the terms of the LGPL, and not to allow others to use your version of
14   * this file under the terms of the EPL, indicate your decision by deleting
15   * the provisions above and replace them with the notice and other provisions
16   * required by the LGPL. If you do not delete the provisions above, a recipient
17   * may use your version of this file under the terms of the EPL or the LGPL.
18   *
19   * Based on the original MiniSat specification from:
20   *
21   * An extensible SAT solver. Niklas Een and Niklas Sorensson. Proceedings of the
22   * Sixth International Conference on Theory and Applications of Satisfiability
23   * Testing, LNCS 2919, pp 502-518, 2003.
24   *
25   * See www.minisat.se for the original solver in C++.
26   *
27   * Contributors:
28   *   CRIL - initial API and implementation
29   *******************************************************************************/
30  package org.sat4j.tools;
31  
32  import java.io.PrintStream;
33  import java.io.PrintWriter;
34  import java.util.Map;
35  
36  import org.sat4j.specs.ContradictionException;
37  import org.sat4j.specs.IConstr;
38  import org.sat4j.specs.ISolver;
39  import org.sat4j.specs.ISolverService;
40  import org.sat4j.specs.IVec;
41  import org.sat4j.specs.IVecInt;
42  import org.sat4j.specs.SearchListener;
43  import org.sat4j.specs.TimeoutException;
44  
45  public abstract class AbstractOutputSolver implements ISolver {
46  
47      protected int nbvars;
48  
49      protected int nbclauses;
50  
51      protected boolean fixedNbClauses = false;
52  
53      protected boolean firstConstr = true;
54  
55      /**
56  	 * 
57  	 */
58      private static final long serialVersionUID = 1L;
59  
60      public boolean removeConstr(IConstr c) {
61          throw new UnsupportedOperationException();
62      }
63  
64      public void addAllClauses(IVec<IVecInt> clauses)
65              throws ContradictionException {
66          throw new UnsupportedOperationException();
67      }
68  
69      public void setTimeout(int t) {
70          // TODO Auto-generated method stub
71  
72      }
73  
74      public void setTimeoutMs(long t) {
75          // TODO Auto-generated method stub
76      }
77  
78      public int getTimeout() {
79          return 0;
80      }
81  
82      /**
83       * @since 2.1
84       */
85      public long getTimeoutMs() {
86          return 0L;
87      }
88  
89      public void expireTimeout() {
90          // TODO Auto-generated method stub
91  
92      }
93  
94      public boolean isSatisfiable(IVecInt assumps, boolean global)
95              throws TimeoutException {
96          throw new TimeoutException("There is no real solver behind!");
97      }
98  
99      public boolean isSatisfiable(boolean global) throws TimeoutException {
100         throw new TimeoutException("There is no real solver behind!");
101     }
102 
103     public void printInfos(PrintWriter output, String prefix) {
104     }
105 
106     public void setTimeoutOnConflicts(int count) {
107 
108     }
109 
110     public boolean isDBSimplificationAllowed() {
111         return false;
112     }
113 
114     public void setDBSimplificationAllowed(boolean status) {
115 
116     }
117 
118     public void printStat(PrintStream output, String prefix) {
119         // TODO Auto-generated method stub
120     }
121 
122     public void printStat(PrintWriter output, String prefix) {
123         // TODO Auto-generated method stub
124 
125     }
126 
127     public Map<String, Number> getStat() {
128         // TODO Auto-generated method stub
129         return null;
130     }
131 
132     public void clearLearntClauses() {
133         // TODO Auto-generated method stub
134 
135     }
136 
137     public int[] model() {
138         throw new UnsupportedOperationException();
139     }
140 
141     public boolean model(int var) {
142         throw new UnsupportedOperationException();
143     }
144 
145     public boolean isSatisfiable() throws TimeoutException {
146         throw new TimeoutException("There is no real solver behind!");
147     }
148 
149     public boolean isSatisfiable(IVecInt assumps) throws TimeoutException {
150         throw new TimeoutException("There is no real solver behind!");
151     }
152 
153     public int[] findModel() throws TimeoutException {
154         throw new UnsupportedOperationException();
155     }
156 
157     public int[] findModel(IVecInt assumps) throws TimeoutException {
158         throw new UnsupportedOperationException();
159     }
160 
161     /**
162      * @since 2.1
163      */
164     public boolean removeSubsumedConstr(IConstr c) {
165         return false;
166     }
167 
168     /**
169      * @since 2.1
170      */
171     public IConstr addBlockingClause(IVecInt literals)
172             throws ContradictionException {
173         throw new UnsupportedOperationException();
174     }
175 
176     /**
177      * @since 2.2
178      */
179     public <S extends ISolverService> SearchListener<S> getSearchListener() {
180         throw new UnsupportedOperationException();
181     }
182 
183     /**
184      * @since 2.1
185      */
186     public <S extends ISolverService> void setSearchListener(
187             SearchListener<S> sl) {
188     }
189 
190     /**
191      * @since 2.2
192      */
193     public boolean isVerbose() {
194         return true;
195     }
196 
197     /**
198      * @since 2.2
199      */
200     public void setVerbose(boolean value) {
201         // do nothing
202     }
203 
204     /**
205      * @since 2.2
206      */
207     public void setLogPrefix(String prefix) {
208         // do nothing
209 
210     }
211 
212     /**
213      * @since 2.2
214      */
215     public String getLogPrefix() {
216         return "";
217     }
218 
219     /**
220      * @since 2.2
221      */
222     public IVecInt unsatExplanation() {
223         throw new UnsupportedOperationException();
224     }
225 
226     public int[] primeImplicant() {
227         throw new UnsupportedOperationException();
228     }
229 
230     public int nConstraints() {
231         // TODO Auto-generated method stub
232         return 0;
233     }
234 
235     public int newVar(int howmany) {
236         // TODO Auto-generated method stub
237         return 0;
238     }
239 
240     public int nVars() {
241         // TODO Auto-generated method stub
242         return 0;
243     }
244 
245     public boolean isSolverKeptHot() {
246         return false;
247     }
248 
249     public void setKeepSolverHot(boolean value) {
250     }
251 }