<commit_before>/**
 * \file dcs/testbed/padala2009_application_manager.hpp
 *
 * \brief Class modeling the Application Manager component based on the work
 *  of (Padala et al, 2009)
 *
 * \author <NAME> (<EMAIL>)
 *
 * <hr/>
 *
 * Copyright (C) 2012       <NAME> (<EMAIL>)
 *                          [Distributed Computing System (DCS) Group,
 *                           Computer Science Institute,
 *                           Department of Science and Technological Innovation,
 *                           University of Piemonte Orientale,
 *                           Alessandria (Italy)]
 *
 * This file is part of dcsxx-testbed (below referred to as "this program").
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef DCS_TESTBED_PADALA2009_APPLICATION_MANAGER_HPP
#define DCS_TESTBED_PADALA2009_APPLICATION_MANAGER_HPP

//@{ Consistency checks for macros

#ifndef DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION
# define DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION 'C'
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION
#if    DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'C' \
    && DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'M' \
    && DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'R' \
    && DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'W'
# error Unknwon value for DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION.
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION

//@} Consistency checks for macros


#include <algorithm>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/p_square_quantile.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_expression.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_expression.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublasx/operation/all.hpp>
#ifdef DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
# include <boost/numeric/ublasx/operation/any.hpp>
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
#include <boost/numeric/ublasx/operation/isfinite.hpp>
#include <boost/smart_ptr.hpp>
#include <cstddef>
#include <ctime>
#include <dcs/assert.hpp>
//#include <dcs/control/analysis/controllability.hpp>
//#include <dcs/control/analysis/detectability.hpp>
//#include <dcs/control/analysis/observability.hpp>
//#include <dcs/control/analysis/stabilizability.hpp>
#include <dcs/debug.hpp>
#include <dcs/exception.hpp>
#include <dcs/logging.hpp>
#include <dcs/macro.hpp>
#include <dcs/math/traits/float.hpp>
#include <dcs/testbed/application_performance_category.hpp>
#include <dcs/testbed/base_application_manager.hpp>
#include <dcs/testbed/system_identification_strategies.hpp>
#include <fstream>
#ifdef DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
# include <functional>
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
#include <limits>
#include <map>
#include <stdexcept>


//TODO:
// - Currently the code in this class assumes the single resource (CPU) case.
//


namespace dcs { namespace testbed {

template <typename TraitsT>
class padala2009_application_manager: public base_application_manager<TraitsT>
{
	private: typedef base_application_manager<TraitsT> base_type;
	public: typedef typename base_type::traits_type traits_type;
	public: typedef typename traits_type::real_type real_type;
	private: typedef typename base_type::app_type app_type;
	private: typedef typename base_type::app_pointer app_pointer;
	private: typedef typename app_type::sensor_type sensor_type;
	private: typedef typename app_type::sensor_pointer sensor_pointer;
	protected: typedef ::boost::numeric::ublas::vector<real_type> numeric_vector_type;
	protected: typedef ::boost::numeric::ublas::matrix<real_type> numeric_matrix_type;
	private: typedef base_arx_system_identification_strategy<traits_type> sysid_strategy_type;
	private: typedef ::boost::shared_ptr<sysid_strategy_type> sysid_strategy_pointer;
	private: typedef ::std::vector<real_type> observation_container;
	private: typedef ::std::map<application_performance_category,observation_container> observation_map;
	//private: typedef ::std::map<application_performance_category,numeric_vector_type> observation_map;
	private: typedef ::std::map<application_performance_category,sensor_pointer> sensor_map;

<commit_msg>(bug-fix:minor) Forgot to include <vector> header<commit_after>/**
 * \file dcs/testbed/padala2009_application_manager.hpp
 *
 * \brief Class modeling the Application Manager component based on the work
 *  of (Padala et al, 2009)
 *
 * \author <NAME> (<EMAIL>)
 *
 * <hr/>
 *
 * Copyright (C) 2012       <NAME> (<EMAIL>)
 *                          [Distributed Computing System (DCS) Group,
 *                           Computer Science Institute,
 *                           Department of Science and Technological Innovation,
 *                           University of Piemonte Orientale,
 *                           Alessandria (Italy)]
 *
 * This file is part of dcsxx-testbed (below referred to as "this program").
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef DCS_TESTBED_PADALA2009_APPLICATION_MANAGER_HPP
#define DCS_TESTBED_PADALA2009_APPLICATION_MANAGER_HPP

//@{ Consistency checks for macros

#ifndef DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION
# define DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION 'C'
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION
#if    DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'C' \
    && DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'M' \
    && DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'R' \
    && DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION != 'W'
# error Unknwon value for DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION.
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_NEGATIVE_SHARE_ACTION

//@} Consistency checks for macros


#include <algorithm>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/p_square_quantile.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_expression.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_expression.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublasx/operation/all.hpp>
#ifdef DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
# include <boost/numeric/ublasx/operation/any.hpp>
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
#include <boost/numeric/ublasx/operation/isfinite.hpp>
#include <boost/smart_ptr.hpp>
#include <cstddef>
#include <ctime>
#include <dcs/assert.hpp>
//#include <dcs/control/analysis/controllability.hpp>
//#include <dcs/control/analysis/detectability.hpp>
//#include <dcs/control/analysis/observability.hpp>
//#include <dcs/control/analysis/stabilizability.hpp>
#include <dcs/debug.hpp>
#include <dcs/exception.hpp>
#include <dcs/logging.hpp>
#include <dcs/macro.hpp>
#include <dcs/math/traits/float.hpp>
#include <dcs/testbed/application_performance_category.hpp>
#include <dcs/testbed/base_application_manager.hpp>
#include <dcs/testbed/system_identification_strategies.hpp>
#include <fstream>
#ifdef DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
# include <functional>
#endif // DCS_TESTBED_EXP_PADALA2009_APP_MGR_USE_ARX_B0_SIGN_HEURISTIC
#include <limits>
#include <map>
#include <stdexcept>
#include <vector>


//TODO:
// - Currently the code in this class assumes the single resource (CPU) case.
//


namespace dcs { namespace testbed {

template <typename TraitsT>
class padala2009_application_manager: public base_application_manager<TraitsT>
{
	private: typedef base_application_manager<TraitsT> base_type;
	public: typedef typename base_type::traits_type traits_type;
	public: typedef typename traits_type::real_type real_type;
	private: typedef typename base_type::app_type app_type;
	private: typedef typename base_type::app_pointer app_pointer;
	private: typedef typename app_type::sensor_type sensor_type;
	private: typedef typename app_type::sensor_pointer sensor_pointer;
	protected: typedef ::boost::numeric::ublas::vector<real_type> numeric_vector_type;
	protected: typedef ::boost::numeric::ublas::matrix<real_type> numeric_matrix_type;
	private: typedef base_arx_system_identification_strategy<traits_type> sysid_strategy_type;
	private: typedef ::boost::shared_ptr<sysid_strategy_type> sysid_strategy_pointer;
	private: typedef ::std::vector<real_type> observation_container;
	private: typedef ::std::map<application_performance_category,observation_container> observation_map;
	//private: typedef ::std::map<application_performance_category,numeric_vector_type> observation_map;
	private: typedef ::std::map<application_performance_category,sensor_pointer> sensor_map;


{'fraction_non_alphanumeric': 0.09376192293017932, 'fraction_numerical': 0.015452117512399848, 'mean_word_length': 5.674092934436665, 'pattern_counts': {'":': 0, '<': 109, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7552125', 'n_tokens_mistral': 3719, 'n_tokens_neox': 3466, 'n_words': 731}