1 #ifndef OPENGM_MULTI_LABEL_PROPOSAL_HXX
2 #define OPENGM_MULTI_LABEL_PROPOSAL_HXX
10 template<
class GM,
class ACC>
22 labels_(size,LabelVec(gm.numberOfVariables)),
69 template<
class GM,
class ACC>
87 size_t alphaIncrement=1,
88 bool randomAlphaToLabel=
false,
110 maxLabel_(gm.maxNumberOfLabels()){
112 for(
size_t i=0; i<maxLabel_; i)
113 alphaToLabel_[i] = i;
114 if(param.randomAlphaToLabel_){
117 std::srand (
unsigned ( std::time(0) ) );
120 std::srand (
unsigned ( param_.
seed_ ) );
123 std::random_shuffle ( myvector.begin(), myvector.end() );
128 return param_.
r_*2 + 1;
132 return static_cast<Int64Type>( (maxLabel_ / alphaIncrement_) + 1);
144 const LabelVec & current,
145 const History & bestHistory,
146 const bool improvementViaLastProposal,
147 LabelVecVec & proposals
149 const Int64Type sl = -1 * param_.
r_ + currentAlpha_;
150 const Int64Type el = 1 + param_.
r_ + currentAlpha_;
151 for(
size_t vi=0; vi<gm_.numberOfVariables(); ++vi){
152 for(
Int64Type a=mr, pi=0 ; a<el; ++a,++pi){
153 if(a>0 && alphaToLabel_[a]<gm_.maxNumberOfLabels(vi))
154 proposals[pi][vi] = alphaToLabel_[a];
156 proposals[pi][vi] = current[vi];
159 currentAlpha_+=alphaIncrement_;
167 std::vector<LabelType> alphaToLabel_;
Int64Type iterPerRound() const
std::vector< LabelVec > LabelVecVec
std::vector< LabelVec > LabelVecVec
size_t requiredHistorySize() const
std::vector< LabelType > LabelVec
std::vector< ValueType > ValueVec
detail_types::Int64Type Int64Type
int32
std::vector< LabelType > LabelVec
LabelHistory(const GM &gm, size_t size)
LabelHistory< GM, ACC > History
Parameter(size_t r=0, size_t alphaIncrement=1, bool randomAlphaToLabel=false, bool autoSeed=true, int seed=-1)
void getProposals(const LabelVec ¤t, const History &bestHistory, const bool improvementViaLastProposal, LabelVecVec &proposals)
void setTopValue(const ValueType &value)
AlphaExpansion(const GM &gm, Parameter ¶m &Parameter())
LabelVec & topArg(int histIndex)
std::vector< ValueType > ValueVec