Commit 9624274b authored by Thomas Schiex's avatar Thomas Schiex
Browse files

Printing decimal LB/UB more often.

parent d909d91b
......@@ -241,7 +241,7 @@ void Solver::read_solution(const char* filename, bool updateValueHeuristic)
}
wcsp->assignLS(variables, values);
if (ToulBar2::verbose >= 0)
cout << " Solution cost: [" << wcsp->getLb() << "," << wcsp->getUb() << "] (nb. of unassigned variables: " << wcsp->numberOfUnassignedVariables() << ")" << endl;
cout << " Solution cost: [" << std::fixed << std::setprecision(ToulBar2::decimalPoint) << wcsp->getDLb() << "," << wcsp->getDUb() << "] (nb. of unassigned variables: " << wcsp->numberOfUnassignedVariables() << ")" << endl;
assert(wcsp->numberOfUnassignedVariables() == 0);
if (ToulBar2::verifyOpt) {
ToulBar2::verifiedOptimum = wcsp->getLb();
......@@ -313,7 +313,7 @@ void Solver::parse_solution(const char* certificate)
}
wcsp->assignLS(variables, values);
if (ToulBar2::verbose >= 0)
cout << " Solution cost: [" << wcsp->getLb() << "," << wcsp->getUb() << "] (nb. of unassigned variables: " << wcsp->numberOfUnassignedVariables() << ")" << endl;
cout << " Solution cost: [" << std::fixed << std::setprecision(ToulBar2::decimalPoint) << wcsp->getDLb() << "," << wcsp->getDUb() << "] (nb. of unassigned variables: " << wcsp->numberOfUnassignedVariables() << ")" << endl;
// if (ToulBar2::btdMode>=2) wcsp->updateUb(wcsp->getLb()+UNIT_COST);
// Store::restore(depth);
......
......@@ -14,6 +14,7 @@
#include "tb2clusters.hpp"
#include <list>
#include <algorithm>
#include <iomanip>
class tVACStat {
public:
......@@ -257,7 +258,7 @@ bool VACExtension::propagate()
if (!isvac) {
enforcePass2();
if (ToulBar2::verbose > 0)
cout << "VAC Lb: " << wcsp->getLb() << " incvar: " << inconsistentVariable << " minlambda: " << minlambda << " itThreshold: " << itThreshold << endl;
cout << "VAC Lb: " << std::fixed << std::setprecision(ToulBar2::decimalPoint) << wcsp->getDLb() << " incvar: " << inconsistentVariable << " minlambda: " << minlambda << " itThreshold: " << itThreshold << endl;
util = enforcePass3();
} else {
nextScaleCost();
......@@ -514,7 +515,7 @@ void VACExtension::enforcePass2()
// maxK = wcsp->getUb() - wcsp->getLb();
//}
if (ToulBar2::verbose > 1)
cout << "minLambda: " << minlambda << "\t\t (lb = " << wcsp->getLb() << ", ub = " << wcsp->getUb() << ")" << endl;
cout << "minLambda: " << minlambda << "\t\t (lb = " << std::fixed << std::setprecision(ToulBar2::decimalPoint) << wcsp->getDLb() << ", ub = " << wcsp->getDUb() << ")" << endl;
}
bool VACExtension::enforcePass3()
......@@ -721,10 +722,10 @@ void VACExtension::printStat(bool ini)
{
if (ToulBar2::verbose >= 0) {
long double mean = to_double(sumlb) / (long double)nlb;
cout << "VAC mean lb/incr: " << mean << " total increments: " << nlb
cout << "VAC mean lb/incr: " << std::setprecision(1) << mean << " total increments: " << nlb
<< " cyclesize: " << (double)sumvars / (double)nlb << " k: " << (double)sumk / (double)nlb << " (mean), " << theMaxK << " (max)" << endl;
if (ini)
cout << "Lb after VAC: " << wcsp->getLb() << endl;
cout << "Lb after VAC: " << std::fixed << std::setprecision(ToulBar2::decimalPoint) << wcsp->getDLb() << endl;
}
//sort(heap.begin(), heap.end(), cmp_function);
/*cout << "Vars: ";
......@@ -776,7 +777,7 @@ void VACExtension::minsumDiffusion()
int maxit = ToulBar2::minsumDiffusion;
cout << "MinSumDiffusion: " << endl;
cout << " max iterations " << maxit << endl;
cout << " C0 = " << wcsp->getLb() << endl;
cout << " C0 = " << std::fixed << std::setprecision(ToulBar2::decimalPoint) << wcsp->getDLb() << endl;
int ntimes = 0;
while (change && (ntimes < maxit)) {
change = false;
......@@ -812,7 +813,7 @@ void VACExtension::minsumDiffusion()
&& !wcsp->getElimTernCtr(i)->isSep())
wcsp->getElimTernCtr(i)->propagate();
wcsp->propagate();
cout << " C0 = " << wcsp->getLb() << endl;
cout << " C0 = " << std::fixed << std::setprecision(ToulBar2::decimalPoint) << wcsp->getDLb() << endl;
// printTightMatrix();
}
}
......
......@@ -44,6 +44,7 @@
#include "tb2clause.hpp"
#include <algorithm>
#include <iomanip>
/*
* Global variables with their default value
......@@ -2160,7 +2161,7 @@ void WCSP::printNCBuckets()
void WCSP::print(ostream& os)
{
os << "Objective: [" << getLb() << "," << getUb() << "]" << endl;
os << "Objective: [" << std::fixed << std::setprecision(ToulBar2::decimalPoint) << getDLb() << "," << getDUb() << "]" << endl;
os << "Variables:" << endl;
for (unsigned int i = 0; i < vars.size(); i++)
os << *vars[i] << endl;
......@@ -2756,7 +2757,7 @@ void WCSP::propagate(bool trws)
if (vac->firstTime()) {
vac->init();
if (ToulBar2::verbose >= 0)
cout << "Lb before VAC: " << getLb() << endl;
cout << "Lb before VAC: " << std::fixed << std::setprecision(ToulBar2::decimalPoint) << getDLb() << endl;
}
vac->propagate();
}
......@@ -3515,7 +3516,7 @@ bool WCSP::kconsistency(int xIndex, int yIndex, int zIndex, BinaryConstraint* xy
increaseLb(minc);
if (ToulBar2::verbose >= 1)
cout << "new ternary(" << x->wcspIndex << "," << y->wcspIndex << ","
<< z->wcspIndex << ") newLb: " << getLb() << endl;
<< z->wcspIndex << ") newLb: " << std::fixed << std::setprecision(ToulBar2::decimalPoint) << getDLb() << endl;
added = true;
}
return added;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment