|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsavi.alg.sat3.Formula
savi.alg.weighsat3.WeightedFormula
public class WeightedFormula
Class representing boolean formula with weights.
Field Summary | |
---|---|
protected int |
totalWeight
sum of all weights |
protected int[] |
varWeights
list of weights |
Fields inherited from class savi.alg.sat3.Formula |
---|
clauses, varsCount |
Constructor Summary | |
---|---|
WeightedFormula(java.io.BufferedReader br)
Creates a new instance of WeightedFormula, read content from stream. |
|
WeightedFormula(int countClauses,
int varsCount)
Creates a new instance of WeightedFormula, create random formula with weights |
Method Summary | |
---|---|
WeightedFormula |
clone()
Create a copy of this object. |
int[] |
getWeights()
Return list of weights |
double |
percentualWeight(boolean[] vars)
Return fraction between weight of variables in state true and summary (total) weight |
protected void |
readFromStream(java.io.BufferedReader br)
Read submission from stream. |
int |
satisfyWeight(boolean[] vars)
Return weight of variables in state true . |
int |
totalWeight()
Return total (summary) weight. |
Methods inherited from class savi.alg.sat3.Formula |
---|
clausesCount, countSatisfactClauses, getClauses, isSatisfact, percentualSatisfact, reduceNumberOfClauses, varsCount |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int[] varWeights
protected int totalWeight
Constructor Detail |
---|
public WeightedFormula(int countClauses, int varsCount)
countClauses
- number of clausesvarsCount
- number of variablespublic WeightedFormula(java.io.BufferedReader br) throws WrongInputFormulaData
br
- input stream with buffered readed
WrongInputFormulaData
- signals syntax errorMethod Detail |
---|
public double percentualWeight(boolean[] vars)
true
and summary (total) weight
vars
- variables assignment
public int satisfyWeight(boolean[] vars)
true
.
vars
- list of variables
public int totalWeight()
public int[] getWeights()
protected void readFromStream(java.io.BufferedReader br) throws WrongInputFormulaData
readFromStream
in class Formula
br
- input stream with buffered readed
WrongInputFormulaData
- signals syntax errorpublic WeightedFormula clone()
clone
in class Formula
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |