View Javadoc

1   /*******************************************************************************
2    * SAT4J: a SATisfiability library for Java Copyright (C) 2004-2008 Daniel Le Berre
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   *******************************************************************************/
28  package org.sat4j.tools;
29  
30  import java.io.PrintStream;
31  import java.io.PrintWriter;
32  import java.util.Map;
33  
34  import org.sat4j.specs.ContradictionException;
35  import org.sat4j.specs.IConstr;
36  import org.sat4j.specs.ISolver;
37  import org.sat4j.specs.IVec;
38  import org.sat4j.specs.IVecInt;
39  import org.sat4j.specs.SearchListener;
40  import org.sat4j.specs.TimeoutException;
41  
42  public abstract class AbstractOutputSolver implements ISolver {
43  
44  	protected int nbvars;
45  
46  	protected int nbclauses;
47  
48  	protected boolean fixedNbClauses = false;
49  
50  	protected boolean firstConstr = true;
51  
52  	/**
53  	 * 
54  	 */
55  	private static final long serialVersionUID = 1L;
56  
57  	public boolean removeConstr(IConstr c) {
58  		throw new UnsupportedOperationException();
59  	}
60  
61  	public void addAllClauses(IVec<IVecInt> clauses)
62  			throws ContradictionException {
63  		throw new UnsupportedOperationException();
64  	}
65  
66  	public void setTimeout(int t) {
67  		// TODO Auto-generated method stub
68  
69  	}
70  
71  	public void setTimeoutMs(long t) {
72  		// TODO Auto-generated method stub
73  	}
74  
75  	public int getTimeout() {
76  		return 0;
77  	}
78  
79  	/**
80  	 * @since 2.1
81  	 */
82  	public long getTimeoutMs() {
83  		return 0L;
84  	}
85  
86  	public void expireTimeout() {
87  		// TODO Auto-generated method stub
88  
89  	}
90  
91  	public boolean isSatisfiable(IVecInt assumps, boolean global)
92  			throws TimeoutException {
93  		throw new TimeoutException("There is no real solver behind!");
94  	}
95  
96  	public boolean isSatisfiable(boolean global) throws TimeoutException {
97  		throw new TimeoutException("There is no real solver behind!");
98  	}
99  
100 	public void printInfos(PrintWriter output, String prefix) {
101 	}
102 
103 	public void setTimeoutOnConflicts(int count) {
104 
105 	}
106 
107 	public boolean isDBSimplificationAllowed() {
108 		return false;
109 	}
110 
111 	public void setDBSimplificationAllowed(boolean status) {
112 
113 	}
114 
115 	public void printStat(PrintStream output, String prefix) {
116 		// TODO Auto-generated method stub
117 	}
118 
119 	public void printStat(PrintWriter output, String prefix) {
120 		// TODO Auto-generated method stub
121 
122 	}
123 
124 	public Map<String, Number> getStat() {
125 		// TODO Auto-generated method stub
126 		return null;
127 	}
128 
129 	public void clearLearntClauses() {
130 		// TODO Auto-generated method stub
131 
132 	}
133 
134 	public int[] model() {
135 		throw new UnsupportedOperationException();
136 	}
137 
138 	public boolean model(int var) {
139 		throw new UnsupportedOperationException();
140 	}
141 
142 	public boolean isSatisfiable() throws TimeoutException {
143 		throw new TimeoutException("There is no real solver behind!");
144 	}
145 
146 	public boolean isSatisfiable(IVecInt assumps) throws TimeoutException {
147 		throw new TimeoutException("There is no real solver behind!");
148 	}
149 
150 	public int[] findModel() throws TimeoutException {
151 		throw new UnsupportedOperationException();
152 	}
153 
154 	public int[] findModel(IVecInt assumps) throws TimeoutException {
155 		throw new UnsupportedOperationException();
156 	}
157 
158 	/**
159 	 * @since 2.1
160 	 */
161 	public boolean removeSubsumedConstr(IConstr c) {
162 		return false;
163 	}
164 
165 	/**
166 	 * @since 2.1
167 	 */
168 	public IConstr addBlockingClause(IVecInt literals)
169 			throws ContradictionException {
170 		throw new UnsupportedOperationException();
171 	}
172 
173 	/**
174 	 * @since 2.2
175 	 */
176 	public SearchListener getSearchListener() {
177 		throw new UnsupportedOperationException();
178 	}
179 
180 	/**
181 	 * @since 2.1
182 	 */
183 	public void setSearchListener(SearchListener sl) {
184 	}
185 
186 	/**
187 	 * @since 2.2
188 	 */
189 	public boolean isVerbose() {
190 		return true;
191 	}
192 
193 	/**
194 	 * @since 2.2
195 	 */
196 	public void setVerbose(boolean value) {
197 		// do nothing
198 	}
199 
200 	/**
201 	 * @since 2.2
202 	 */
203 	public void setLogPrefix(String prefix) {
204 		// do nothing
205 
206 	}
207 
208 	/**
209 	 * @since 2.2
210 	 */
211 	public String getLogPrefix() {
212 		return "";
213 	}
214 
215 	/**
216 	 * @since 2.2
217 	 */
218 	public IVecInt unsatExplanation() {
219 		throw new UnsupportedOperationException();
220 	}
221 
222 	public int[] primeImplicant() {
223 		throw new UnsupportedOperationException();
224 	}
225 }