- java.lang.Object
-
- org.logicng.handlers.ComputationHandler
-
- org.logicng.handlers.TimeoutHandler
-
- org.logicng.handlers.TimeoutSATHandler
-
- All Implemented Interfaces:
Handler,SATHandler
public class TimeoutSATHandler extends TimeoutHandler implements SATHandler
A SAT handler which cancels the solving process after a given timeout.- Since:
- 1.0
- Version:
- 2.1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.logicng.handlers.TimeoutHandler
TimeoutHandler.TimerType
-
-
Field Summary
-
Fields inherited from class org.logicng.handlers.TimeoutHandler
designatedEnd, timeout, type
-
Fields inherited from class org.logicng.handlers.ComputationHandler
aborted
-
-
Constructor Summary
Constructors Constructor Description TimeoutSATHandler(long timeout)Constructs a new timeout handler with a given timeout and uses the timeout typeTimeoutHandler.TimerType.SINGLE_TIMEOUT.TimeoutSATHandler(long timeout, TimeoutHandler.TimerType type)Constructs a new timeout handler with a given timeout and a timeout type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandetectedConflict()This method is called every time a conflict is found.-
Methods inherited from class org.logicng.handlers.TimeoutHandler
started, timeLimitExceeded
-
Methods inherited from class org.logicng.handlers.ComputationHandler
aborted
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.logicng.handlers.SATHandler
finishedSolving
-
-
-
-
Constructor Detail
-
TimeoutSATHandler
public TimeoutSATHandler(long timeout, TimeoutHandler.TimerType type)Constructs a new timeout handler with a given timeout and a timeout type. The interpretation of the timeout depends on the timeout type:TimeoutHandler.TimerType.SINGLE_TIMEOUT: The timeout is started whenHandler.started()is called. Further calls toHandler.started()have no effect on the timeout. Thus, the timeout can only be started once.TimeoutHandler.TimerType.RESTARTING_TIMEOUT: The timeout is restarted whenHandler.started()is called.TimeoutHandler.TimerType.FIXED_END: Timeout which is interpreted as fixed point in time (in milliseconds) at which the computation should be aborted. The methodHandler.started()must still be called, but does not have an effect on the timeout.
SATHandler.detectedConflict().- Parameters:
timeout- the timeout in milliseconds, its meaning is defined by the timeout typetype- the type of the timer, must not benull
-
TimeoutSATHandler
public TimeoutSATHandler(long timeout)
Constructs a new timeout handler with a given timeout and uses the timeout typeTimeoutHandler.TimerType.SINGLE_TIMEOUT. Thus, the timeout is started whenHandler.started()is called and further calls toHandler.started()have no effect on the timeout.- Parameters:
timeout- the timeout in milliseconds
-
-
Method Detail
-
detectedConflict
public boolean detectedConflict()
Description copied from interface:SATHandlerThis method is called every time a conflict is found.- Specified by:
detectedConflictin interfaceSATHandler- Returns:
trueif the SAT solving should be continued, otherwisefalse
-
-