1 #ifndef TRWS_INTERFACE_HXX_
2 #define TRWS_INTERFACE_HXX_
20 bool absolutePrecision=
true,
22 :parent(maxIternum,
precision,absolutePrecision),
58 #ifdef TRWS_DEBUG_OUTPUT
59 void print(std::ostream& fout)
const
62 fout <<
"precision="<<
precision()<<std::endl;
69 fout <<
"verbose="<<
verbose()<<std::endl;
92 template<
class GM,
class ACC>
110 TRWSi(
const GraphicalModelType& gm,
const Parameter& param
111 #ifdef TRWS_DEBUG_OUTPUT
112 ,std::ostream& fout=std::cout
115 _storage(gm,param.decompositionType_,(param.initPoint_.size()==0 ? 0 : ¶m.initPoint_)),
116 _solver(_storage,param
117 #ifdef TRWS_DEBUG_OUTPUT
118 ,(param.verbose_ ? fout : *OUT::nullstream::Instance())
121 #ifdef TRWS_DEBUG_OUTPUT
122 std::ostream& out=(param.verbose_ ? fout : *OUT::nullstream::Instance());
123 out <<
"Parameters of the "<<
name() <<
" algorithm:"<<std::endl;
127 if (param.maxNumberOfIterations_==0)
throw
128 std::runtime_error(
"TRWSi: Maximal number of iterations (> 0) has to be specified!");
130 std::string
name()
const{
return "TRWSi"; }
139 _solver.
infer(visiwrap);
149 void getTreeAgreement(std::vector<bool>& out,std::vector<LabelType>* plabeling=0,std::vector<std::vector<LabelType> >* ptreeLabelings=0){_solver.
getTreeAgreement(out,plabeling,ptreeLabelings);}
trws_base::DecompositionStorage< GM > Storage
TRWSi(const GraphicalModelType &gm, const Parameter ¶m)
bool & isAbsolutePrecision()
virtual ValueType value() const
Storage::StructureType & decompositionType()
virtual InferenceTermination infer()
const ValueType & precision() const
Storage & getDecompositionStorage()
ValueType minRelativeDualImprovement_
bool & fastComputations()
const bool & canonicalNormalization() const
Storage::StructureType decompositionType_
size_t maxNumberOfIterations_
const GM & masterModel() const
InferenceTermination infer()
visitors::EmptyVisitor< TRWSi< GM, ACC > > EmptyVisitorType
const FactorProperties & getFactorProperties() const
const Solver::FactorProperties & getFactorProperties() const
TRWSi_Parameter(size_t maxIternum=0, typename Storage::StructureType decompositionType=Storage::GENERALSTRUCTURE, ValueType precision=1.0, bool absolutePrecision=true, bool verbose=false)
virtual const std::vector< LabelType > & arg() const
InferenceTermination infer(VISITOR &visitor)
void getTreeAgreement(std::vector< bool > &out, std::vector< LabelType > *plabeling=0, std::vector< std::vector< LabelType > > *ptreeLabelings=0)
const ValueType & minRelativeDualImprovement() const
std::vector< typename GM::ValueType > DDVectorType
ReparametrizerType * getReparametrizer(const typename ReparametrizerType::Parameter ¶ms=typename ReparametrizerType::Parameter())
TRWS_Reparametrizer< Storage, ACC > ReparametrizerType
ValueType & minRelativeDualImprovement()
size_t treeAgreeMaxStableIter() const
const Storage::StructureType & decompositionType() const
const GraphicalModelType & graphicalModel() const
void getTreeAgreement(std::vector< bool > &out, std::vector< LabelType > *plabeling=0, std::vector< std::vector< LabelType > > *ptreeLabelings=0)
Storage::DDVectorType DDVectorType
Inference algorithm interface.
size_t & maxNumberOfIterations()
visitors::VerboseVisitor< TRWSi< GM, ACC > > VerboseVisitorType
std::vector< typename GM::ValueType > DDVectorType
const bool & verbose() const
virtual ValueType bound() const
return a bound on the solution
trws_base::DecompositionStorage< GM > Storage
[class trwsi] TRWSi - tree-reweighted sequential message passing Based on the paper: V...
const size_t & maxNumberOfIterations() const
trws_base::MaxSumTRWS_Parameters< ValueType > parent
virtual ValueType value() const
return the solution (value)
virtual ValueType bound() const
const bool & isAbsolutePrecision() const
TRWSi_Parameter< GM > Parameter
const bool & fastComputations() const
InferenceTermination arg(std::vector< LabelType > &out, const size_t=1) const
output a solution
void getDDVector(DDVectorType *pddvector) const
bool canonicalNormalization_
void getDDVector(DDVectorType *ddvector) const
static std::string getString(StructureType structure)
visitors::TimingVisitor< TRWSi< GM, ACC > > TimingVisitorType
FunctionParameters< GM > FactorProperties
bool & canonicalNormalization()
trws_base::MaxSumTRWS< GM, ACC > Solver