📄 altoptloop.cpp
字号:
/* Context : Fuzzy Clustering Algorithms Author : Frank Hoeppner, see also AUTHORS file Description : implementation of class module AltOptLoop History : Comment : This file was generated automatically. DO NOT EDIT. Copyright : Copyright (C) 1999-2000 Frank Hoeppner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*//* The University of Applied Sciences Oldenburg/Ostfriesland/Wilhelmshaven hereby disclaims all copyright interests in the program package `fc' (tool package for fuzzy cluster analysis) written by Frank Hoeppner. Prof. Haass, President of Vice, 2000-Mar-10*/#ifndef AltOptLoop_SOURCE#define AltOptLoop_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "AltOptLoop.hpp"#include "primitives.hpp" // equal// data// implementationtemplate < class ANALYSIS >AltOptLoop< ANALYSIS >::AltOptLoop ( int a_req_data_depth, Algorithm<ANALYSIS>* ap_prot_alg, Algorithm<ANALYSIS>* ap_memb_alg, Algorithm<ANALYSIS>* ap_intr_alg, char_cc ap_name, Algorithm<ANALYSIS>* ap_alg ) : mp_succ_alg(ap_alg) , mp_prot_alg(ap_prot_alg) , mp_memb_alg(ap_memb_alg) , mp_intr_alg(ap_intr_alg) , m_required_data_depth(a_req_data_depth) , mp_name(ap_name) { }template < class ANALYSIS >AltOptLoop< ANALYSIS >::~AltOptLoop ( ) { FUNCLOG("~AltOptLoop"); delete mp_succ_alg; }template < class ANALYSIS >voidAltOptLoop< ANALYSIS >::operator() ( ANALYSIS& a_analysis ) { FUNCLOG("AltOptLoop"); if ( (m_required_data_depth!=FC_DEPTH_ANY) && (m_required_data_depth!=a_analysis.option().data_depth())) { trace("quick exit, (act,req) depth=",make_pair(a_analysis.option().data_depth(),m_required_data_depth)); (*mp_succ_alg)(a_analysis); return; } invariant(a_analysis.option().number_prototypes()>0,"assume prototypes",SOURCELOC); invariant(a_analysis.option().number_features()>0,"assume features",SOURCELOC); invariant(a_analysis.links().size()>0,"non-empty link set (forgotten adjust?)",SOURCELOC); int interim_output(a_analysis.option().interim_output()); int iteration_step(0); invariant(a_analysis.option().init()!=FC_INIT_AUTO,"no auto init",SOURCELOC); if (a_analysis.option().init()==FC_INIT_PROT) { (*mp_memb_alg)(a_analysis); } else { for ( typename ANALYSIS::prot_iter i_prot(a_analysis.prototypes().begin()); i_prot != a_analysis.prototypes().end(); ++i_prot ) { (*i_prot).total_pow_membxweight() = 0; } typename ANALYSIS::link_iter i_link(a_analysis.links().begin()); for ( typename ANALYSIS::data_iter i_data(a_analysis.data().begin()); i_data != a_analysis.data().end(); ++i_data ) { const real_type w( (*i_data).weight() ); for ( typename ANALYSIS::prot_iter i_prot(a_analysis.prototypes().begin()); i_prot != a_analysis.prototypes().end(); ++i_prot ) { const real_type u( (*i_link).membership() ); (*i_link).pow_membxweight() = u*w; (*i_prot).total_pow_membxweight() += u*w; ++i_link; } } } if (a_analysis.option().max_iterations()==0) { (*mp_succ_alg)(a_analysis); return; } do { ++iteration_step; trace("entering AltOptLoop",iteration_step); a_analysis.option().change()=0; (*mp_prot_alg)(a_analysis); (*mp_memb_alg)(a_analysis); if ( (interim_output > 0) && ((iteration_step % interim_output) == 0) ) { (*mp_intr_alg)(a_analysis); } trace("delta",a_analysis.option().change()); } while ((iteration_step<a_analysis.option().max_iterations()) && (a_analysis.option().threshold()<fabs(a_analysis.option().change()))); call_successor(mp_succ_alg,a_analysis,mp_name); }// template instantiation#endif // AltOptLoop_SOURCE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -