⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mixedaltoptloop.cpp

📁 模糊聚類分析源碼。包含教學文件
💻 CPP
字号:
/*    Context       : Fuzzy Clustering Algorithms  Author        : Frank Hoeppner, see also AUTHORS file   Description   : implementation of class module MixedAltOptLoop                    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 MixedAltOptLoop_SOURCE#define MixedAltOptLoop_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "MixedAltOptLoop.hpp"#include "primitives.hpp" // equal// data// implementationtemplate < class ANALYSIS >MixedAltOptLoop< ANALYSIS >::MixedAltOptLoop  (  int a_req_data_depth,  Algorithm<select_analysis_type>* ap_prot1_alg,  Algorithm<select_analysis_type>* ap_prot2_alg,  Algorithm<select_analysis_type>* ap_dist1_alg,  Algorithm<select_analysis_type>* ap_dist2_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_prot1_alg(ap_prot1_alg)  , mp_prot2_alg(ap_prot2_alg)  , mp_dist1_alg(ap_dist1_alg)  , mp_dist2_alg(ap_dist2_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)  , m_self_alg1(store(FC_STORE_DATA,adjust(FC_ADJUST_CENTER,select_nop())))  , m_self_alg2(store(FC_STORE_DATA,adjust(FC_ADJUST_COEFF,select_nop())))    {    }template < class ANALYSIS >MixedAltOptLoop< ANALYSIS >::~MixedAltOptLoop  (  )  {  FUNCLOG("~MixedAltOptLoop");    delete mp_succ_alg;  }template < class ANALYSIS >voidMixedAltOptLoop< ANALYSIS >::operator()  (  ANALYSIS& a_analysis  )  {  FUNCLOG("MixedAltOptLoop");    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_matrix_type data_transform(a_analysis.option().data_transform());  // analysis1 -- identity transformation  a_analysis.option().data_transform().adjust(0,0);  (m_self_alg1)(a_analysis);  // analysis2 -- transformation given by options  matrix_copy(a_analysis.option().data_transform(),data_transform);  (m_self_alg2)(a_analysis);  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_dist1_alg)(m_self_alg1.analysis());    (*mp_dist2_alg)(m_self_alg2.analysis());    (*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 MixedAltOptLoop",iteration_step);      a_analysis.option().change()=0;      (*mp_prot1_alg)(m_self_alg1.analysis());      (*mp_prot2_alg)(m_self_alg2.analysis());      (*mp_dist1_alg)(m_self_alg1.analysis());      (*mp_dist2_alg)(m_self_alg2.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 // MixedAltOptLoop_SOURCE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -