Esempio n. 1
0
void UserInterface::setupEarlySettings()
{
    LogFile::init();
    initPrefs();
    setupLogging();
    FontSettingsDialog::setupFont();
}
Esempio n. 2
0
SCPevaluation::SCPevaluation(	UserInteraction* _userInteraction,
								const Objective* const objective_,
								const DynamicDiscretization* const dynamic_discretization_,
								const Constraint* const constraint_,
								BooleanType _isCP
								) : AlgorithmicBase( _userInteraction )
{
	// setup options and loggings for stand-alone instances
	if ( _userInteraction == 0 )
	{
		setupOptions( );
		setupLogging( );
	}

	if( objective_              != 0 ) objective = new Objective( *objective_ );
    else                               objective = 0;

    if( dynamic_discretization_ != 0 ) dynamicDiscretization = dynamic_discretization_->clone();
    else                               dynamicDiscretization = 0;

    if( constraint_             != 0 ) constraint = new Constraint( *constraint_ );
    else                               constraint = 0;

    objectiveValue = 0.0;
	
	isCP = _isCP;
	areSensitivitiesFrozen = BT_FALSE;
}
Esempio n. 3
0
DenseQPsolver::DenseQPsolver( UserInteraction* _userInteraction ) : DenseCPsolver( _userInteraction )
{
	setupLogging( );
	
    qpStatus = QPS_NOT_INITIALIZED;
    numberOfSteps = 0;
}
Esempio n. 4
0
Controller::Controller(	ControlLaw& _controlLaw,
						Estimator& _estimator,
						ReferenceTrajectory& _referenceTrajectory
						) : SimulationBlock( BN_CONTROLLER )
{
	setupOptions( );
	setupLogging( );

	if ( _controlLaw.isDefined( ) == BT_TRUE )
	{
		controlLaw = &_controlLaw;
		setStatus( BS_NOT_INITIALIZED );
	}
	else
		controlLaw = 0;

	if ( _estimator.isDefined( ) == BT_TRUE )
		estimator = &_estimator;
	else
		estimator = 0;

	if ( _referenceTrajectory.isDefined( ) == BT_TRUE )
		referenceTrajectory = &_referenceTrajectory;
	else
		referenceTrajectory = 0;
	
	setStatus( BS_NOT_INITIALIZED );
}
Esempio n. 5
0
SimulationEnvironment::SimulationEnvironment(	double _startTime,
												double _endTime,
												Process& _process,
												Controller& _controller
												) : SimulationBlock( BN_SIMULATION_ENVIRONMENT )
{
	setupOptions( );
	setupLogging( );
	
	startTime = _startTime;
	endTime   = _endTime;

	if ( _process.isDefined( ) == BT_TRUE )
	{
		process = &_process;
		setStatus( BS_NOT_INITIALIZED );
	}
	else
		process = 0;

	if ( _controller.isDefined( ) == BT_TRUE )
		controller = &_controller;
	else
		controller = 0;

	nSteps = 0;
}
Esempio n. 6
0
BandedCPsolver::BandedCPsolver( UserInteraction* _userInteraction ) : AlgorithmicBase( _userInteraction )
{
	// setup options and loggings for stand-alone instances
	if ( _userInteraction == 0 )
	{
		setupOptions( );
		setupLogging( );
	}
}
NLPderivativeApproximation::NLPderivativeApproximation( UserInteraction* _userInteraction ) : AlgorithmicBase( _userInteraction )
{
	// setup options and loggings for stand-alone instances
	if ( _userInteraction == 0 )
	{
		setupOptions( );
		setupLogging( );
	}

	hessianScaling = 1.0;
}
DynamicDiscretization::DynamicDiscretization( UserInteraction* _userInteraction )
                      :AlgorithmicBase( _userInteraction ){

    // setup options and loggings for stand-alone instances
    if ( _userInteraction == 0 ){

         setupOptions( );
         setupLogging( );
    }
    initializeVariables();
}
int mainEntryClickHouseExtractFromConfig(int argc, char ** argv)
{
    bool print_stacktrace = false;
    bool process_zk_includes = false;
    bool try_get = false;
    std::string log_level;
    std::string config_path;
    std::string key;

    namespace po = boost::program_options;

    po::options_description options_desc("Allowed options");
    options_desc.add_options()
        ("help", "produce this help message")
        ("stacktrace", po::bool_switch(&print_stacktrace), "print stack traces of exceptions")
        ("process-zk-includes", po::bool_switch(&process_zk_includes),
         "if there are from_zk elements in config, connect to ZooKeeper and process them")
        ("try", po::bool_switch(&try_get), "Do not warn about missing keys")
        ("log-level", po::value<std::string>(&log_level)->default_value("error"), "log level")
        ("config-file,c", po::value<std::string>(&config_path)->required(), "path to config file")
        ("key,k", po::value<std::string>(&key)->required(), "key to get value for");

    po::positional_options_description positional_desc;
    positional_desc.add("config-file", 1);
    positional_desc.add("key", 1);

    try
    {
        po::variables_map options;
        po::store(po::command_line_parser(argc, argv).options(options_desc).positional(positional_desc).run(), options);

        if (options.count("help"))
        {
            std::cerr << "Preprocess config file and extract value of the given key." << std::endl
                << std::endl;
            std::cerr << "Usage: clickhouse extract-from-config [options]" << std::endl
                << std::endl;
            std::cerr << options_desc << std::endl;
            return 0;
        }

        po::notify(options);

        setupLogging(log_level);
        std::cout << extractFromConfig(config_path, key, process_zk_includes, try_get) << std::endl;
    }
    catch (...)
    {
        std::cerr << DB::getCurrentExceptionMessage(print_stacktrace, true) << std::endl;
        return DB::getCurrentExceptionCode();
    }

    return 0;
}
Esempio n. 10
0
void Application::slotParseMessage(const QString &msg, QObject*)
{
    if (msg.startsWith(QLatin1String("MSG_PARSEOPTIONS:"))) {
        const int lengthOfMsgPrefix = 17;
        QStringList options = msg.mid(lengthOfMsgPrefix).split(QLatin1Char('|'));
        parseOptions(options);
        setupLogging();
    } else if (msg.startsWith(QLatin1String("MSG_SHOWSETTINGS"))) {
        showSettingsDialog();
    }
}
Esempio n. 11
0
BEGIN_NAMESPACE_ACADO


//
// PUBLIC MEMBER FUNCTIONS:
//

BandedCPsolver::BandedCPsolver( ) : AlgorithmicBase( )
{
	setupOptions( );
	setupLogging( );
}
BEGIN_NAMESPACE_ACADO


//
// PUBLIC MEMBER FUNCTIONS:
//

NLPderivativeApproximation::NLPderivativeApproximation( ) : AlgorithmicBase( )
{
	setupOptions( );
	setupLogging( );

	hessianScaling = 1.0;
}
Esempio n. 13
0
BEGIN_NAMESPACE_ACADO


//
// PUBLIC MEMBER FUNCTIONS:
//

DenseQPsolver::DenseQPsolver( ) : DenseCPsolver( )
{
	setupLogging( );
	
    qpStatus = QPS_NOT_INITIALIZED;
    numberOfSteps = 0;
}
Esempio n. 14
0
void AgoApp::setup() {
    setupLogging();
    setupAgoConnection();
    setupSignals();
    setupApp();
    setupIoThread();

    //Send event app is started
    //This is useful to monitor app (most of the time systemd restarts app before agosystem find it has crashed)
    //And it fix enhancement #143
    qpid::types::Variant::Map content;
    content["process"] = appShortName;
    //no internalid specified, processname is in event content
    agoConnection->emitEvent("", "event.monitoring.processstarted", content);
}
BEGIN_NAMESPACE_ACADO




//
// PUBLIC MEMBER FUNCTIONS:
//

DynamicDiscretization::DynamicDiscretization()
                      :AlgorithmicBase( ){

    setupOptions( );
    setupLogging( );

    initializeVariables();
}
Esempio n. 16
0
BEGIN_NAMESPACE_ACADO


//
// PUBLIC MEMBER FUNCTIONS:
//

Controller::Controller( ) : SimulationBlock( BN_CONTROLLER )
{
	setupOptions( );
	setupLogging( );

	controlLaw = 0;
	estimator   = 0;
	referenceTrajectory = 0;
	
	setStatus( BS_NOT_INITIALIZED );
}
Esempio n. 17
0
BEGIN_NAMESPACE_ACADO



SimulationEnvironment::SimulationEnvironment( ) : SimulationBlock( BN_SIMULATION_ENVIRONMENT )
{
	setupOptions( );
	setupLogging( );

	startTime = 0.0;
	endTime   = 0.0;

	process    = 0;
	controller = 0;

	nSteps = 0;
	
	setStatus( BS_NOT_INITIALIZED );
}
Esempio n. 18
0
BEGIN_NAMESPACE_ACADO



//
// PUBLIC MEMBER FUNCTIONS:
//

NLPsolver::NLPsolver( UserInteraction* _userInteraction ) : AlgorithmicBase( _userInteraction )
{
	// setup options and loggings for stand-alone instances
	if ( _userInteraction == 0 )
	{
		setupOptions( );
		setupLogging( );
	}
	
    numberOfSteps = 0;
}
Esempio n. 19
0
BEGIN_NAMESPACE_ACADO


//
// PUBLIC MEMBER FUNCTIONS:
//

SCPevaluation::SCPevaluation( ) : AlgorithmicBase( )
{
	setupOptions( );
	setupLogging( );

	objective             = 0;
	dynamicDiscretization = 0;
	constraint            = 0;

	objectiveValue = 0.0;
	
	isCP = BT_FALSE;
	areSensitivitiesFrozen = BT_FALSE;
}
Esempio n. 20
0
SCPmethod::SCPmethod(	UserInteraction* _userInteraction,
						const Objective             *objective_          ,
						const DynamicDiscretization *dynamic_discretization_,
						const Constraint            *constraint_,
						BooleanType _isCP
						) : NLPsolver( _userInteraction )
{
	eval = new SCPevaluation( _userInteraction,objective_,dynamic_discretization_,constraint_,_isCP );
	scpStep = 0;
	derivativeApproximation = 0;

	bandedCPsolver = 0;

	status = BS_NOT_INITIALIZED;
	isCP = _isCP;
	
	hasPerformedStep = BT_FALSE;
	isInRealTimeMode = BT_FALSE;
	needToReevaluate = BT_FALSE;

	setupLogging( );
}
Esempio n. 21
0
int main( int argc, char** argv )
{
    GTSApplication app( argc, argv );

    QCoreApplication::setOrganizationName("GTS");
    QCoreApplication::setApplicationName("Ground Truth System");

    setupLogging();

    qRegisterMetaType<CameraDescription>("CameraDescription");

    MainWindow mainWindow;

    InitialiseMessageHandler( mainWindow );

    mainWindow.Start();

    LOG_TRACE("Application starting...");

    LOG_INFO(QObject::tr("Version: %1 Date: %2.").arg(GTS_BUILD_REVN)
                                                 .arg(GTS_BUILD_DATE));
    return app.exec();
}
Esempio n. 22
0
BEGIN_NAMESPACE_ACADO


//
// PUBLIC MEMBER FUNCTIONS:
//

SCPmethod::SCPmethod( ) : NLPsolver( )
{
	setupLogging( );

	eval = 0;
	scpStep = 0;
	derivativeApproximation = 0;

	bandedCPsolver = 0;
	
	status = BS_NOT_INITIALIZED;
	isCP = BT_FALSE;
	
	hasPerformedStep = BT_FALSE;
	isInRealTimeMode = BT_FALSE;
	needToReevaluate = BT_FALSE;
}
Esempio n. 23
0
void Application::slotParseOptions(const QString &opts)
{
    QStringList options = opts.split(QLatin1Char('|'));
    parseOptions(options);
    setupLogging();
}
Esempio n. 24
0
BEGIN_NAMESPACE_ACADO



