Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes
Clasp::SharedMinimizeData Class Reference

A type holding data (possibly) shared between a set of minimize constraints. More...

#include <minimize_constraint.h>

List of all members.

Classes

struct  LevelWeight
 A type to represent a weight at a certain level. More...

Public Types

typedef SharedMinimizeData ThisType
typedef PodVector< LevelWeight >
::type 
WeightVec
 A type for holding sparse vectors of level weights of a multi-level constraint.

Public Member Functions

wsum_t adjust (uint32 x) const
 Returns the adjustment for level x.
bool checkNext () const
 Returns whether minimization should search for solutions with current or next smaller upper bound.
uint32 generation () const
bool heuristic (Solver &s, bool full) const
 Assumes literals from last model to false until either a conflict is reached or all literals are assigned.
uint32 level (uint32 i) const
 Returns the highest level of the literal with the given index i.
wsum_t lower (uint32 x) const
 Returns the lower bound of level x.
const wsum_tlower () const
uint32 maxLevel () const
MinimizeMode mode () const
 Returns the active minimization mode.
uint32 numRules () const
 Number of minimize statements contained in this constraint.
bool optimize () const
 Returns true if optimization is active.
wsum_t optimum (uint32 x) const
 Returns the current (ajusted and possibly tentative) optimum for level x.
void release ()
 Decreases the object's reference count and destroys it if reference count drops to 0.
ThisTypeshare ()
 Increases the reference count of this object.
 SharedMinimizeData (const SumVec &lhsAdjust, MinimizeMode m=MinimizeMode_t::optimize)
wsum_t upper (uint32 x) const
 Returns the upper bound of level x.
const wsum_tupper () const
weight_t weight (uint32 i) const
 Returns the most important weight of the literal with the given index i.
interface for optimization

The following functions shall not be called concurrently.

bool setMode (MinimizeMode m, const wsum_t *bound=0, uint32 boundSize=0)
 Sets the enumeration mode and (optionally) an initial bound.
bool setMode (MinimizeMode m, const SumVec &bound)
void resetBounds ()
MinimizeConstraintattach (Solver &s, uint32 strat=UINT32_MAX, bool addRef=true)
 Attaches a new minimize constraint to this data object.
const SumVecsetOptimum (const wsum_t *opt)
 Makes opt the new (tentative) optimum.
void setLower (uint32 lev, wsum_t low)
 Sets the lower bound of level lev to low.
void markOptimal ()
 Marks the current tentative optimum as the final optimum.
Arithmetic functions on weights.
void add (wsum_t *lhs, const WeightLiteral &lit) const
 Computes lhs += weight(lit).
void add (wsum_t *lhs, const LevelWeight *w) const
void sub (wsum_t *lhs, const WeightLiteral &lit, uint32 &aLev) const
 Computes lhs -= weight(lit).
void sub (wsum_t *lhs, const LevelWeight *w, uint32 &aLev) const
bool imp (wsum_t *lhs, const WeightLiteral &lit, const wsum_t *rhs, uint32 &lev) const
 Returns (lhs + weight(lit)) > rhs.
bool imp (wsum_t *lhs, const LevelWeight *w, const wsum_t *rhs, uint32 &lev) const
weight_t weight (const WeightLiteral &lit, uint32 lev) const
 Returns the weight of lit at level lev.

Static Public Member Functions

static wsum_t maxBound ()

Public Attributes

WeightLiteral lits [0]
WeightVec weights

Private Types

typedef Clasp::atomic< uint32 > Atomic

Private Member Functions

void destroy () const
SharedMinimizeDataoperator= (const SharedMinimizeData &)
 SharedMinimizeData (const SharedMinimizeData &)
 ~SharedMinimizeData ()

Private Attributes

SumVec adjust_
Atomic count_
Atomic gCount_
SumVec lower_
MinimizeMode mode_
SumVec opt_ [2]
uint32 optGen_

Detailed Description

A type holding data (possibly) shared between a set of minimize constraints.

Definition at line 58 of file minimize_constraint.h.


Member Typedef Documentation

Definition at line 170 of file minimize_constraint.h.

Definition at line 60 of file minimize_constraint.h.

A type for holding sparse vectors of level weights of a multi-level constraint.

Definition at line 74 of file minimize_constraint.h.


Constructor & Destructor Documentation

Definition at line 27 of file minimize_constraint.cpp.

Definition at line 33 of file minimize_constraint.cpp.


Member Function Documentation

void Clasp::SharedMinimizeData::add ( wsum_t lhs,
const WeightLiteral lit 
) const [inline]

Computes lhs += weight(lit).

Definition at line 151 of file minimize_constraint.h.

void Clasp::SharedMinimizeData::add ( wsum_t lhs,
const LevelWeight w 
) const [inline]

Definition at line 152 of file minimize_constraint.h.

wsum_t Clasp::SharedMinimizeData::adjust ( uint32  x) const [inline]

Returns the adjustment for level x.

Definition at line 95 of file minimize_constraint.h.

MinimizeConstraint * Clasp::SharedMinimizeData::attach ( Solver s,
uint32  strat = UINT32_MAX,
bool  addRef = true 
)

Attaches a new minimize constraint to this data object.

Parameters:
stratThe optimization strategy to use (see SolverStrategies::OptStrategy). If UINT32_MAX, the strategy is read from the solver's configuration.
addRefIf true, the ref count of the shared object is increased. Otherwise, the new minimize constraint inherits the reference to the shared object.

Definition at line 80 of file minimize_constraint.cpp.

bool Clasp::SharedMinimizeData::checkNext ( ) const [inline]

Returns whether minimization should search for solutions with current or next smaller upper bound.

Definition at line 104 of file minimize_constraint.h.

void Clasp::SharedMinimizeData::destroy ( ) const [private]

Definition at line 35 of file minimize_constraint.cpp.

uint32 Clasp::SharedMinimizeData::generation ( ) const [inline]

Definition at line 102 of file minimize_constraint.h.

bool Clasp::SharedMinimizeData::heuristic ( Solver s,
bool  full 
) const

Assumes literals from last model to false until either a conflict is reached or all literals are assigned.

Definition at line 121 of file minimize_constraint.cpp.

bool Clasp::SharedMinimizeData::imp ( wsum_t lhs,
const WeightLiteral lit,
const wsum_t rhs,
uint32 &  lev 
) const [inline]

Returns (lhs + weight(lit)) > rhs.

Definition at line 157 of file minimize_constraint.h.

bool Clasp::SharedMinimizeData::imp ( wsum_t lhs,
const LevelWeight w,
const wsum_t rhs,
uint32 &  lev 
) const

Definition at line 137 of file minimize_constraint.cpp.

uint32 Clasp::SharedMinimizeData::level ( uint32  i) const [inline]

Returns the highest level of the literal with the given index i.

Definition at line 99 of file minimize_constraint.h.

wsum_t Clasp::SharedMinimizeData::lower ( uint32  x) const [inline]

Returns the lower bound of level x.

Definition at line 89 of file minimize_constraint.h.

const wsum_t* Clasp::SharedMinimizeData::lower ( ) const [inline]

Definition at line 90 of file minimize_constraint.h.

Marks the current tentative optimum as the final optimum.

Note:
Once a final optimum is set, further calls to setOptimum() are ignored until resetBounds() is called.

Definition at line 118 of file minimize_constraint.cpp.

static wsum_t Clasp::SharedMinimizeData::maxBound ( ) [inline, static]

Definition at line 83 of file minimize_constraint.h.

uint32 Clasp::SharedMinimizeData::maxLevel ( ) const [inline]

Definition at line 82 of file minimize_constraint.h.

Returns the active minimization mode.

Definition at line 85 of file minimize_constraint.h.

uint32 Clasp::SharedMinimizeData::numRules ( ) const [inline]

Number of minimize statements contained in this constraint.

Definition at line 81 of file minimize_constraint.h.

SharedMinimizeData& Clasp::SharedMinimizeData::operator= ( const SharedMinimizeData ) [private]
bool Clasp::SharedMinimizeData::optimize ( ) const [inline]

Returns true if optimization is active.

Definition at line 87 of file minimize_constraint.h.

wsum_t Clasp::SharedMinimizeData::optimum ( uint32  x) const [inline]

Returns the current (ajusted and possibly tentative) optimum for level x.

Definition at line 97 of file minimize_constraint.h.

Decreases the object's reference count and destroys it if reference count drops to 0.

Definition at line 79 of file minimize_constraint.h.

Definition at line 40 of file minimize_constraint.cpp.

void Clasp::SharedMinimizeData::setLower ( uint32  lev,
wsum_t  low 
)

Sets the lower bound of level lev to low.

Definition at line 115 of file minimize_constraint.cpp.

bool Clasp::SharedMinimizeData::setMode ( MinimizeMode  m,
const wsum_t bound = 0,
uint32  boundSize = 0 
)

Sets the enumeration mode and (optionally) an initial bound.

Note:
If m is MinimizeMode::enumerate, the caller should always set a bound. Otherwise, *all* solutions are considered valid.

Definition at line 59 of file minimize_constraint.cpp.

bool Clasp::SharedMinimizeData::setMode ( MinimizeMode  m,
const SumVec bound 
) [inline]

Definition at line 119 of file minimize_constraint.h.

Makes opt the new (tentative) optimum.

Precondition:
opt is a pointer to an array of size numRules()

Definition at line 102 of file minimize_constraint.cpp.

Increases the reference count of this object.

Definition at line 77 of file minimize_constraint.h.

void Clasp::SharedMinimizeData::sub ( wsum_t lhs,
const WeightLiteral lit,
uint32 &  aLev 
) const [inline]

Computes lhs -= weight(lit).

Definition at line 154 of file minimize_constraint.h.

void Clasp::SharedMinimizeData::sub ( wsum_t lhs,
const LevelWeight w,
uint32 &  aLev 
) const

Definition at line 133 of file minimize_constraint.cpp.

wsum_t Clasp::SharedMinimizeData::upper ( uint32  x) const [inline]

Returns the upper bound of level x.

Definition at line 92 of file minimize_constraint.h.

const wsum_t* Clasp::SharedMinimizeData::upper ( ) const [inline]

Definition at line 93 of file minimize_constraint.h.

weight_t Clasp::SharedMinimizeData::weight ( uint32  i) const [inline]

Returns the most important weight of the literal with the given index i.

Definition at line 101 of file minimize_constraint.h.

weight_t Clasp::SharedMinimizeData::weight ( const WeightLiteral lit,
uint32  lev 
) const [inline]

Returns the weight of lit at level lev.

Definition at line 162 of file minimize_constraint.h.


Member Data Documentation

Definition at line 171 of file minimize_constraint.h.

Definition at line 175 of file minimize_constraint.h.

Definition at line 176 of file minimize_constraint.h.

Definition at line 180 of file minimize_constraint.h.

Definition at line 172 of file minimize_constraint.h.

Definition at line 174 of file minimize_constraint.h.

Definition at line 173 of file minimize_constraint.h.

Definition at line 177 of file minimize_constraint.h.

Definition at line 179 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