Clover Coverage Report
Coverage timestamp: mer. juin 27 2007 07:27:16 CEST
20   83   6   5
10   46   0,45   4
4     2,25  
1    
 
  VarOrderHeapObjective       Line # 37 20 6 38,2% 0.38235295
 
No Tests
 
1    /*
2    * SAT4J: a SATisfiability library for Java Copyright (C) 2004-2006 Daniel Le Berre
3    *
4    * Based on the original minisat specification from:
5    *
6    * An extensible SAT solver. Niklas E?n and Niklas S?rensson. Proceedings of the
7    * Sixth International Conference on Theory and Applications of Satisfiability
8    * Testing, LNCS 2919, pp 502-518, 2003.
9    *
10    * This library is free software; you can redistribute it and/or modify it under
11    * the terms of the GNU Lesser General Public License as published by the Free
12    * Software Foundation; either version 2.1 of the License, or (at your option)
13    * any later version.
14    *
15    * This library is distributed in the hope that it will be useful, but WITHOUT
16    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17    * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18    * details.
19    *
20    * You should have received a copy of the GNU Lesser General Public License
21    * along with this library; if not, write to the Free Software Foundation, Inc.,
22    * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23    *
24    */
25    package org.sat4j.minisat.orders;
26   
27    import static org.sat4j.minisat.core.LiteralsUtils.neg;
28    import static org.sat4j.minisat.core.LiteralsUtils.var;
29   
30    import java.math.BigInteger;
31   
32    import org.sat4j.minisat.core.ILits;
33    import org.sat4j.reader.ObjectiveFunction;
34    import org.sat4j.specs.IVec;
35    import org.sat4j.specs.IVecInt;
36   
 
37    public class VarOrderHeapObjective extends VarOrderHeap<ILits> {
38   
39    /**
40    *
41    */
42    private static final long serialVersionUID = 1L;
43   
44    private ObjectiveFunction obj;
45   
 
46  0 toggle public void setObjectiveFunction(ObjectiveFunction obj) {
47  0 this.obj = obj;
48    }
49   
 
50  6 toggle @Override
51    public void init() {
52  6 super.init();
53  6 if (obj != null) {
54  0 IVecInt vars = obj.getVars();
55  0 IVec<BigInteger> coefs = obj.getCoeffs();
56  0 for (int i = 0; i < vars.size(); i++) {
57  0 int p = lits.getFromPool(vars.get(i));
58  0 BigInteger c = coefs.get(i);
59  0 if (c.signum() < 0) {
60  0 p = neg(p);
61    }
62  0 int var = var(p);
63  0 activity[var] = c.abs().doubleValue();
64  0 if (heap.inHeap(var))
65  0 heap.increase(var);
66  0 phase[var] = neg(p);
67    }
68    }
69    }
70   
 
71  88290435 toggle @Override
72    public void updateVar(int p) {
73  88290435 int var = p >> 1;
74  88290435 updateActivity(var);
75  88290435 if (heap.inHeap(var))
76  19552586 heap.increase(var);
77    }
78   
 
79  11779845 toggle @Override
80    public void assignLiteral(int p) {
81  11779845 phase[p>>1] = p;
82    }
83    }