MFEM  v4.3.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
mfem::HiopOptimizationProblem Class Reference

Internal class - adapts the OptimizationProblem class to HiOp's interface. More...

#include <hiop.hpp>

Inheritance diagram for mfem::HiopOptimizationProblem:
[legend]
Collaboration diagram for mfem::HiopOptimizationProblem:
[legend]

Public Member Functions

 HiopOptimizationProblem (const OptimizationProblem &prob)
 
 HiopOptimizationProblem (const MPI_Comm &comm_, const OptimizationProblem &prob)
 
void setStartingPoint (const Vector &x0)
 
virtual bool get_prob_sizes (long long int &n, long long int &m)
 
virtual bool get_starting_point (const long long &n, double *x0)
 
virtual bool get_vars_info (const long long &n, double *xlow, double *xupp, NonlinearityType *type)
 
virtual bool get_cons_info (const long long &m, double *clow, double *cupp, NonlinearityType *type)
 
virtual bool eval_f (const long long &n, const double *x, bool new_x, double &obj_value)
 
virtual bool eval_grad_f (const long long &n, const double *x, bool new_x, double *gradf)
 
virtual bool eval_cons (const long long &n, const long long &m, const long long &num_cons, const long long *idx_cons, const double *x, bool new_x, double *cons)
 
virtual bool eval_Jac_cons (const long long &n, const long long &m, const long long &num_cons, const long long *idx_cons, const double *x, bool new_x, double *Jac)
 
virtual bool get_vecdistrib_info (long long global_n, long long *cols)
 
virtual bool get_MPI_comm (MPI_Comm &comm_out)
 

Detailed Description

Internal class - adapts the OptimizationProblem class to HiOp's interface.

Definition at line 32 of file hiop.hpp.

Constructor & Destructor Documentation

mfem::HiopOptimizationProblem::HiopOptimizationProblem ( const OptimizationProblem prob)
inline

Definition at line 56 of file hiop.hpp.

mfem::HiopOptimizationProblem::HiopOptimizationProblem ( const MPI_Comm &  comm_,
const OptimizationProblem prob 
)
inline

Definition at line 71 of file hiop.hpp.

Member Function Documentation

bool mfem::HiopOptimizationProblem::eval_cons ( const long long &  n,
const long long &  m,
const long long &  num_cons,
const long long *  idx_cons,
const double *  x,
bool  new_x,
double *  cons 
)
virtual

Evaluates a subset of the constraints cons(x). The subset is of size num_cons and is described by indexes in the idx_cons array, i.e. cons[c] = C(x)[idx_cons[c]] where c = 0 .. num_cons-1. The methods may be called multiple times, each time for a subset of the constraints, for example, for the subset containing the equalities and for the subset containing the inequalities. However, each constraint will be inquired EXACTLY once. This is done for performance considerations, to avoid temporary holders and memory copying.

Parameters:

  • n, m: the global number of variables and constraints
  • num_cons, idx_cons (array of size num_cons): the number and indexes of constraints to be evaluated
  • x: the point where the constraints are to be evaluated
  • new_x: whether x has been changed from the previous call to f, grad_f, or Jac
  • cons: array of size num_cons containing the value of the constraints indicated by idx_cons

When MPI enabled, every rank populates cons, since the constraints are not distributed.

Definition at line 111 of file hiop.cpp.

bool mfem::HiopOptimizationProblem::eval_f ( const long long &  n,
const double *  x,
bool  new_x,
double &  obj_value 
)
virtual

Objective function evaluation. Each rank returns the global objective value.

Definition at line 82 of file hiop.cpp.

bool mfem::HiopOptimizationProblem::eval_grad_f ( const long long &  n,
const double *  x,
bool  new_x,
double *  gradf 
)
virtual

Gradient of the objective function (local chunk).

Definition at line 96 of file hiop.cpp.

bool mfem::HiopOptimizationProblem::eval_Jac_cons ( const long long &  n,
const long long &  m,
const long long &  num_cons,
const long long *  idx_cons,
const double *  x,
bool  new_x,
double *  Jac 
)
virtual

Evaluates the Jacobian of the subset of constraints indicated by idx_cons. The idx_cons is assumed to be of size num_cons. Example: if cons[c] = C(x)[idx_cons[c]] where c = 0 .. num_cons-1, then one needs to do Jac[c][j] = d cons[c] / dx_j, j = 1 .. n_loc. Jac is computed and stored in a contiguous vector (offset by rows).

Parameters: see eval_cons().

When MPI enabled, each rank computes only the local columns of the Jacobian, that is the partials with respect to local variables.

Definition at line 137 of file hiop.cpp.

bool mfem::HiopOptimizationProblem::get_cons_info ( const long long &  m,
double *  clow,
double *  cupp,
NonlinearityType *  type 
)
virtual

bounds on the constraints (clow<=-1e20 means no lower bound, cupp>=1e20 means no upper bound)

Definition at line 58 of file hiop.cpp.

virtual bool mfem::HiopOptimizationProblem::get_MPI_comm ( MPI_Comm &  comm_out)
inlinevirtual

Definition at line 164 of file hiop.hpp.

bool mfem::HiopOptimizationProblem::get_prob_sizes ( long long int &  n,
long long int &  m 
)
virtual

Extraction of problem dimensions: n is the number of variables, m is the number of constraints.

Definition at line 25 of file hiop.cpp.

bool mfem::HiopOptimizationProblem::get_starting_point ( const long long &  n,
double *  x0 
)
virtual

Provide an primal starting point. This point is subject to adjustments internally in HiOp.

Definition at line 33 of file hiop.cpp.

bool mfem::HiopOptimizationProblem::get_vars_info ( const long long &  n,
double *  xlow,
double *  xupp,
NonlinearityType *  type 
)
virtual

Definition at line 43 of file hiop.cpp.

bool mfem::HiopOptimizationProblem::get_vecdistrib_info ( long long  global_n,
long long *  cols 
)
virtual

Specifies column partitioning for distributed memory vectors. Process p owns vector entries with indices cols[p] to cols[p+1]-1, where p = 0 .. nranks-1. The cols array is of size nranks + 1. Example: for a vector x of 6 entries (globally) on 3 ranks, the uniform column partitioning is cols=[0,2,4,6].

Definition at line 168 of file hiop.cpp.

void mfem::HiopOptimizationProblem::setStartingPoint ( const Vector x0)
inline

Definition at line 86 of file hiop.hpp.


The documentation for this class was generated from the following files: