/*-------------------------------------------------------------------------------------*/
/*  NOMAD - Nonsmooth Optimization by Mesh Adaptive Direct search - version 3.0.0      */
/*                                                                                     */
/*  Copyright (C) 2001-2008  Mark Abramson        - the Boeing Company, Seattle        */
/*                           Charles Audet        - Ecole Polytechnique, Montreal      */
/*                           Gilles Couture       - Ecole Polytechnique, Montreal      */
/*                           John Dennis          - Rice University, Houston           */
/*                           Sebastien Le Digabel - Ecole Polytechnique, Montreal      */
/*                                                                                     */
/*  funded in part by AFOSR and Exxon Mobil                                            */
/*                                                                                     */
/*  Author: Sebastien Le Digabel                                                       */
/*                                                                                     */
/*  Contact information:                                                               */
/*    Ecole Polytechnique de Montreal - GERAD                                          */
/*    C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada                  */
/*    e-mail: Sebastien.Le.Digabel@gerad.ca                                            */
/*    phone : 1-514-340-6053 #6673                                                     */
/*    fax   : 1-514-340-5665                                                           */
/*                                                                                     */
/*  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/>.                               */
/*                                                                                     */
/*  You can find information on the NOMAD software at www.gerad.ca/nomad               */
/*-------------------------------------------------------------------------------------*/
#ifndef __PRIORITY_EVAL_POINT_
#define __PRIORITY_EVAL_POINT_

#include "Set_Element.hpp"
#include "Eval_Point.hpp"

class Priority_Eval_Point : public Set_Element<Eval_Point> {

private:

  NOMAD::Double        _h_min;                // h_min value for operator <

  NOMAD::Double        _f_sgte;               // f surrogate value
  NOMAD::Double        _h_sgte;               // h surrogate value
  NOMAD::Double        _angle_success_dir;    // angle with last successful direction
  NOMAD::Double        _angle_simplex_grad;   // angle with simplex gradient

  bool                 _delete_point;         // if ~Priority_Eval_Point deletes the point

  // affectation operator:
  Priority_Eval_Point & operator = ( const Priority_Eval_Point & );

public:
  
  // constructor:
  explicit Priority_Eval_Point ( const Eval_Point    * x     ,
				 const NOMAD::Double & h_min   ) :
    Set_Element<Eval_Point> (x    ) ,
    _h_min                  (h_min) ,
    _delete_point           (true )   {}

  // copy constructor:
  explicit Priority_Eval_Point ( const Priority_Eval_Point & pep ) :
    Set_Element<Eval_Point> (pep                     ) ,
    _h_min                  (pep._h_min              ) ,
    _f_sgte                 (pep._f_sgte             ) ,
    _h_sgte                 (pep._h_sgte             ) ,
    _angle_success_dir      (pep._angle_success_dir  ) ,
    _angle_simplex_grad     (pep._angle_simplex_grad ) ,
    _delete_point           (true                    )   {}

  // destructor:
  ~Priority_Eval_Point ( void );
  
  // specific Priority_Eval_Point elements of comparison:
  void get_priority_criteria ( NOMAD::Double & f_sgte              ,
			       NOMAD::Double & h_sgte              ,
			       NOMAD::Double & angle_last_succ_dir ,
			       NOMAD::Double & angle_simplex_grad    ) const;

  // comparison operator:
  bool operator < ( const Set_Element<Eval_Point> & ) const;

  // access to the point:
  const Eval_Point * get_point ( void ) const { return get_element(); }

  // SET methods:
  void do_not_delete_point   ( void                    ) { _delete_point      = false; }
  void set_angle_success_dir ( const NOMAD::Double & a ) { _angle_success_dir = a;     }
  void set_f_sgte            ( const NOMAD::Double & f ) { _f_sgte            = f;     }
  void set_h_sgte            ( const NOMAD::Double & h ) { _h_sgte            = h;     }
};

#endif
