MFEM  v4.6.0
Finite element discretization library
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 (hiop::size_type &n, hiop::size_type &m)
 
virtual bool get_starting_point (const hiop::size_type &n, double *x0)
 
virtual bool get_vars_info (const hiop::size_type &n, double *xlow, double *xupp, NonlinearityType *type)
 
virtual bool get_cons_info (const hiop::size_type &m, double *clow, double *cupp, NonlinearityType *type)
 
virtual bool eval_f (const hiop::size_type &n, const double *x, bool new_x, double &obj_value)
 
virtual bool eval_grad_f (const hiop::size_type &n, const double *x, bool new_x, double *gradf)
 
virtual bool eval_cons (const hiop::size_type &n, const hiop::size_type &m, const hiop::size_type &num_cons, const hiop::index_type *idx_cons, const double *x, bool new_x, double *cons)
 
virtual bool eval_Jac_cons (const hiop::size_type &n, const hiop::size_type &m, const hiop::size_type &num_cons, const hiop::index_type *idx_cons, const double *x, bool new_x, double *Jac)
 
virtual bool get_vecdistrib_info (hiop::size_type global_n, hiop::index_type *cols)
 
virtual void solution_callback (hiop::hiopSolveStatus status, hiop::size_type n, const double *x, const double *z_L, const double *z_U, hiop::size_type m, const double *g, const double *lambda, double obj_value)
 
virtual bool iterate_callback (int iter, double obj_value, double logbar_obj_value, int n, const double *x, const double *z_L, const double *z_U, int m_ineq, const double *s, int m, const double *g, const double *lambda, double inf_pr, double inf_du, double onenorm_pr_, double mu, double alpha_du, double alpha_pr, int ls_trials)
 
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

◆ HiopOptimizationProblem() [1/2]

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

Definition at line 56 of file hiop.hpp.

◆ HiopOptimizationProblem() [2/2]

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

Definition at line 71 of file hiop.hpp.

Member Function Documentation

◆ eval_cons()

bool mfem::HiopOptimizationProblem::eval_cons ( const hiop::size_type &  n,
const hiop::size_type &  m,
const hiop::size_type &  num_cons,
const hiop::index_type *  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 113 of file hiop.cpp.

◆ eval_f()

bool mfem::HiopOptimizationProblem::eval_f ( const hiop::size_type &  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.

◆ eval_grad_f()

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

Gradient of the objective function (local chunk).

Definition at line 97 of file hiop.cpp.

◆ eval_Jac_cons()

bool mfem::HiopOptimizationProblem::eval_Jac_cons ( const hiop::size_type &  n,
const hiop::size_type &  m,
const hiop::size_type &  num_cons,
const hiop::index_type *  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 140 of file hiop.cpp.

◆ get_cons_info()

bool mfem::HiopOptimizationProblem::get_cons_info ( const hiop::size_type &  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.

◆ get_MPI_comm()

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

Definition at line 201 of file hiop.hpp.

◆ get_prob_sizes()

bool mfem::HiopOptimizationProblem::get_prob_sizes ( hiop::size_type &  n,
hiop::size_type &  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.

◆ get_starting_point()

bool mfem::HiopOptimizationProblem::get_starting_point ( const hiop::size_type &  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.

◆ get_vars_info()

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

Definition at line 43 of file hiop.cpp.

◆ get_vecdistrib_info()

bool mfem::HiopOptimizationProblem::get_vecdistrib_info ( hiop::size_type  global_n,
hiop::index_type *  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 172 of file hiop.cpp.

◆ iterate_callback()

bool mfem::HiopOptimizationProblem::iterate_callback ( int  iter,
double  obj_value,
double  logbar_obj_value,
int  n,
const double *  x,
const double *  z_L,
const double *  z_U,
int  m_ineq,
const double *  s,
int  m,
const double *  g,
const double *  lambda,
double  inf_pr,
double  inf_du,
double  onenorm_pr_,
double  mu,
double  alpha_du,
double  alpha_pr,
int  ls_trials 
)
virtual

Definition at line 211 of file hiop.cpp.

◆ setStartingPoint()

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

Definition at line 85 of file hiop.hpp.

◆ solution_callback()

void mfem::HiopOptimizationProblem::solution_callback ( hiop::hiopSolveStatus  status,
hiop::size_type  n,
const double *  x,
const double *  z_L,
const double *  z_U,
hiop::size_type  m,
const double *  g,
const double *  lambda,
double  obj_value 
)
virtual

Definition at line 196 of file hiop.cpp.


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