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

#ifndef PROBLEMA_H
#define	PROBLEMA_H

#include <stdlib.h>

#include "constants.h"

typedef struct _problema
{
    //data
    unsigned long  _db_id;                               /* Database id */
    char           _name[MAX_INPUT];                     /* Libellé */
    size_t         _dimension;                           /* Dimension de la fonction objectif */
    char           _functionRepresentation[MAX_INPUT];   /* Représentation de la fonction */
    double*     (* _function)               (const double[],   /* Fonction à optimiser */
                                             const size_t dimension);

    boolean     (* _constraints[MAX_ITEM])  (const double[],   /* Contraintes de domaine */
                                             const size_t dimension);
    double*     (* _derivees   [MAX_ITEM])  (const double[]);  /* dérivées de la fonction */
    
    double*        _solution;                            /* solution du problème */

    //method
                                                        /* toString */
    char*       (* display)                 (struct _problema*);
} Problema;

// Constructor~Destructor
Problema* createProblema();
Problema* createProblemaWithParameters(
    char*         problemName,
    unsigned long problemId,
    char*         functionRepresentation,
    double*     (*function)(const double[],const size_t dimension),
    size_t        function_input_dimension

);
void      destroyProblema(Problema **);

boolean   checkInputValidity(Problema* problema, double vector[], size_t dimension);

Problema* addConstraints(Problema *, boolean (*) (double[]));
Problema* addDerivee    (Problema *, double  (*) (double[]), unsigned int);

#endif	/* PROBLEMA_H */

