Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
Clasp::MinimizeConstraint Class Reference

Base class for implementing (mulit-level) minimize statements. More...

#include <minimize_constraint.h>

Inheritance diagram for Clasp::MinimizeConstraint:
Inheritance graph
[legend]

List of all members.

Public Types

typedef SharedMinimizeData SharedData
typedef const SharedDataSharedDataP

Public Member Functions

virtual bool attach (Solver &s)=0
 Attaches this object to the given solver.
ConstraintcloneAttach (Solver &other)
 Returns a clone of this and adds necessary watches to the given solver.
void destroy (Solver *, bool)
 Default is to call delete this.
virtual bool handleModel (Solver &s)=0
 Shall commit the model in s to the shared data object.
virtual bool handleUnsat (Solver &s, bool upShared, LitVec &restore)=0
 Shall handle the unsatisfiable path in s.
virtual bool integrate (Solver &s)=0
 Shall activate the minimize constraint by integrating bounds stored in the shared data object.
virtual bool relax (Solver &s, bool reset)=0
 Shall relax this constraint (i.e. remove any bounds).
SharedDataP shared () const
 Returns a pointer to the shared representation of this constraint.

Protected Member Functions

 MinimizeConstraint (SharedData *s)
bool prepare (Solver &s, bool useTag)
 ~MinimizeConstraint ()

Protected Attributes

SharedDatashared_
Literal tag_

Detailed Description

Base class for implementing (mulit-level) minimize statements.

A solver contains at most one minimize constraint, but a minimize constraint may represent several minimize statements. In that case, each minimize statement has a unique level (starting at 0) and minimize statements with a lower level have higher priority. Priorities are handled like in smodels, i.e. statements with lower priority become relevant only if all statements with higher priority currently have an optimal assignment.

MinimizeConstraint supports two modes of operation: if mode is set to optimize, solutions are considered optimal only if they are strictly smaller than previous solutions. Otherwise, if mode is set to enumerate a solution is valid if it is not greater than the initially set optimum. Example: m0: {a, b} m1: {c, d} All models: {a, c,...}, {a, d,...} {b, c,...}, {b, d,...} {a, b,...} Mode = optimize: {a, c, ...} (m0 = 1, m1 = 1} Mode = enumerate and initial opt=1,1: {a, c, ...}, {a, d,...}, {b, c,...}, {b, d,...}

Definition at line 272 of file minimize_constraint.h.


Member Typedef Documentation

Definition at line 274 of file minimize_constraint.h.

Definition at line 275 of file minimize_constraint.h.


Constructor & Destructor Documentation

Definition at line 150 of file minimize_constraint.cpp.

Definition at line 152 of file minimize_constraint.cpp.


Member Function Documentation

virtual bool Clasp::MinimizeConstraint::attach ( Solver s) [pure virtual]

Attaches this object to the given solver.

Implemented in Clasp::DomainHeuristic::DomMinimize, Clasp::UncoreMinimize, and Clasp::DefaultMinimize.

Returns a clone of this and adds necessary watches to the given solver.

The function shall create and return a copy of this constraint to be used in the given solver. Furthermore, it shall add necessary watches to the given solver.

Note:
Return 0 to indicate that cloning is not supported.

Implements Clasp::Constraint.

Reimplemented in Clasp::DomainHeuristic::DomMinimize.

Definition at line 166 of file minimize_constraint.cpp.

void Clasp::MinimizeConstraint::destroy ( Solver s,
bool  detach 
) [virtual]

Default is to call delete this.

Reimplemented from Clasp::Constraint.

Reimplemented in Clasp::DomainHeuristic::DomMinimize, Clasp::UncoreMinimize, and Clasp::DefaultMinimize.

Definition at line 161 of file minimize_constraint.cpp.

virtual bool Clasp::MinimizeConstraint::handleModel ( Solver s) [pure virtual]

Shall commit the model in s to the shared data object.

The return value indicates whether the model is valid w.r.t the costs stored in the shared data object.

Implemented in Clasp::DomainHeuristic::DomMinimize, Clasp::UncoreMinimize, and Clasp::DefaultMinimize.

virtual bool Clasp::MinimizeConstraint::handleUnsat ( Solver s,
bool  upShared,
LitVec restore 
) [pure virtual]

Shall handle the unsatisfiable path in s.

Implemented in Clasp::DomainHeuristic::DomMinimize, Clasp::UncoreMinimize, and Clasp::DefaultMinimize.

virtual bool Clasp::MinimizeConstraint::integrate ( Solver s) [pure virtual]

Shall activate the minimize constraint by integrating bounds stored in the shared data object.

Implemented in Clasp::DomainHeuristic::DomMinimize, Clasp::UncoreMinimize, and Clasp::DefaultMinimize.

bool Clasp::MinimizeConstraint::prepare ( Solver s,
bool  useTag 
) [protected]

Definition at line 155 of file minimize_constraint.cpp.

virtual bool Clasp::MinimizeConstraint::relax ( Solver s,
bool  reset 
) [pure virtual]

Shall relax this constraint (i.e. remove any bounds).

If reset is true, shall also remove search-path related state.

Implemented in Clasp::DomainHeuristic::DomMinimize, Clasp::UncoreMinimize, and Clasp::DefaultMinimize.

Returns a pointer to the shared representation of this constraint.

Definition at line 277 of file minimize_constraint.h.


Member Data Documentation

Definition at line 302 of file minimize_constraint.h.

Definition at line 303 of file minimize_constraint.h.


The documentation for this class was generated from the following files:


clasp
Author(s): Benjamin Kaufmann
autogenerated on Thu Aug 27 2015 12:41:41