//
// PUBLIC MEMBER FUNCTIONS:
//

Integrator::Integrator( )
           :AlgorithmicBase( ){

    // RHS:
    // --------
       rhs = 0;
       m   = 0;
       ma  = 0;
       mdx = 0;
       md  = 0;
       mn  = 0;
       mu  = 0;
       mui = 0;
       mp  = 0;
       mpi = 0;
       mw  = 0;

    transition = 0;


    // SETTINGS:
    // ---------
    h     = (double*)calloc(1,sizeof(double));
    h[0]  = 0.001    ;
    hmin  = 0.000001 ;
    hmax  = 1.0e10   ;

    tune  = 0.5      ;
    TOL   = 0.000001 ;


    // INTERNAL INDEX LISTS:
    // ---------------------
    diff_index          = 0;
    ddiff_index         = 0;
    alg_index           = 0;
    control_index       = 0;
    parameter_index     = 0;
    int_control_index   = 0;
    int_parameter_index = 0;
    disturbance_index   = 0;
    time_index          = 0;


    // OTHERS:
    // -------
    count            = 0   ;
    count2           = 0   ;
    count3           = 0   ;
    maxNumberOfSteps = 1000;


    // PRINT-LEVEL:
    // ------------
    PrintLevel = LOW;


    // SEED DIMENSIONS:
    // ----------------
    nFDirs         = 0;
    nBDirs         = 0;
    nFDirs2        = 0;
    nBDirs2        = 0;


    // THE STATE OF AGGREGATION:
    // -------------------------
    soa        = SOA_UNFROZEN;

    setupOptions( );
    setupLogging( );
}
void MpiLauncher::launch(const vector<string>& slaveArgs,
                         const boost::shared_ptr<const InstanceMembership>& membership,
                         const size_t maxSlaves)
{
    vector<string> args;
    {
        ScopedMutexLock lock(_mutex);
        if (_pid != 0 || _waiting) {
            throw InvalidStateException(REL_FILE, __FUNCTION__, __LINE__)
                << " MPI launcher is already running";
        }
        boost::shared_ptr<Query> query = _query.lock();
        Query::validateQueryPtr(query);

        buildArgs(args, slaveArgs, membership, query, maxSlaves);
    }
    pid_t pid = fork();

    if (pid < 0) {
        // error
        int err = errno;
        throw (SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_SYSCALL_ERROR)
               << "fork" << pid << err <<"");

    } else if (pid > 0) {
        // parent
        ScopedMutexLock lock(_mutex);
        if (_pid != 0 || _waiting) {
            throw InvalidStateException(REL_FILE, __FUNCTION__, __LINE__)
                << " MPI launcher is corrupted after launch";
        }
        _pid = pid;
        LOG4CXX_DEBUG(logger, "MPI launcher process spawned, pid="<<_pid);
        return;

    }  else {
        // child
        becomeProcGroupLeader();
        recordPids();
        setupLogging();

        if (DBG) {
            std::cerr << "LAUNCHER pid="<<getpid()
             << ", pgid="<< ::getpgid(0)
             << ", ppid="<< ::getppid()<<std::endl;
        }

        closeFds();
        boost::scoped_array<const char*> argv(new const char*[args.size()+1]);
        initExecArgs(args, argv);
        const char *path = argv[0];

        if (DBG) {
            std::cerr << "LAUNCHER pid="<<::getpid()<<" args for "<<path<<" are ready" << std::endl;
            for (size_t i=0; i<args.size(); ++i) {
                const char * arg = argv[i];
                if (!arg) break;
                cerr << "LAUNCHER arg["<<i<<"] = "<< argv[i] << std::endl;
            }
        }

        int rc = ::execv(path, const_cast<char* const*>(argv.get()));

        assert(rc == -1);
        rc=rc; // avoid compiler warning

        perror("LAUNCHER execv");
        _exit(1);
    }
    throw SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_UNREACHABLE_CODE);
}