From 37070233d8768919bc70fa9bd8a33e04fbe661d3 Mon Sep 17 00:00:00 2001 From: graehl Date: Tue, 6 Jul 2010 22:06:26 +0000 Subject: prune epsilon, comments, use inside pruning for probably no segfaults in vest git-svn-id: https://ws10smt.googlecode.com/svn/trunk@167 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/hg.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'decoder/hg.cc') diff --git a/decoder/hg.cc b/decoder/hg.cc index 19dbf892..b6b9d8bd 100644 --- a/decoder/hg.cc +++ b/decoder/hg.cc @@ -130,8 +130,8 @@ void Hypergraph::PushWeightsToGoal(double scale) { struct EdgeExistsWeightFunction { EdgeExistsWeightFunction(const std::vector& prunes) : prunes_(prunes) {} - double operator()(const Hypergraph::Edge& edge) const { - return (prunes_[edge.id_] ? 0.0 : 1.0); + bool operator()(const Hypergraph::Edge& edge) const { + return !prunes_[edge.id_]; } private: const vector& prunes_; @@ -147,8 +147,8 @@ void Hypergraph::PruneEdges(const std::vector& prune_edge, bool run_inside // I don't know a good c++ way to resolve this short of template specialization which // I dislike. If you know of a better way that doesn't involve specialization, // fix this! - vector reachable; - bool goal_derivable = (0 < Inside(*this, &reachable, wf)); + vector reachable; + bool goal_derivable = Inside/* */(*this, &reachable, wf); if (!goal_derivable) { edges_.clear(); nodes_.clear(); @@ -195,7 +195,7 @@ void Hypergraph_finish_prune(Hypergraph &hg,vector const& io,double cuto } if (verbose) cerr << "Finished pruning; removed " << pc << "/" << io.size() << " edges\n"; - hg.PruneEdges(prune); + hg.PruneEdges(prune,true); // inside reachability check in case cutoff rounded down too much (probably redundant with EPSILON hack) } void Hypergraph::DensityPruneInsideOutside(const double scale, -- cgit v1.2.3