GCoptimization::EnergyType GCoptimization::oneExpansionIteration() { LabelID next; if (m_random_label_order) scramble_label_table(); for (next = 0; next < m_num_labels; next++ ) { alpha_expansion(m_labelTable[next]); } return(compute_energy()); }
GCoptimization::EnergyType GCoptimization::oneSwapIteration() { LabelID next,next1; if (m_random_label_order) scramble_label_table(); for (next = 0; next < m_num_labels; next++ ) for (next1 = m_num_labels - 1; next1 >= 0; next1-- ) if ( m_labelTable[next] < m_labelTable[next1] ) alpha_beta_swap(m_labelTable[next],m_labelTable[next1]); return(compute_energy()); }
GCoptimization::EnergyType Swap::oneSwapIteration() { int next,next1; if (m_random_label_order) scramble_label_table(); for (next = 0; next < m_nLabels; next++ ) for (next1 = m_nLabels - 1; next1 >= 0; next1-- ) if ( m_labelTable[next] < m_labelTable[next1] ) { perform_alpha_beta_swap(m_labelTable[next],m_labelTable[next1]); } return(dataEnergy()+smoothnessEnergy()); }
GCoptimization::EnergyType Expansion::oneExpansionIteration() { int next; terminateOnError( m_dataType == NONE,"You have to set up the data cost before running optimization"); terminateOnError( m_smoothType == NONE,"You have to set up the smoothness cost before running optimization"); if (m_random_label_order) scramble_label_table(); for (next = 0; next < m_nLabels; next++ ) perform_alpha_expansion(m_labelTable[next]); return(dataEnergy()+smoothnessEnergy()); }