Actual source code: petsctaolinesearch.h

      1: #ifndef PETSCTAOLINESEARCH_H
      2: #define PETSCTAOLINESEARCH_H
      3: #include <petscvec.h>

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

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

     29: PETSC_EXTERN PetscClassId TAOLINESEARCH_CLASSID;
     30: PETSC_EXTERN PetscFunctionList TaoLineSearchList;

     32: #include <petsctao.h>

     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 prefix[]);
     45: PETSC_EXTERN PetscErrorCode TaoLineSearchGetOptionsPrefix(TaoLineSearch,const char *prefix[]);
     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));

     75: #endif