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

📄 johnsonreducer.cpp

📁 The ROSETTA C++ library is a collection of C++ classes and routines that enable discernibility-based
💻 CPP
字号:
//-------------------------------------------------------------------// Author........: Aleksander 豩rn// Date..........:// Description...:// Revisions.....://===================================================================#include <stdafx.h> // Precompiled headers.#include <copyright.h>#include <kernel/algorithms/johnsonreducer.h>#include <kernel/algorithms/keyword.h>#include <kernel/structures/discernibilitymatrix.h>#include <kernel/utilities/mathkit.h>//-------------------------------------------------------------------// Static helpers.//===================================================================//-------------------------------------------------------------------// Method........: StaticGetMaximum// Author........: Aleksander 豩rn// Date..........:// Description...: Returns index with highest weight.// Comments......: In case of ties, returns the lowest index.// Revisions.....://===================================================================static intStaticGetMaximum(const Vector(float) &weights) {	float maximum_w = weights[0];	int   maximum_i = 0, i;	for (i = 1; i < weights.size(); i++) {		if (weights[i] > maximum_w) {			maximum_w = weights[i];	    maximum_i = i;		}	}	return maximum_i;}//-------------------------------------------------------------------// Methods for class JohnsonReducer.//===================================================================//-------------------------------------------------------------------// Constructors/destructor.//===================================================================//-------------------------------------------------------------------// Method........: Constructor// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================JohnsonReducer::JohnsonReducer() {	ApproximateSolutions(false);	SetHittingFraction(0.95f);}JohnsonReducer::~JohnsonReducer() {}//-------------------------------------------------------------------// Methods inherited from Identifier.//===================================================================IMPLEMENTIDMETHODS(JohnsonReducer, JOHNSONREDUCER, Reducer)//-------------------------------------------------------------------// Methods inherited from Algorithm.//===================================================================//-------------------------------------------------------------------// Method........: GetParameters// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================StringJohnsonReducer::GetParameters() const {	String parameters = Reducer::GetParameters() + Keyword::Separator();	// Approximate solutions.	parameters += Keyword::Approximate();	parameters += Keyword::Assignment();	parameters += String::Format(ApproximateSolutions());	if (ApproximateSolutions()) {		// Hitting fraction.		parameters += Keyword::Separator();		parameters += Keyword::Fraction();		parameters += Keyword::Assignment();		parameters += String::Format(GetHittingFraction());	}	return parameters;}//-------------------------------------------------------------------// Method........: SetParameter// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================boolJohnsonReducer::SetParameter(const String &keyword, const String &value) {	if (Reducer::SetParameter(keyword, value))		return true;	// Approximate solutions.	if (keyword == Keyword::Approximate() && value.IsBoolean())		return ApproximateSolutions(value.GetBoolean());	// Hitting fraction.	if (keyword == Keyword::Fraction() && value.IsFloat())		return SetHittingFraction(value.GetFloat());	return false;}//-------------------------------------------------------------------// Method........: Apply// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================Structure *JohnsonReducer::Apply(Structure &structure) const {	return Reducer::Apply(structure);}//-------------------------------------------------------------------// Methods inherited from Reducer.//===================================================================//-------------------------------------------------------------------// Method........: CreateFunction// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......: Possible bug: If the matrix is precomputed and//                 the simplify flag is set to false, then it has been//                 observed that the computed attribute set is//                 a superset of the attribute set computed with the//                 simplify flag set to true. Intuitively, they should//                 be minimal either way.////                 See also other CreateFunction method.//// Revisions.....: A

⌨️ 快捷键说明

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