Actual source code: petsctaolinesearch.h

      1: #if !defined(PETSCTAOLINESEARCH_H)
      2: #define PETSCTAOLINESEARCH_H

      4: typedef struct _p_TaoLineSearch* TaoLineSearch;

      6: #include <petsctao.h>

      8: typedef enum {
      9:     TAOLINESEARCH_FAILED_INFORNAN = -1,
     10:     TAOLINESEARCH_FAILED_BADPARAMETER = -2,
     11:     TAOLINESEARCH_FAILED_ASCENT = -3,
     12:     TAOLINESEARCH_CONTINUE_ITERATING = 0,
     13:     TAOLINESEARCH_SUCCESS = 1,
     14:     TAOLINESEARCH_SUCCESS_USER = 2,
     15:     TAOLINESEARCH_HALTED_OTHER = 3,
     16:     TAOLINESEARCH_HALTED_MAXFCN = 4,
     17:     TAOLINESEARCH_HALTED_UPPERBOUND = 5,
     18:     TAOLINESEARCH_HALTED_LOWERBOUND = 6,
     19:     TAOLINESEARCH_HALTED_RTOL = 7,
     20:     TAOLINESEARCH_HALTED_USER = 8
     21: } TaoLineSearchConvergedReason;

     23: typedef const char *TaoLineSearchType;
     24: #define TAOLINESEARCHUNIT     "unit"
     25: #define TAOLINESEARCHMT       "more-thuente"
     26: #define TAOLINESEARCHGPCG     "gpcg"
     27: #define TAOLINESEARCHARMIJO   "armijo"
     28: #define TAOLINESEARCHOWARMIJO "owarmijo"
     29: #define TAOLINESEARCHIPM      "ipm"

     31: PETSC_EXTERN PetscClassId TAOLINESEARCH_CLASSID;
     32: PETSC_EXTERN PetscFunctionList TaoLineSearchList;

     34: PETSC_EXTERN PetscErrorCode TaoLineSearchCreate(MPI_Comm,TaoLineSearch*);
     35: PETSC_EXTERN PetscErrorCode TaoLineSearchSetFromOptions(TaoLineSearch);
     36: PETSC_EXTERN PetscErrorCode TaoLineSearchSetUp(TaoLineSearch);
     37: PETSC_EXTERN PetscErrorCode TaoLineSearchDestroy(TaoLineSearch*);
     38: PETSC_EXTERN PetscErrorCode TaoLineSearchMonitor(TaoLineSearch,PetscInt,PetscReal,PetscReal);
     39: PETSC_EXTERN PetscErrorCode TaoLineSearchView(TaoLineSearch,PetscViewer);
     40: PETSC_EXTERN PetscErrorCode TaoLineSearchViewFromOptions(TaoLineSearch,PetscObject,const char[]);

     42: PETSC_EXTERN PetscErrorCode TaoLineSearchSetOptionsPrefix(TaoLineSearch,const char prefix[]);
     43: PETSC_EXTERN PetscErrorCode TaoLineSearchReset(TaoLineSearch);
     44: PETSC_EXTERN PetscErrorCode TaoLineSearchAppendOptionsPrefix(TaoLineSearch,const char[]);
     45: PETSC_EXTERN PetscErrorCode TaoLineSearchGetOptionsPrefix(TaoLineSearch,const char*[]);
     46: PETSC_EXTERN PetscErrorCode TaoLineSearchApply(TaoLineSearch,Vec,PetscReal*,Vec,Vec,PetscReal*,TaoLineSearchConvergedReason*);
     47: PETSC_EXTERN PetscErrorCode TaoLineSearchGetStepLength(TaoLineSearch,PetscReal*);
     48: PETSC_EXTERN PetscErrorCode TaoLineSearchGetStartingVector(TaoLineSearch,Vec*);
     49: PETSC_EXTERN PetscErrorCode TaoLineSearchGetStepDirection(TaoLineSearch,Vec*);
     50: PETSC_EXTERN PetscErrorCode TaoLineSearchSetInitialStepLength(TaoLineSearch,PetscReal);
     51: PETSC_EXTERN PetscErrorCode TaoLineSearchGetSolution(TaoLineSearch,Vec,PetscReal*,Vec,PetscReal*,TaoLineSearchConvergedReason*);
     52: PETSC_EXTERN PetscErrorCode TaoLineSearchGetFullStepObjective(TaoLineSearch,PetscReal*);
     53: PETSC_EXTERN PetscErrorCode TaoLineSearchGetNumberFunctionEvaluations(TaoLineSearch,PetscInt*,PetscInt*,PetscInt*);

     55: PETSC_EXTERN PetscErrorCode TaoLineSearchGetType(TaoLineSearch,TaoLineSearchType*);
     56: PETSC_EXTERN PetscErrorCode TaoLineSearchSetType(TaoLineSearch,TaoLineSearchType);

     58: PETSC_EXTERN PetscErrorCode TaoLineSearchIsUsingTaoRoutines(TaoLineSearch,PetscBool*);
     59: PETSC_EXTERN PetscErrorCode TaoLineSearchSetObjectiveAndGTSRoutine(TaoLineSearch,PetscErrorCode(*)(TaoLineSearch,Vec,Vec,PetscReal*,PetscReal*,void*),void*);
     60: PETSC_EXTERN PetscErrorCode TaoLineSearchSetObjectiveRoutine(TaoLineSearch,PetscErrorCode(*)(TaoLineSearch,Vec,PetscReal*,void*),void*);
     61: PETSC_EXTERN PetscErrorCode TaoLineSearchSetGradientRoutine(TaoLineSearch,PetscErrorCode(*)(TaoLineSearch,Vec,Vec,void*),void*);
     62: PETSC_EXTERN PetscErrorCode TaoLineSearchSetObjectiveAndGradientRoutine(TaoLineSearch,PetscErrorCode(*)(TaoLineSearch,Vec,PetscReal*,Vec,void*),void*);

     64: PETSC_EXTERN PetscErrorCode TaoLineSearchComputeObjective(TaoLineSearch,Vec,PetscReal*);
     65: PETSC_EXTERN PetscErrorCode TaoLineSearchComputeGradient(TaoLineSearch,Vec,Vec);
     66: PETSC_EXTERN PetscErrorCode TaoLineSearchComputeObjectiveAndGradient(TaoLineSearch,Vec,PetscReal*,Vec);
     67: PETSC_EXTERN PetscErrorCode TaoLineSearchComputeObjectiveAndGTS(TaoLineSearch,Vec,PetscReal*,PetscReal*);
     68: PETSC_EXTERN PetscErrorCode TaoLineSearchSetVariableBounds(TaoLineSearch,Vec,Vec);

     70: PETSC_EXTERN PetscErrorCode TaoLineSearchInitializePackage(void);
     71: PETSC_EXTERN PetscErrorCode TaoLineSearchFinalizePackage(void);

     73: PETSC_EXTERN PetscErrorCode TaoLineSearchRegister(const char[],PetscErrorCode (*)(TaoLineSearch));
     74: PETSC_EXTERN PetscErrorCode TaoLineSearchUseTaoRoutines(TaoLineSearch,Tao);

     76: #endif