5 #ifndef TB2SAMECONSTR_HPP_
6 #define TB2SAMECONSTR_HPP_
8 #include "tb2flowbasedconstr.hpp"
10 class SameConstraint :
public FlowBasedGlobalConstraint {
15 int nDistinctDomainValues;
16 pair<int, int> mapto(
int varindex, Value val);
18 size_t GetGraphAllocatedSize();
19 void buildGraph(Graph& g);
23 SameConstraint(WCSP* wcsp, EnumeratedVariable** scope_in,
int
28 Cost evalOriginal(
const String& s);
41 string getName() {
return "ssame"; }
42 void read(istream& file,
bool mult =
true);
43 void addVariablesToGroup(EnumeratedVariable* variable,
int groupID)
46 for (
int j = 0; j < arity_; j++) {
47 if (getVar(j) == variable) {
48 group[groupID].push_back(j);
55 for (
int g = 0; g < 2; g++)
56 sort(group[g].begin(), group[g].end());
60 void dump(ostream& os,
bool original =
true);
virtual bool solve()=0
simplifies and solves to optimality the problem
int nbtuples(vector< int > *tabdomaines)
Definition: narycsproblem.cpp:155
virtual void dump_wcsp(const char *fileName, bool original=true)=0
output current problem in a file
virtual void read_solution(const char *fileName, bool updateValueHeuristic=true)=0
read a solution from a file
virtual Cost getUb() const =0
gets internal primal upper bound
virtual void read_random(int n, int m, vector< int > &p, int seed, bool forceSubModular=false, string globalname="")=0
create a random WCSP, see WeightedCSP::read_random
virtual WeightedCSP * getWCSP()=0
access to its associated Weighted CSP
virtual Cost read_wcsp(const char *fileName)=0
reads a Cost function netwrok from a file (format as indicated by ToulBar2:: global variables)
virtual void parse_solution(const char *certificate)=0
read a solution from a string (see ToulBar2 option -x)
static WeightedCSPSolver * makeWeightedCSPSolver(Cost initUpperBound)
WeightedCSP Solver factory.
Definition: tb2solver.cpp:29
Definition: toulbar2lib.hpp:423