Commit 186fee0a authored by Simon de Givry's avatar Simon de Givry Committed by Thomas Schiex
Browse files

[code] cd src ; clang-format-4.0 -i *.hpp *.cpp */*.hpp */*.cpp

parent f498d5b8
......@@ -183,7 +183,7 @@ void Haplotype::readPedigree(const char* fileName, WCSP* wcsp)
int nbindividuals = 0;
int nbtypings = 0;
// map<int, int> allelesInv;
map<int, map<int, int> > allelesInv; // allelesInv[locus,val]=allele
map<int, map<int, int>> allelesInv; // allelesInv[locus,val]=allele
map<int, int> nballeles; // nballeles[i] number of allele for the marker i
map<int, int> maxallele;
int numal = 0;
......@@ -363,7 +363,7 @@ void Haplotype::readPedigree(const char* fileName, WCSP* wcsp)
map<int, int> nb;
if (ToulBar2::verbose >= 2)
cout << "Alleles encoding:" << endl;
for (map<int, map<int, int> >::iterator iter = alleles.begin(); iter != alleles.end(); ++iter) {
for (map<int, map<int, int>>::iterator iter = alleles.begin(); iter != alleles.end(); ++iter) {
//if ((*iter).first.second == 0) continue;
//nb[(*iter).first]++;
for (map<int, int>::iterator iter2 = iter->second.begin(); iter2 != iter->second.end(); ++iter2) {
......@@ -1128,12 +1128,12 @@ void Haplotype::initTransmission()
}
T.push_back(trans);
}
transmission.insert(pair<int, vector<int> >(fils->individual, T));
transmission.insert(pair<int, vector<int>>(fils->individual, T));
}
}
if (ToulBar2::verbose > 1) {
cout << "Transmission vectors : \n";
for (map<int, vector<int> >::iterator it = transmission.begin(); it != transmission.end(); ++it) {
for (map<int, vector<int>>::iterator it = transmission.begin(); it != transmission.end(); ++it) {
cout << "offspring " << it->first << ":\t ";
for (vector<int>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
if ((*it2) == 0)
......
......@@ -30,18 +30,18 @@ class Haplotype {
int nbloci;
vector<Individual> pedigree; // list of individuals
vector<int> genotypes; // list of genotyped individuals id.
map<int, vector<Genotype> > genoconvert; // convert domain value to genotype
map<int, vector<Genotype>> genoconvert; // convert domain value to genotype
map<int, int> individuals; // sorted list of pair<individual id, pedigree id>
map<int, map<int, int> > alleles; // sorted list of pair<locus number, allele number, encoding consecutive number>
map<int, map<int, int>> alleles; // sorted list of pair<locus number, allele number, encoding consecutive number>
int nbtyped; // number of individuals with a genotyped descendant
int generations;
bool bayesian;
vector<TProb> foundersprob;
map<int, map<int, int> > freqalleles; // frequencies of original alleles: freqalleles[allele number] = frequency
map<int, map<int, int>> freqalleles; // frequencies of original alleles: freqalleles[allele number] = frequency
map<int, int> gencorrects;
vector<Double> maplocus; // marker map
map<int, vector<int> > transmission; //pair <individual id, transmission vector>
map<int, vector<int>> transmission; //pair <individual id, transmission vector>
map<pair<int, int>, Double, classcomp> W;
int sire;
Double K;
......
......@@ -21,7 +21,7 @@ BinaryConstraint::BinaryConstraint(WCSP* wcsp, EnumeratedVariable* xx, Enumerate
assert(tab.size() == sizeX * sizeY);
supportX = vector<Value>(sizeX, y->getInf());
supportY = vector<Value>(sizeY, x->getInf());
trwsM = vector<Cost>(max(sizeX,sizeY), MIN_COST);
trwsM = vector<Cost>(max(sizeX, sizeY), MIN_COST);
costs = vector<StoreCost>(sizeX * sizeY, StoreCost(MIN_COST));
......@@ -166,7 +166,7 @@ bool BinaryConstraint::isFunctional(EnumeratedVariable* xin, EnumeratedVariable*
return false;
}
pair<pair<Cost, Cost>, pair<Cost, Cost> > BinaryConstraint::getMaxCost(int varIndex, Value a, Value b)
pair<pair<Cost, Cost>, pair<Cost, Cost>> BinaryConstraint::getMaxCost(int varIndex, Value a, Value b)
{
// cout << "getMaxCost(" << getVar(varIndex)->getName() << ") " << a << " <-> " << b << endl << *this << endl;
Cost maxcosta = MIN_COST;
......
......@@ -95,9 +95,9 @@ public:
unsigned int iy = y->toIndex(vy);
return costs[ix * sizeY + iy] - (deltaCostsX[ix] + deltaCostsY[iy]);
}
void projectTRWS(EnumeratedVariable *var, Value value, Cost cost)
void projectTRWS(EnumeratedVariable* var, Value value, Cost cost)
{
vector<StoreCost> &deltaCosts = (var == x)? deltaCostsX: deltaCostsY;
vector<StoreCost>& deltaCosts = (var == x) ? deltaCostsX : deltaCostsY;
deltaCosts[var->toIndex(value)] += cost;
var->project(value, cost, true);
}
......@@ -363,8 +363,8 @@ public:
supportX.resize(sizeX);
if (sizeY > supportY.size())
supportY.resize(sizeY);
if (max(sizeX,sizeY) > trwsM.size())
trwsM.resize(max(sizeX,sizeY), MIN_COST);
if (max(sizeX, sizeY) > trwsM.size())
trwsM.resize(max(sizeX, sizeY), MIN_COST);
if (sizeX * sizeY > costs.size())
costs.resize(sizeX * sizeY, StoreCost(MIN_COST));
linkX->removed = true;
......@@ -552,7 +552,7 @@ public:
}
}
pair<pair<Cost, Cost>, pair<Cost, Cost> > getMaxCost(int varIndex, Value a, Value b);
pair<pair<Cost, Cost>, pair<Cost, Cost>> getMaxCost(int varIndex, Value a, Value b);
double computeTightness()
{
......
......@@ -13,7 +13,7 @@
int CliqueConstraint::nextid{ 0 };
CliqueConstraint::CliqueConstraint(WCSP* wcsp, EnumeratedVariable** scope_in,
int arity_in, vector<vector<int> > clq_in,
int arity_in, vector<vector<int>> clq_in,
int rhs_in)
: AbstractNaryConstraint(wcsp, scope_in, arity_in)
, clqvals(clq_in)
......
......@@ -14,7 +14,7 @@
class CliqueConstraint : public AbstractNaryConstraint {
public:
CliqueConstraint(WCSP* wcsp, EnumeratedVariable** scope_in, int arity_in,
vector<vector<int> > clq_in, int rhs_in);
vector<vector<int>> clq_in, int rhs_in);
CliqueConstraint(WCSP* wcsp, EnumeratedVariable** scope_in, int arity_in);
~CliqueConstraint();
......@@ -93,7 +93,7 @@ public:
}
}
double computeTightness() override;
void dump(ostream&, bool) override {cerr << "warning! clique constraint cannot be dump." << endl;}
void dump(ostream&, bool) override { cerr << "warning! clique constraint cannot be dump." << endl; }
private:
// ----------------------------------------------------------------------
......@@ -102,9 +102,9 @@ private:
// two views of values in the clique: vector<bool> per variable
// (inclq[var][val] == true iff (var,val) is in clique) and array
// of values in clique per variable
vector<vector<bool> > inclq;
vector<vector<int> > clqvals;
vector<vector<int> > nonclqvals;
vector<vector<bool>> inclq;
vector<vector<int>> clqvals;
vector<vector<int>> nonclqvals;
// We require that we use at most rhs values among those in the
// clique (and of course, even if rhs > 1, no more than one value
......@@ -183,7 +183,7 @@ private:
vector<Cost> binary_extra;
// binary constraints in scope
vector<vector<BinaryConstraint*> > bc;
vector<vector<BinaryConstraint*>> bc;
std::ostream& printstate(std::ostream& os);
......@@ -197,7 +197,7 @@ public:
std::ostream& print(std::ostream& os) { return clq->printstate(os); }
};
void print(ostream& os) override {printstate (os);}
void print(ostream& os) override { printstate(os); }
};
inline std::ostream& operator<<(std::ostream& os, CliqueConstraint::state s)
......
......@@ -178,7 +178,7 @@ public:
virtual bool ishard();
virtual Cost getMinCost();
virtual pair<pair<Cost, Cost>, pair<Cost, Cost> > getMaxCost(int index, Value a, Value b) { return make_pair(make_pair(MAX_COST, MAX_COST), make_pair(MAX_COST, MAX_COST)); }
virtual pair<pair<Cost, Cost>, pair<Cost, Cost>> getMaxCost(int index, Value a, Value b) { return make_pair(make_pair(MAX_COST, MAX_COST), make_pair(MAX_COST, MAX_COST)); }
virtual Cost getMaxFiniteCost();
virtual void setInfiniteCost(Cost ub) {}
......
......@@ -462,7 +462,7 @@ void EnumeratedVariable::propagateDEE(Value a, Value b, bool dee)
ConstraintLink residue = ((dee) ? DEE : DEE2[a * getDomainInitSize() + b]);
ConstraintLink residue2 = ((dee) ? DEE : DEE2[b * getDomainInitSize() + a]);
if (costa <= costb && residue.constr && residue.constr->connected() && residue.scopeIndex < residue.constr->arity() && residue.constr->getVar(residue.scopeIndex) == this) {
pair<pair<Cost, Cost>, pair<Cost, Cost> > costs = residue.constr->getMaxCost(residue.scopeIndex, a, b);
pair<pair<Cost, Cost>, pair<Cost, Cost>> costs = residue.constr->getMaxCost(residue.scopeIndex, a, b);
if (totalmaxcosta <= getMaxCost())
totalmaxcosta += costs.first.first;
if (totalmaxcostb <= getMaxCost())
......@@ -475,7 +475,7 @@ void EnumeratedVariable::propagateDEE(Value a, Value b, bool dee)
return;
}
if (costb <= costa && residue2.constr && (residue2.constr != residue.constr || costa > costb) && residue2.constr->connected() && residue2.scopeIndex < residue2.constr->arity() && residue2.constr->getVar(residue2.scopeIndex) == this) {
pair<pair<Cost, Cost>, pair<Cost, Cost> > costs = residue2.constr->getMaxCost(residue2.scopeIndex, a, b);
pair<pair<Cost, Cost>, pair<Cost, Cost>> costs = residue2.constr->getMaxCost(residue2.scopeIndex, a, b);
if (totalmaxcosta <= getMaxCost())
totalmaxcosta += costs.first.first;
if (totalmaxcostb <= getMaxCost())
......@@ -492,7 +492,7 @@ void EnumeratedVariable::propagateDEE(Value a, Value b, bool dee)
continue;
if (costb <= costa && residue2.constr == (*iter).constr && residue2.scopeIndex == (*iter).scopeIndex)
continue;
pair<pair<Cost, Cost>, pair<Cost, Cost> > costs = (*iter).constr->getMaxCost((*iter).scopeIndex, a, b);
pair<pair<Cost, Cost>, pair<Cost, Cost>> costs = (*iter).constr->getMaxCost((*iter).scopeIndex, a, b);
if (costs.second.second > costa) {
if (dee) {
if (costa == costb)
......@@ -575,7 +575,7 @@ bool EnumeratedVariable::verifyDEE(Value a, Value b)
Cost totalmaxcost = getCost(a);
Cost totaldiffcost = getCost(a);
for (ConstraintList::iterator iter = constrs.begin(); iter != constrs.end(); ++iter) {
pair<pair<Cost, Cost>, pair<Cost, Cost> > costs = (*iter).constr->getMaxCost((*iter).scopeIndex, a, b);
pair<pair<Cost, Cost>, pair<Cost, Cost>> costs = (*iter).constr->getMaxCost((*iter).scopeIndex, a, b);
if (totalmaxcost + wcsp->getLb() < wcsp->getUb())
totalmaxcost += costs.first.first;
if (totaldiffcost + wcsp->getLb() < wcsp->getUb())
......
......@@ -15,7 +15,7 @@ protected:
vector<StoreCost> costs;
StoreCost deltaCost;
StoreValue support; // Warning! the unary support has to be backtrackable
double trwsGamma; // The gamma factor used in TRW-S
double trwsGamma; // The gamma factor used in TRW-S
DLink<VariableWithTimeStamp> linkACQueue;
DLink<VariableWithTimeStamp> linkDACQueue;
......@@ -91,8 +91,8 @@ public:
Cost getBinaryCost(ConstraintLink c, Value myvalue, Value itsvalue);
Cost getBinaryCost(BinaryConstraint* c, Value myvalue, Value itsvalue);
void setTRWSGamma(double g) {trwsGamma = g;}
double getTRWSGamma() const {return trwsGamma;}
void setTRWSGamma(double g) { trwsGamma = g; }
double getTRWSGamma() const { return trwsGamma; }
Cost getInfCost() const FINAL { return costs[toIndex(getInf())] - deltaCost; }
Cost getSupCost() const FINAL { return costs[toIndex(getSup())] - deltaCost; }
......
......@@ -136,7 +136,7 @@ void WeightedAmong::addToCostFunctionNetwork(WCSP* wcsp)
addVariablesIndex[newVariable] = wcsp->makeEnumeratedVariable(varname, 0, newVariable);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(addVariablesIndex[newVariable]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
if (VERBOSE) {
color(5);
cout << "new variable " << addVariablesIndex[newVariable] << "(" << ((EnumeratedVariable*)wcsp->getVar(addVariablesIndex[newVariable]))->getDomainInitSize() << ")";
......@@ -300,7 +300,7 @@ void WeightedRegular::addToCostFunctionNetwork(WCSP* wcsp)
int varIdx = wcsp->makeEnumeratedVariable(varname, (Value)0, (Value)domsize); // add q0 variable
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(varIdx));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
if (ToulBar2::verbose > 1)
cout << "wregular add varname =" << varname << "=> var index " << wcsp->numberOfVariables() << " domain size = " << domsize + 1 << endl;
} else {
......@@ -309,8 +309,8 @@ void WeightedRegular::addToCostFunctionNetwork(WCSP* wcsp)
//################################################initial state ##############################################
if (automaton->getInitialStates().size() > 0) {
vector<Cost> initial_states_costs(automaton->getNbStates(), top);
list<pair<int, Cost> > initialStates = automaton->getInitialStates();
for (list<pair<int, Cost> >::iterator it = initialStates.begin(); it != initialStates.end(); ++it) {
list<pair<int, Cost>> initialStates = automaton->getInitialStates();
for (list<pair<int, Cost>>::iterator it = initialStates.begin(); it != initialStates.end(); ++it) {
pair<int, Cost> initial = *it;
//cout << initial.first << " " << initial.second << endl;
initial_states_costs[initial.first] = initial.second;
......@@ -324,13 +324,13 @@ void WeightedRegular::addToCostFunctionNetwork(WCSP* wcsp)
//################################################accepting state ##############################################
for (int v = 1; v < arity + 1; v++) {
int unsigned domsize = automaton->getNbStates() - 1;
string varname = "WR"+to_string(v + q0);
string varname = "WR" + to_string(v + q0);
// DEBONLY(int theindex =)
// DEBONLY(int theindex =)
int theindex = wcsp->makeEnumeratedVariable(varname, (Value)0, (Value)domsize); // add qi variable
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(theindex));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
assert(theindex == v + (int)current_var_number);
if (ToulBar2::verbose > 1)
cout << "DEBUG>> wregular add varname =" << varname << "=> rank " << wcsp->numberOfVariables() << " domain = " << domsize + 1 << endl;
......@@ -340,10 +340,10 @@ void WeightedRegular::addToCostFunctionNetwork(WCSP* wcsp)
cout << "DEBUG>> wregular Final number of variables : " << wcsp->numberOfVariables() << endl;
vector<Cost> final_states_costs(automaton->getNbStates(), top);
list<pair<int, Cost> > acceptingStates = automaton->getAcceptingStates();
list<pair<int, Cost>> acceptingStates = automaton->getAcceptingStates();
if (acceptingStates.size() > 0) {
for (list<pair<int, Cost> >::iterator it = acceptingStates.begin(); it != acceptingStates.end(); ++it) {
for (list<pair<int, Cost>>::iterator it = acceptingStates.begin(); it != acceptingStates.end(); ++it) {
pair<int, Cost> accept = *it;
int unsigned t_index = accept.first;
Cost ucost = accept.second;
......@@ -503,8 +503,8 @@ void WeightedSum::addToCostFunctionNetwork(WCSP* wcsp)
string varname = "WSum" + to_string(nbVariableCFN) + "_" + to_string(newVariable);
addVariablesIndex[newVariable] = wcsp->makeEnumeratedVariable(varname, cumulDOWN, cumulUP);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(addVariablesIndex[newVariable]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q" + std::to_string(val));
//cout << "\033[45m" << "new variable \033[0m" << addVariablesIndex[newVariable] << "("<< ((EnumeratedVariable *) wcsp->getVar(addVariablesIndex[newVariable]))->getInf()<< ":" << ":" << ((EnumeratedVariable *) wcsp->getVar(addVariablesIndex[newVariable]))->getSup() << ")" << "\033[0m" << endl;
if (newVariable < arity) {
cumulDOWN += ((EnumeratedVariable*)wcsp->getVar(scope[newVariable]))->getInf();
......@@ -701,7 +701,7 @@ void WeightedVarSum::addToCostFunctionNetwork(WCSP* wcsp)
addVariablesIndex[newVariable] = wcsp->makeEnumeratedVariable(varname, cumulDOWN, cumulUP);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(addVariablesIndex[newVariable]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
//cout << "\033[45m" << "new variable \033[0m" << addVariablesIndex[newVariable] << "("<< ((EnumeratedVariable *) wcsp->getVar(addVariablesIndex[newVariable]))->getInf()<< ":" << ":" << ((EnumeratedVariable *) wcsp->getVar(addVariablesIndex[newVariable]))->getSup() << ")" << "\033[0m" << endl;
if (newVariable < arity) {
cumulDOWN += ((EnumeratedVariable*)wcsp->getVar(scope[newVariable]))->getInf();
......@@ -853,7 +853,7 @@ void WeightedOverlap::addToCostFunctionNetwork(WCSP* wcsp)
addVariablesOverlap[newVariable] = wcsp->makeEnumeratedVariable(varname, 0, 1);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(addVariablesOverlap[newVariable]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
//cout << "add overlap " << newVariable << endl;
}
......@@ -899,7 +899,7 @@ void WeightedOverlap::addToCostFunctionNetwork(WCSP* wcsp)
addVariablesAmong[newVariable] = wcsp->makeEnumeratedVariable(varname, 0, newVariable);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(addVariablesAmong[newVariable]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
//cout << "add among " << newVariable << endl;
}
......@@ -1125,7 +1125,7 @@ void WeightedVarAmong::addToCostFunctionNetwork(WCSP* wcsp)
addVariablesIndex[newVariable] = wcsp->makeEnumeratedVariable(varname, 0, newVariable);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(addVariablesIndex[newVariable]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
if (VERBOSE)
cout << "\033[45m"
......@@ -1307,7 +1307,7 @@ WeightedGcc::~WeightedGcc() {}
void WeightedGcc::setBounds(Value value, unsigned int lb, unsigned int ub)
{
map<Value, pair<unsigned int, unsigned int> >::iterator it;
map<Value, pair<unsigned int, unsigned int>>::iterator it;
it = bounds.find(value);
if (it != bounds.end()) {
cerr << "WeightedGcc::setBounds | Value " << value << " is already watch" << endl;
......@@ -1324,8 +1324,8 @@ void WeightedGcc::addToCostFunctionNetwork(WCSP* wcsp)
// int clb[nbcounters];
// int cub[nbcounters];
// int cscope[nbcounters];
for (map<Value, pair<unsigned int, unsigned int> >::iterator it = bounds.begin(); it != bounds.end(); ++it) {
pair<Value, pair<unsigned int, unsigned int> > bound = *it;
for (map<Value, pair<unsigned int, unsigned int>>::iterator it = bounds.begin(); it != bounds.end(); ++it) {
pair<Value, pair<unsigned int, unsigned int>> bound = *it;
//Adding a wamong
Value value = bound.first;
......@@ -1393,8 +1393,8 @@ void WeightedGcc::display()
}
cout << endl;
cout << semantics << " " << baseCost << endl;
for (map<Value, pair<unsigned int, unsigned int> >::iterator it = bounds.begin(); it != bounds.end(); ++it) {
pair<Value, pair<unsigned int, unsigned int> > bound = *it;
for (map<Value, pair<unsigned int, unsigned int>>::iterator it = bounds.begin(); it != bounds.end(); ++it) {
pair<Value, pair<unsigned int, unsigned int>> bound = *it;
cout << bound.first << " [" << (bound.second).first << ":" << (bound.second).second << "]" << endl;
}
}
......@@ -1448,12 +1448,12 @@ void WeightedSame::addToCostFunctionNetwork(WCSP* wcsp)
newVariable[positionVar][0] = wcsp->makeEnumeratedVariable(varnamel, 0, arity / 2);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(newVariable[positionVar][0]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
newVariable[positionVar][1] = wcsp->makeEnumeratedVariable(varnamer, 0, arity / 2);
theVar = ((EnumeratedVariable*)wcsp->getVar(newVariable[positionVar][1]));
for (unsigned int val = 0; val <= theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
positionVar++;
}
......@@ -1563,7 +1563,7 @@ WeightedSameGcc::~WeightedSameGcc() {}
void WeightedSameGcc::setBounds(Value value, unsigned int lb, unsigned int ub)
{
map<Value, pair<unsigned int, unsigned int> >::iterator it;
map<Value, pair<unsigned int, unsigned int>>::iterator it;
it = bounds.find(value);
if (it != bounds.end()) {
cerr << "WeightedSameGcc::setBounds | Value " << value << " is already watch" << endl;
......@@ -1597,12 +1597,12 @@ void WeightedSameGcc::addToCostFunctionNetwork(WCSP* wcsp)
newVariable[positionVar][0] = wcsp->makeEnumeratedVariable(varnamel, 0, arity / 2);
EnumeratedVariable* theVar = ((EnumeratedVariable*)wcsp->getVar(newVariable[positionVar][0]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
newVariable[positionVar][1] = wcsp->makeEnumeratedVariable(varnamer, 0, arity / 2);
theVar = ((EnumeratedVariable*)wcsp->getVar(newVariable[positionVar][1]));
for (unsigned int val = 0; val < theVar->getDomainInitSize(); val++)
theVar->newValueName("q"+std::to_string(val));
theVar->newValueName("q" + std::to_string(val));
positionVar++;
}
......@@ -1670,10 +1670,10 @@ void WeightedSameGcc::addToCostFunctionNetwork(WCSP* wcsp)
// Adding Unary Constraints (GCC PART)
for (int value = inf; value <= sup; value++) {
map<Value, pair<unsigned int, unsigned int> >::iterator it;
map<Value, pair<unsigned int, unsigned int>>::iterator it;
it = bounds.find(value);
if (it != bounds.end()) {
pair<Value, pair<unsigned int, unsigned int> > bound = *it;
pair<Value, pair<unsigned int, unsigned int>> bound = *it;
unsigned int lb = (bound.second).first;
unsigned int ub = (bound.second).second;
......@@ -1726,8 +1726,8 @@ void WeightedSameGcc::display()
}
cout << endl;
cout << semantics << " " << baseCost << endl;
for (map<Value, pair<unsigned int, unsigned int> >::iterator it = bounds.begin(); it != bounds.end(); ++it) {
pair<Value, pair<unsigned int, unsigned int> > bound = *it;
for (map<Value, pair<unsigned int, unsigned int>>::iterator it = bounds.begin(); it != bounds.end(); ++it) {
pair<Value, pair<unsigned int, unsigned int>> bound = *it;
cout << bound.first << " [" << (bound.second).first << ":" << (bound.second).second << "]" << endl;
}
}
......
......@@ -213,7 +213,7 @@ private:
string semantics;
Cost baseCost;
int nbValueToWatch;
map<Value, pair<unsigned int, unsigned int> > bounds;
map<Value, pair<unsigned int, unsigned int>> bounds;
public:
WeightedGcc();
......@@ -266,7 +266,7 @@ private:
string semantics;
Cost baseCost;
int nbValueToWatch;
map<Value, pair<unsigned int, unsigned int> > bounds;
map<Value, pair<unsigned int, unsigned int>> bounds;
public:
WeightedSameGcc();
......
......@@ -37,9 +37,9 @@ TernaryConstraint::TernaryConstraint(WCSP* wcsp,
functionX = vector<Value>(sizeY * sizeZ, WRONG_VAL);
functionY = vector<Value>(sizeX * sizeZ, WRONG_VAL);
functionZ = vector<Value>(sizeX * sizeY, WRONG_VAL);
supportX = vector<pair<Value, Value> >(sizeX, make_pair(y->getInf(), z->getInf()));
supportY = vector<pair<Value, Value> >(sizeY, make_pair(x->getInf(), z->getInf()));
supportZ = vector<pair<Value, Value> >(sizeZ, make_pair(x->getInf(), y->getInf()));
supportX = vector<pair<Value, Value>>(sizeX, make_pair(y->getInf(), z->getInf()));
supportY = vector<pair<Value, Value>>(sizeY, make_pair(x->getInf(), z->getInf()));
supportZ = vector<pair<Value, Value>>(sizeZ, make_pair(x->getInf(), y->getInf()));
// costs = vector<StoreCost>(sizeX*sizeY*sizeZ,StoreCost(MIN_COST,storeCost));
......@@ -312,7 +312,7 @@ void TernaryConstraint::extend(EnumeratedVariable* x, Value value, Cost cost, ve
x->extend(value, cost);
}
pair<pair<Cost, Cost>, pair<Cost, Cost> > TernaryConstraint::getMaxCost(int varIndex, Value a, Value b)
pair<pair<Cost, Cost>, pair<Cost, Cost>> TernaryConstraint::getMaxCost(int varIndex, Value a, Value b)
{
Cost maxcosta = MIN_COST;
Cost diffcosta = MIN_COST;
......
......@@ -222,9 +222,9 @@ protected:
vector<Value> functionY;
bool functionalZ;
vector<Value> functionZ;
vector<pair<Value, Value> > supportX;
vector<pair<Value, Value> > supportY;
vector<pair<Value, Value> > supportZ;
vector<pair<Value, Value>> supportX;
vector<pair<Value, Value>> supportY;
vector<pair<Value, Value>> supportZ;
vector<StoreCost> costsYZ;
inline Value getFunctionX(Value vy, Value vz) const { return functionX[y->toIndex(vy) * sizeZ + z->toIndex(vz)]; }
......@@ -244,22 +244,22 @@ protected:
void findSupport(T1 getCost, bool functionalY, T2 getFunctionY, bool functionalZ, T3 getFunctionZ,
EnumeratedVariable* x, EnumeratedVariable* y, EnumeratedVariable* z,
int getIndexX, int getIndexY, int getIndexZ,
vector<pair<Value, Value> >& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value> >& supportY, vector<pair<Value, Value> >& supportZ);
vector<pair<Value, Value>>& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value>>& supportY, vector<pair<Value, Value>>& supportZ);
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
void findFullSupport(T1 getCost, T2 getCostXZY, T3 getCostYZX, T4 getCostWithBinaries, T5 addCost, T6 addCostXZY, T7 addCostYZX, bool functionalX, T8 getFunctionX, bool functionalY, T9 getFunctionY, bool functionalZ, T10 getFunctionZ,
EnumeratedVariable* x, EnumeratedVariable* y, EnumeratedVariable* z,
int getIndexX, int getIndexY, int getIndexZ,
vector<pair<Value, Value> >& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value> >& supportY, vector<StoreCost>& deltaCostsY,
vector<pair<Value, Value> >& supportZ, vector<StoreCost>& deltaCostsZ,
vector<pair<Value, Value>>& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value>>& supportY, vector<StoreCost>& deltaCostsY,
vector<pair<Value, Value>>& supportZ, vector<StoreCost>& deltaCostsZ,
BinaryConstraint* xy, BinaryConstraint* xz, BinaryConstraint* yz);
bool verify(EnumeratedVariable* x, EnumeratedVariable* y, EnumeratedVariable* z);
template <typename T1, typename T2, typename T3>
bool isEAC(T1 getCostWithBinaries, bool functionalY, T2 getFunctionY, bool functionalZ, T3 getFunctionZ,
EnumeratedVariable* x, Value a, EnumeratedVariable* y, EnumeratedVariable* z,
vector<pair<Value, Value> >& supportX);
vector<pair<Value, Value>>& supportX);
void findSupportX() { findSupport(Functor_getCostXYZ(*this), functionalY, Functor_getFunctionYXZ(*this), functionalZ, Functor_getFunctionZXY(*this), x, y, z, 0, 1, 2, supportX, deltaCostsX, supportY, supportZ); }
void findSupportY() { findSupport(Functor_getCostYXZ(*this), functionalX, Functor_getFunctionXYZ(*this), functionalZ, Functor_getFunctionZYX(*this), y, x, z, 1, 0, 2, supportY, deltaCostsY, supportX, supportZ); }
......@@ -680,7 +680,7 @@ public:
}
void fillEAC2(EnumeratedVariable* x, EnumeratedVariable* y, EnumeratedVariable* z,
vector<pair<Value, Value> >& supportX)
vector<pair<Value, Value>>& supportX)
{
assert(x->canbe(x->getSupport()));
assert(getIndex(y) < getIndex(z));
......@@ -753,7 +753,7 @@ public:
bool verify();
pair<pair<Cost, Cost>, pair<Cost, Cost> > getMaxCost(int varIndex, Value a, Value b);
pair<pair<Cost, Cost>, pair<Cost, Cost>> getMaxCost(int varIndex, Value a, Value b);
template <typename T1, typename T2, typename T3, typename T4>
void projectTernaryBinary(T1 getCost, T2 getCostYZX, T3 addCostYZX, bool functionalX, T4 getFunctionX, EnumeratedVariable* xx, EnumeratedVariable* yy, EnumeratedVariable* zz, BinaryConstraint* yzin);
......@@ -1335,8 +1335,8 @@ template <typename T1, typename T2, typename T3>
void TernaryConstraint::findSupport(T1 getCost, bool functionalY, T2 getFunctionY, bool functionalZ, T3 getFunctionZ,
EnumeratedVariable* x, EnumeratedVariable* y, EnumeratedVariable* z,
int getIndexX, int getIndexY, int getIndexZ,
vector<pair<Value, Value> >& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value> >& supportY, vector<pair<Value, Value> >& supportZ)
vector<pair<Value, Value>>& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value>>& supportY, vector<pair<Value, Value>>& supportZ)
{
assert(getIndex(y) < getIndex(z)); // check that support.first/.second is consistent with y/z parameters
assert(connected());
......@@ -1420,9 +1420,9 @@ template <typename T1, typename T2, typename T3, typename T4, typename T5, typen
void TernaryConstraint::findFullSupport(T1 getCost, T2 getCostXZY, T3 getCostYZX, T4 getCostWithBinaries, T5 addCost, T6 addCostXZY, T7 addCostYZX, bool functionalX, T8 getFunctionX, bool functionalY, T9 getFunctionY, bool functionalZ, T10 getFunctionZ,
EnumeratedVariable* x, EnumeratedVariable* y, EnumeratedVariable* z,
int getIndexX, int getIndexY, int getIndexZ,
vector<pair<Value, Value> >& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value> >& supportY, vector<StoreCost>& deltaCostsY,
vector<pair<Value, Value> >& supportZ, vector<StoreCost>& deltaCostsZ,
vector<pair<Value, Value>>& supportX, vector<StoreCost>& deltaCostsX,
vector<pair<Value, Value>>& supportY, vector<StoreCost>& deltaCostsY,
vector<pair<Value, Value>>& supportZ, vector<StoreCost>& deltaCostsZ,
BinaryConstraint* xy, BinaryConstraint* xz, BinaryConstraint* yz)
{
assert(connected());
......@@ -1660,7 +1660,7 @@ void TernaryConstraint::projectTernaryBinary(T1 getCost, T2 getCostYZX, T3 addCo
template <typename T1, typename T2, typename T3>
bool TernaryConstraint::isEAC(T1 getCostWithBinaries, bool functionalY, T2 getFunctionY, bool functionalZ, T3 getFunctionZ,
EnumeratedVariable* x, Value a, EnumeratedVariable* y, EnumeratedVariable* z,
vector<pair<Value, Value> >& supportX)
vector<pair<Value, Value>>& supportX)
{
unsigned int xindex = x->toIndex(a);
assert(getIndex(y) < getIndex(z));
......
......@@ -38,8 +38,8 @@ VACExtension::VACExtension(WCSP* w)