...
 
Commits (1)
......@@ -5,6 +5,7 @@
#include "Kernelizer.h"
std::default_random_engine generator;
template <class CCG = ConstraintCompositeGraph<> >
class KernelizerLinearProgramming : public Kernelizer<CCG>
{
......@@ -20,6 +21,8 @@ public:
virtual void kernelize(typename CCG::graph_t& g,
std::map<typename CCG::variable_id_t, bool>& out)
{
std::uniform_real_distribution<double> distribution(-1e-6, 1e-6);
using namespace boost;
typedef typename CCG::graph_t graph_t;
......@@ -40,7 +43,7 @@ public:
for (auto it = vi; it != vi_end; ++ it)
vertex_to_id.insert(
std::make_pair(*it,
lps->addVariable(vertex_weight_map[*it],
lps->addVariable(vertex_weight_map[*it] + distribution(generator),
LinearProgramSolver::VarType::CONTINUOUS)));
lps->setObjectiveType(LinearProgramSolver::ObjectiveType::MIN);
......
......@@ -239,7 +239,7 @@ int main(int argc, const char** argv)
{
size_t cur_assignment_size = -1;
for (size_t i = 1; cur_assignment_size != assignments.size(); ++ i)
for (size_t i = 1; i < 10; ++ i)
{
cur_assignment_size = assignments.size();
......@@ -258,6 +258,10 @@ int main(int argc, const char** argv)
break;
}
std::cout << "Number of resolved variables: " << assignments.size() << std::endl;
return 1;
if (assignments.size() >= ccg.getNumberOfVariables())
break;
}
......