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.sat;
31  
32  /**
33   * Launches the solver with the remote controller. This controller allows the
34   * user to restart the solver and to clean clauses.
35   * 
36   * 
37   * @author sroussel
38   * 
39   */
40  public class LaunchRemoteControl {
41  
42      /**
43       * @param args
44       */
45      public static void main(String[] args) {
46          // TODO Auto-generated method stub
47          // TelecommandeStrategy telecom = new TelecommandeStrategy();
48          //
49          // IPBCDCLSolver pbSolver = SolverFactory.newDefault();
50  
51          String filename = "";
52          String ramdisk = "";
53          //
54          // if(args.length>0){
55          // filename = args[0];
56          // }
57          // else
58          // filename="";
59  
60          switch (args.length) {
61          case 1:
62              filename = args[0];
63              break;
64          case 2:
65              if (args[0].equals("-r")) {
66                  ramdisk = args[1];
67              }
68              break;
69          case 3:
70              if (args[0].equals("-r")) {
71                  ramdisk = args[1];
72                  filename = args[2];
73              } else {
74                  ramdisk = args[2];
75                  filename = args[0];
76              }
77              break;
78          }
79  
80          // pbSolver.setTimeout(3600);
81          // pbSolver.setVerbose(true);
82          //
83          // Reader reader = new OPBReader2010(pbSolver);
84          //
85          // pbSolver.setRestartStrategy(telecom);
86          //
87          // telecom.setSolver(pbSolver);
88          // pbSolver.setLearnedConstraintsDeletionStrategy(telecom);
89          //
90          // //pbSolver.setNeedToReduceDB(true);
91          //
92          //
93          //
94          // pbSolver.setSearchListener(new MultiTracing(
95          // new ConflictLevelTracing(filename
96          // + "-conflict-level"), new DecisionTracing(
97          // filename + "-decision-indexes"),
98          // new LearnedClausesSizeTracing(filename
99          // + "-learned-clauses-size"),
100         // new ConflictDepthTracing(filename
101         // + "-conflict-depth")));
102         //
103         // RandomWalkDecorator rw = new
104         // RandomWalkDecorator((VarOrderHeap)((Solver)pbSolver).getOrder(), 0);
105         // pbSolver.setOrder(rw);
106 
107         // IPBCDCLSolver pbSolver = SolverFactory.newDefault();
108 
109         RemoteControlFrame frame = new RemoteControlFrame(filename, ramdisk);
110 
111         // try{
112         // IProblem problem = reader.parseInstance(filename);
113         // if(problem.isSatisfiable()){
114         // System.out.println("Satisfiable !");
115         // reader.decode(problem.model(), new PrintWriter(System.out));
116         // }
117         // else{
118         // System.out.println("Unsatisfiable !");
119         // }
120         //
121         //
122         // } catch (FileNotFoundException e) {
123         // // TODO Auto-generated catch block
124         // } catch (ParseFormatException e) {
125         // // TODO Auto-generated catch block
126         // } catch (IOException e) {
127         // // TODO Auto-generated catch block
128         // } catch (ContradictionException e) {
129         // System.out.println("Unsatisfiable (trivial)!");
130         // } catch (TimeoutException e) {
131         // System.out.println("Timeout, sorry!");
132         // }
133 
134     }
135 
136 }