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  import org.sat4j.specs.UnitClauseProvider;
45  
46  public abstract class AbstractOutputSolver implements ISolver {
47  
48      protected int nbvars;
49  
50      protected int nbclauses;
51  
52      protected boolean fixedNbClauses = false;
53  
54      protected boolean firstConstr = true;
55  
56      /**
57  	 * 
58  	 */
59      private static final long serialVersionUID = 1L;
60  
61      public boolean removeConstr(IConstr c) {
62          throw new UnsupportedOperationException();
63      }
64  
65      public void addAllClauses(IVec<IVecInt> clauses)
66              throws ContradictionException {
67          throw new UnsupportedOperationException();
68      }
69  
70      public void setTimeout(int t) {
71          // TODO Auto-generated method stub
72  
73      }
74  
75      public void setTimeoutMs(long t) {
76          // TODO Auto-generated method stub
77      }
78  
79      public int getTimeout() {
80          return 0;
81      }
82  
83      /**
84       * @since 2.1
85       */
86      public long getTimeoutMs() {
87          return 0L;
88      }
89  
90      public void expireTimeout() {
91          // TODO Auto-generated method stub
92  
93      }
94  
95      public boolean isSatisfiable(IVecInt assumps, boolean global)
96              throws TimeoutException {
97          throw new TimeoutException("There is no real solver behind!");
98      }
99  
100     public boolean isSatisfiable(boolean global) throws TimeoutException {
101         throw new TimeoutException("There is no real solver behind!");
102     }
103 
104     public void printInfos(PrintWriter output, String prefix) {
105     }
106 
107     public void setTimeoutOnConflicts(int count) {
108 
109     }
110 
111     public boolean isDBSimplificationAllowed() {
112         return false;
113     }
114 
115     public void setDBSimplificationAllowed(boolean status) {
116 
117     }
118 
119     public void printStat(PrintStream output, String prefix) {
120         // TODO Auto-generated method stub
121     }
122 
123     public void printStat(PrintWriter output, String prefix) {
124         // TODO Auto-generated method stub
125 
126     }
127 
128     public Map<String, Number> getStat() {
129         // TODO Auto-generated method stub
130         return null;
131     }
132 
133     public void clearLearntClauses() {
134         // TODO Auto-generated method stub
135 
136     }
137 
138     public int[] model() {
139         throw new UnsupportedOperationException();
140     }
141 
142     public boolean model(int var) {
143         throw new UnsupportedOperationException();
144     }
145 
146     public boolean isSatisfiable() throws TimeoutException {
147         throw new TimeoutException("There is no real solver behind!");
148     }
149 
150     public boolean isSatisfiable(IVecInt assumps) throws TimeoutException {
151         throw new TimeoutException("There is no real solver behind!");
152     }
153 
154     public int[] findModel() throws TimeoutException {
155         throw new UnsupportedOperationException();
156     }
157 
158     public int[] findModel(IVecInt assumps) throws TimeoutException {
159         throw new UnsupportedOperationException();
160     }
161 
162     /**
163      * @since 2.1
164      */
165     public boolean removeSubsumedConstr(IConstr c) {
166         return false;
167     }
168 
169     /**
170      * @since 2.1
171      */
172     public IConstr addBlockingClause(IVecInt literals)
173             throws ContradictionException {
174         throw new UnsupportedOperationException();
175     }
176 
177     /**
178      * @since 2.2
179      */
180     public <S extends ISolverService> SearchListener<S> getSearchListener() {
181         throw new UnsupportedOperationException();
182     }
183 
184     /**
185      * @since 2.1
186      */
187     public <S extends ISolverService> void setSearchListener(
188             SearchListener<S> sl) {
189     }
190 
191     /**
192      * @since 2.2
193      */
194     public boolean isVerbose() {
195         return true;
196     }
197 
198     /**
199      * @since 2.2
200      */
201     public void setVerbose(boolean value) {
202         // do nothing
203     }
204 
205     /**
206      * @since 2.2
207      */
208     public void setLogPrefix(String prefix) {
209         // do nothing
210 
211     }
212 
213     /**
214      * @since 2.2
215      */
216     public String getLogPrefix() {
217         return "";
218     }
219 
220     /**
221      * @since 2.2
222      */
223     public IVecInt unsatExplanation() {
224         throw new UnsupportedOperationException();
225     }
226 
227     public int[] primeImplicant() {
228         throw new UnsupportedOperationException();
229     }
230 
231     public int nConstraints() {
232         // TODO Auto-generated method stub
233         return 0;
234     }
235 
236     public int newVar(int howmany) {
237         // TODO Auto-generated method stub
238         return 0;
239     }
240 
241     public int nVars() {
242         // TODO Auto-generated method stub
243         return 0;
244     }
245 
246     public boolean isSolverKeptHot() {
247         return false;
248     }
249 
250     public void setKeepSolverHot(boolean value) {
251     }
252 
253     public ISolver getSolvingEngine() {
254         throw new UnsupportedOperationException();
255     }
256 
257     public void setUnitClauseProvider(UnitClauseProvider upl) {
258         throw new UnsupportedOperationException();
259     }
260 }