clingo
|
A type holding data (possibly) shared between a set of minimize constraints. More...
#include <minimize_constraint.h>
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. More... | |
Public Member Functions | |
SharedMinimizeData (const SumVec &lhsAdjust, MinimizeMode m=MinimizeMode_t::optimize) | |
ThisType * | share () |
Increases the reference count of this object. More... | |
void | release () |
Decreases the object's reference count and destroys it if reference count drops to 0. More... | |
uint32 | numRules () const |
Number of minimize statements contained in this constraint. More... | |
uint32 | maxLevel () const |
MinimizeMode | mode () const |
Returns the active minimization mode. More... | |
bool | optimize () const |
Returns true if optimization is active. More... | |
wsum_t | lower (uint32 x) const |
Returns the lower bound of level x. More... | |
const wsum_t * | lower () const |
wsum_t | upper (uint32 x) const |
Returns the upper bound of level x. More... | |
const wsum_t * | upper () const |
wsum_t | adjust (uint32 x) const |
Returns the adjustment for level x. More... | |
wsum_t | optimum (uint32 x) const |
Returns the current (ajusted and possibly tentative) optimum for level x. More... | |
uint32 | level (uint32 i) const |
Returns the highest level of the literal with the given index i. More... | |
weight_t | weight (uint32 i) const |
Returns the most important weight of the literal with the given index i. More... | |
uint32 | generation () const |
bool | checkNext () const |
Returns whether minimization should search for solutions with current or next smaller upper bound. More... | |
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. More... | |
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. More... | |
bool | setMode (MinimizeMode m, const SumVec &bound) |
void | resetBounds () |
MinimizeConstraint * | attach (Solver &s, uint32 strat=UINT32_MAX, bool addRef=true) |
Attaches a new minimize constraint to this data object. More... | |
const SumVec * | setOptimum (const wsum_t *opt) |
Makes opt the new (tentative) optimum. More... | |
void | setLower (uint32 lev, wsum_t low) |
Sets the lower bound of level lev to low. More... | |
void | markOptimal () |
Marks the current tentative optimum as the final optimum. More... | |
Arithmetic functions on weights. | |
void | add (wsum_t *lhs, const WeightLiteral &lit) const |
Computes lhs += weight(lit). More... | |
void | add (wsum_t *lhs, const LevelWeight *w) const |
void | sub (wsum_t *lhs, const WeightLiteral &lit, uint32 &aLev) const |
Computes lhs -= weight(lit). More... | |
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. More... | |
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. More... | |
Static Public Member Functions | |
static wsum_t | maxBound () |
Public Attributes | |
WeightVec | weights |
WeightLiteral | lits [0] |
A type holding data (possibly) shared between a set of minimize constraints.
A type for holding sparse vectors of level weights of a multi-level constraint.
|
explicit |
|
inline |
Computes lhs += weight(lit).
|
inline |
|
inline |
Returns the adjustment for level x.
MinimizeConstraint * Clasp::SharedMinimizeData::attach | ( | Solver & | s, |
uint32 | strat = UINT32_MAX , |
||
bool | addRef = true |
||
) |
Attaches a new minimize constraint to this data object.
strat | The optimization strategy to use (see SolverStrategies::OptStrategy). If UINT32_MAX, the strategy is read from the solver's configuration. |
addRef | If true, the ref count of the shared object is increased. Otherwise, the new minimize constraint inherits the reference to the shared object. |
|
inline |
Returns whether minimization should search for solutions with current or next smaller upper bound.
|
inline |
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.
|
inline |
Returns (lhs + weight(lit)) > rhs.
bool Clasp::SharedMinimizeData::imp | ( | wsum_t * | lhs, |
const LevelWeight * | w, | ||
const wsum_t * | rhs, | ||
uint32 & | lev | ||
) | const |
|
inline |
Returns the highest level of the literal with the given index i.
|
inline |
Returns the lower bound of level x.
|
inline |
void Clasp::SharedMinimizeData::markOptimal | ( | ) |
Marks the current tentative optimum as the final optimum.
|
inlinestatic |
|
inline |
|
inline |
Returns the active minimization mode.
|
inline |
Number of minimize statements contained in this constraint.
|
inline |
Returns true if optimization is active.
|
inline |
Returns the current (ajusted and possibly tentative) optimum for level x.
|
inline |
Decreases the object's reference count and destroys it if reference count drops to 0.
void Clasp::SharedMinimizeData::resetBounds | ( | ) |
void Clasp::SharedMinimizeData::setLower | ( | uint32 | lev, |
wsum_t | low | ||
) |
Sets the lower bound of level lev to low.
bool Clasp::SharedMinimizeData::setMode | ( | MinimizeMode | m, |
const wsum_t * | bound = 0 , |
||
uint32 | boundSize = 0 |
||
) |
Sets the enumeration mode and (optionally) an initial bound.
|
inline |
Makes opt the new (tentative) optimum.
|
inline |
Increases the reference count of this object.
|
inline |
Computes lhs -= weight(lit).
void Clasp::SharedMinimizeData::sub | ( | wsum_t * | lhs, |
const LevelWeight * | w, | ||
uint32 & | aLev | ||
) | const |
|
inline |
Returns the upper bound of level x.
|
inline |
|
inline |
Returns the most important weight of the literal with the given index i.
|
inline |
Returns the weight of lit at level lev.
WeightLiteral Clasp::SharedMinimizeData::lits[0] |
WeightVec Clasp::SharedMinimizeData::weights |