/*
 * File:   configuration.h
 * Author: Andréa
 *
 * Created on 8 octobre 2010, 20:45
 */

#ifndef CONFIGURATION_H
#define	CONFIGURATION_H

// Nombre de caracteres maximum autorisés pour les structures textes
#define MAX_STRING_INPUT 3000
#define MAX_ITEM         20

// Constantes utiles
#define GRADIENT_PAS_FIXE    "resolveByGradientFixedStep"
#define GRADIENT_PAS_OPTIMAL "resolveByGradientOptimalStep"
#define QUASI_NEWTON         "resolveByNearlyNewton"
#define RECUIT_SIMULE        "resolveByRecuitSimule"
#define RECHERCHE_TABOU      "resolveByTabouResearch"
#define ALGORITHME_GENETIQUE "resolveByGeneticAlgorithm"

#define PATIENCE_LOADED          1<<0
#define EPSILON_LOADED           1<<1
#define STEP_LOADED              1<<2
#define TEMPERATURE_LOADED       1<<3
#define NEIGHBOR_STEP_LOADED     1<<4
#define LEVEL_LIMIT_LOADED       1<<5
#define POPULATION_SIZE_LOADED   1<<6
#define CROSS_PROBA_LOADED       1<<7
#define MUTATION_PROBA_LOADED    1<<8
#define BOUNDS_MIN_LOADED        1<<9
#define BOUNDS_MAX_LOADED        1<<10

// Define index parameters in 'args' tab
#define INDEX_PATIENCE          0
#define INDEX_EPSILON           1
#define INDEX_STEP              2
#define INDEX_TEMPERATURE       3
#define INDEX_NEIGHBOR_STEP     4
#define INDEX_LEVEL_LIMIT       5
#define INDEX_POPULATION_SIZE   6
#define INDEX_CROSS_PROBA       7
#define INDEX_MUTATION_PROBA    8
#define INDEX_BOUNDS_MIN        9
#define INDEX_BOUNDS_MAX       10

#define SECRETS_FILE         "build/secrets"

#define LOGGER_QUEUE_ID 1
#define LOGGER_PID      2

// redéfiniton de type commun
typedef int boolean;

#define TRUE  1
#define FALSE 0

typedef double* (*problem_function) (
			const double[]);

typedef boolean (*problem_constraint) (
			const double[]);

typedef struct  msgbuf
{
    long	mtype;
    char	mtext[MAX_STRING_INPUT];
}MessageBuffer;

typedef struct _id_array
{
	int ids[MAX_ITEM];
	int size;
} IdentityArray;

typedef struct _method_parameters {
	long  data_loaded;
	void *parameters[MAX_ITEM];
} MethodParameters;

#define STOP_KEYWORD   "LAST"

#define NO_FLAG        0

char buffer[MAX_STRING_INPUT];

#endif	/* CONFIGURATION_H */

