savi.alg.maxsat3
Class StateMaxSAT3

java.lang.Object
  extended by savi.alg.maxsat3.StateMaxSAT3
All Implemented Interfaces:
java.lang.Cloneable, StateSkeleton

public class StateMaxSAT3
extends java.lang.Object
implements StateSkeleton

State representing MAX-3-SAT problem.


Field Summary
protected  Formula formula
          reference to formula
protected  boolean[] varValues
          current variables values
 
Constructor Summary
StateMaxSAT3(Formula formula)
          Creates a new instance of StateSAT3, initialize formula
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
 int countSatisfactClauses()
          Count number of current satisfied clauses
 void findInitialState(double temp)
          Create intial solution.
 void findNextState(double temp)
          Find next state.
 double getActualCost()
          Count current optimalization criterion.
 Formula getFormula()
          Returns reference to formula
 java.lang.String[] getSubmission()
          Return text representation of max-3-sat instance.
 boolean[] getVariableValues()
          Returns current variable assignment
 boolean isSatisfy()
          Return true if formula is satisfied with current variable assignment.
 void setFormula(Formula f)
          Set formula to this object
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

formula

protected Formula formula
reference to formula


varValues

protected boolean[] varValues
current variables values

Constructor Detail

StateMaxSAT3

public StateMaxSAT3(Formula formula)
Creates a new instance of StateSAT3, initialize formula

Parameters:
formula - formula
Method Detail

findInitialState

public void findInitialState(double temp)
Create intial solution.

Specified by:
findInitialState in interface StateSkeleton
Parameters:
temp - starting temperature

findNextState

public void findNextState(double temp)
Find next state.

Specified by:
findNextState in interface StateSkeleton
Parameters:
temp - current temperature

getActualCost

public double getActualCost()
Count current optimalization criterion.

Specified by:
getActualCost in interface StateSkeleton
Returns:
value of optimalization criterion.

isSatisfy

public boolean isSatisfy()
Return true if formula is satisfied with current variable assignment.

Returns:
satisfied

countSatisfactClauses

public int countSatisfactClauses()
Count number of current satisfied clauses

Returns:
number of satisfied clauses

clone

public java.lang.Object clone()
Creates and returns a copy of this object.

Specified by:
clone in interface StateSkeleton
Overrides:
clone in class java.lang.Object
Returns:
deep copy of StateMaxSAT3 object

getFormula

public Formula getFormula()
Returns reference to formula

Returns:
reference to formula

setFormula

public void setFormula(Formula f)
Set formula to this object

Parameters:
f - formula

getVariableValues

public boolean[] getVariableValues()
Returns current variable assignment

Returns:
variable assignment

getSubmission

public java.lang.String[] getSubmission()
Return text representation of max-3-sat instance.

Specified by:
getSubmission in interface StateSkeleton
Returns:
array of text lines