clingo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Public Member Functions | List of all members
Clasp::PBBuilder Class Reference

A class for defining a PB-problem. More...

#include <program_builder.h>

Inheritance diagram for Clasp::PBBuilder:
Inheritance graph
Collaboration diagram for Clasp::PBBuilder:
Collaboration graph

Public Member Functions

 PBBuilder ()
 
void prepareProblem (uint32 numVars, uint32 maxProduct, uint32 maxSoft, uint32 constraintHint=100)
 Creates necessary variables and prepares the problem. More...
 
uint32 numVars () const
 Returns the number of variables in the problem. More...
 
bool addConstraint (WeightLitVec &lits, weight_t bound, bool eq=false, weight_t cw=0)
 Adds the given PB-constraint to the problem. More...
 
Literal addProduct (LitVec &lits)
 Adds the given product to the problem. More...
 
bool addObjective (const WeightLitVec &min)
 Adds min as an objective function to the problem. More...
 
bool setSoftBound (wsum_t bound)
 Only allow solutions where the sum of violated soft constraint is less than bound. More...
 
- Public Member Functions inherited from Clasp::ProgramBuilder
 ProgramBuilder ()
 
virtual ~ProgramBuilder ()
 
bool startProgram (SharedContext &ctx)
 Starts the definition of a program. More...
 
bool parseProgram (StreamSource &prg)
 Parses the given stream as a program of type() and adds it to this object. More...
 
bool parseProgram (std::istream &prg)
 
bool updateProgram ()
 Unfreezes a currently frozen program. More...
 
bool endProgram ()
 Loads the program into the shared context passed to startProgram(). More...
 
void getAssumptions (LitVec &out) const
 Returns any assumptions that shall hold during solving. More...
 
SharedMinimizegetMinimizeConstraint (SumVec *softBound=0) const
 Returns an optimized representation of the program's minimize statements (if any). More...
 
void disposeMinimizeConstraint ()
 Removes a previously created minimize constraint. More...
 
int type () const
 Returns the type of program that is created by this builder. More...
 
bool frozen () const
 Returns true if the program is currently frozen. More...
 
virtual bool ok () const
 Returns true if the program is not conflicting. More...
 
SharedContextctx () const
 Returns the stored context object. More...
 

Additional Inherited Members

- Public Types inherited from Clasp::ProgramBuilder
typedef SharedMinimizeData SharedMinimize
 
typedef SingleOwnerPtr
< SharedMinimize,
ReleaseObject
MinPtr
 
- Protected Member Functions inherited from Clasp::ProgramBuilder
void addMinLit (WeightLiteral x)
 
void addMinRule (const WeightLitVec &lits)
 
void disposeMin ()
 
void setFrozen (bool frozen)
 
void setCtx (SharedContext *x)
 

Detailed Description

A class for defining a PB-problem.


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