7#ifndef __IPTNLPADAPTER_HPP__
8#define __IPTNLPADAPTER_HPP__
20class ExpansionMatrixSpace;
22class TDependencyDetector;
254 ONLY_SECOND_ORDER_TEST
268 OBJGRAD_FINDIFF_VALUES
455 std::list<Index>&
c_deps);
AlgorithmMode
enum to indicate the mode in which the algorithm is
#define IPOPT_DEPRECATED
macro to declare symbols as deprecated
Templated class which stores one entry for the CachedResult class.
Class for all IPOPT specific calculated quantities.
Class to organize all the data required by the algorithm.
Specialized CompoundVector class specifically for the algorithm iterates.
This class stores a list of user set options.
This is the base class for all derived symmetric matrix types.
This class adapts the TNLP interface so it looks like an NLP interface.
Number point_perturbation_radius_
Maximal perturbation of the initial point.
bool dependency_detection_with_rhs_
Flag indicating if rhs should be considered during dependency detection.
DECLARE_STD_EXCEPTION(ERROR_IN_TNLP_DERIVATIVE_TEST)
SmartPtr< const MatrixSpace > Jac_c_space_
Index nz_jac_c_
non-zeros of the jacobian of c
SmartPtr< const Journalist > jnlst_
Journalist.
Number findiff_perturbation_
Size of the perturbation for the derivative approximation.
bool derivative_test_print_all_
Flag indicating if all test values should be printed, or only those violating the threshold.
Index * x_fixed_map_
Position of fixed variables.
SmartPtr< const MatrixSpace > pd_u_space_
GradientApproxEnum
Enum for specifying technique for computing objective Gradient.
void ResortBounds(const Vector &x_L, Number *x_L_orig, const Vector &x_U, Number *x_U_orig)
Provides values for lower and upper bounds on variables for given Ipopt-internal vectors.
Index nz_jac_d_
non-zeros of the jacobian of d
TNLPAdapter(const SmartPtr< TNLP > tnlp, const SmartPtr< const Journalist > jnlst=NULL)
Default constructor.
DerivativeTestEnum derivative_test_
Maximal slack for one-sidedly bounded variables.
Index nz_jac_c_no_extra_
non-zeros of the jacobian of c without added constraints for fixed variables.
void GetFullDimensions(Index &n, Index &m) const
Get number of variables and number of constraints in TNLP.
Number * full_g_
copy of lambda (yc & yd)
std::vector< Index > jac_fixed_idx_map_
Index mapping of Jacobian w.r.t.
Index * findiff_jac_ja_
Ordered by columns, for each column the row indices in Jacobian.
SmartPtr< const VectorSpace > d_space_
bool update_local_x(const Vector &x)
virtual void GetScalingParameters(const SmartPtr< const VectorSpace > x_space, const SmartPtr< const VectorSpace > c_space, const SmartPtr< const VectorSpace > d_space, Number &obj_scaling, SmartPtr< Vector > &x_scaling, SmartPtr< Vector > &c_scaling, SmartPtr< Vector > &d_scaling) const
Routines to get the scaling parameters.
void ResortX(const Vector &x, Number *x_orig, bool usefixedvals=true)
Sort the primal variables, and add the fixed values in x_orig.
IPOPT_DEPRECATED void ResortBnds(const Vector &x_L, Number *x_L_orig, const Vector &x_U, Number *x_U_orig, bool clearorig=true)
Provides values for lower and upper bounds on variables for given Ipopt-internal vectors.
SmartPtr< const VectorSpace > x_l_space_
SmartPtr< const VectorSpace > x_u_space_
const Number * GetC_Rhs() const
Get right-hand-sides that are added into c(x)
Index n_x_fixed_
Number of fixed variables.
FixedVariableTreatmentEnum fixed_variable_treatment_
Flag indicating how fixed variables should be handled.
SmartPtr< ExpansionMatrixSpace > P_x_full_x_space_
GradientApproxEnum gradient_approximation_
Flag indicating how objective Gradient is computed.
void GetPermutationMatrices(SmartPtr< const ExpansionMatrix > &P_x_full_x, SmartPtr< const ExpansionMatrix > &P_x_x_L, SmartPtr< const ExpansionMatrix > &P_x_x_U, SmartPtr< const ExpansionMatrix > &P_c_g, SmartPtr< const ExpansionMatrix > &P_d_g) const
Get mappings between TNLP indices and Ipopt internal indices for variables and constraints.
bool warm_start_same_structure_
Flag indicating whether the TNLP with identical structure has already been solved before.
virtual bool Eval_grad_f(const Vector &x, Vector &g_f)
TaggedObject::Tag y_d_tag_for_iterates_
virtual bool Eval_jac_d(const Vector &x, Matrix &jac_d)
Number derivative_test_tol_
Relative threshold for marking deviation from finite difference test.
SmartPtr< ExpansionMatrix > P_x_x_L_
Expansion from fixed x_L (ipopt) to full x.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
void operator=(const TNLPAdapter &)
Default Assignment Operator.
Index n_full_x_
full dimension of x (fixed + non-fixed)
Index * findiff_jac_postriplet_
Position of entry in original triplet matrix.
virtual bool GetStartingPoint(SmartPtr< Vector > x, bool need_x, SmartPtr< Vector > y_c, bool need_y_c, SmartPtr< Vector > y_d, bool need_y_d, SmartPtr< Vector > z_L, bool need_z_L, SmartPtr< Vector > z_U, bool need_z_U)
Method for obtaining the starting point for all the iterates.
SmartPtr< const MatrixSpace > pd_l_space_
JacobianApproxEnum
Enum for specifying technique for computing Jacobian.
Index nz_full_h_
number of non-zeros in full-size Hessian
SmartPtr< const VectorSpace > c_space_
TNLP::IndexStyleEnum index_style_
Numbering style of variables and constraints.
Number nlp_lower_bound_inf_
Value for a lower bound that denotes -infinity.
bool internal_eval_g(bool new_x)
SmartPtr< const MatrixSpace > px_u_space_
Index n_full_g_
full dimension of g (c + d)
std::vector< Index > jac_fixed_jCol_
TaggedObject::Tag x_tag_for_g_
SmartPtr< ExpansionMatrixSpace > P_x_x_L_space_
virtual void GetQuasiNewtonApproximationSpaces(SmartPtr< VectorSpace > &approx_space, SmartPtr< Matrix > &P_approx)
Method returning information on quasi-Newton approximation.
SmartPtr< TNLP > tnlp_
Pointer to the TNLP class (class specific to Number* vectors and triplet matrices)
void initialize_findiff_jac(const Index *iRow, const Index *jCol)
Initialize sparsity structure for finite difference Jacobian.
SmartPtr< const VectorSpace > d_u_space_
Number derivative_test_perturbation_
Size of the perturbation for the derivative test.
void GetFixedVariables(Index &n_x_fixed, Index *&x_fixed_map, FixedVariableTreatmentEnum &fixed_variable_treatment) const
Get number and indices of fixed variables.
Index findiff_jac_nnz_
Number of unique nonzeros in constraint Jacobian.
Number * full_lambda_
copy of the full x vector (fixed & non-fixed)
TaggedObject::Tag x_tag_for_jac_g_
Number nlp_upper_bound_inf_
Value for a upper bound that denotes infinity.
Number * jac_g_
copy of g (c & d)
bool CheckDerivatives(DerivativeTestEnum deriv_test, Index deriv_test_start_index)
Method for performing the derivative test.
Number * c_rhs_
the values for the full jacobian of g
virtual bool Eval_d(const Vector &x, Vector &d)
SmartPtr< const VectorSpace > d_l_space_
Number * findiff_x_u_
Copy of the upper bounds.
Index nz_full_jac_g_
number of non-zeros in full-size Jacobian of g
virtual ~TNLPAdapter()
Default destructor.
Index derivative_test_first_index_
Index of first quantity to be checked.
SmartPtr< ExpansionMatrix > P_x_full_x_
Expansion from fixed x (ipopt) to full x.
FixedVariableTreatmentEnum
Enum for treatment of fixed variables option.
SmartPtr< ExpansionMatrix > P_c_g_
SmartPtr< ExpansionMatrix > P_d_g_
SmartPtr< ExpansionMatrixSpace > P_x_x_U_space_
TNLPAdapter(const TNLPAdapter &)
Copy Constructor.
bool DetermineDependentConstraints(Index n_x_var, const Index *x_not_fixed_map, const Number *x_l, const Number *x_u, const Number *g_l, const Number *g_u, Index n_c, const Index *c_map, std::list< Index > &c_deps)
bool internal_eval_jac_g(bool new_x)
virtual bool GetWarmStartIterate(IteratesVector &warm_start_iterate)
Method for obtaining an entire iterate as a warmstart point.
virtual bool Eval_jac_c(const Vector &x, Matrix &jac_c)
void ResortG(const Vector &c, const Vector &d, Number *g_orig, bool correctrhs=false)
Sort constraint values.
virtual bool IntermediateCallBack(AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
This method is called once per iteration, after the iteration summary output has been printed.
TaggedObject::Tag x_tag_for_iterates_
SmartPtr< ExpansionMatrix > P_x_x_U_
Expansion from fixed x_U (ipopt) to full x.
SmartPtr< const SymMatrixSpace > Hess_lagrangian_space_
SmartPtr< TDependencyDetector > dependency_detector_
Object that can be used to detect linearly dependent rows in the equality constraint Jacobian.
virtual bool Eval_h(const Vector &x, Number obj_factor, const Vector &yc, const Vector &yd, SymMatrix &h)
Number * findiff_x_l_
Copy of the lower bounds.
SmartPtr< ExpansionMatrixSpace > P_c_g_space_
Expansion from c only (ipopt) to full ampl c.
std::vector< Index > jac_fixed_iRow_
SmartPtr< const VectorSpace > x_space_
virtual bool GetBoundsInformation(const Matrix &Px_L, Vector &x_L, const Matrix &Px_U, Vector &x_U, const Matrix &Pd_L, Vector &d_L, const Matrix &Pd_U, Vector &d_U)
Method for obtaining the bounds information.
JacobianApproxEnum jacobian_approximation_
Flag indicating how Jacobian is computed.
Index * findiff_jac_ia_
Start position for nonzero indices in ja for each column of Jacobian.
bool ResortBoundMultipliers(const Vector &x, const Vector &y_c, const Vector &y_d, const Vector &z_L, Number *z_L_orig, const Vector &z_U, Number *z_U_orig)
Provides values for dual multipliers on lower and upper bounds on variables for given Ipopt-internal ...
virtual bool Eval_f(const Vector &x, Number &f)
SmartPtr< ExpansionMatrixSpace > P_d_g_space_
Expansion from d only (ipopt) to full ampl d.
HessianApproximationType hessian_approximation_
Flag indicating what Hessian information is to be used.
Number bound_relax_factor_
Determines relaxation of fixing bound for RELAX_BOUNDS.
TaggedObject::Tag y_c_tag_for_iterates_
Number tol_
Overall convergence tolerance.
virtual void FinalizeSolution(SolverReturn status, const Vector &x, const Vector &z_L, const Vector &z_U, const Vector &c, const Vector &d, const Vector &y_c, const Vector &y_d, Number obj_value, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
This method is called at the very end of the optimization.
bool update_local_lambda(const Vector &y_c, const Vector &y_d)
SmartPtr< const MatrixSpace > Jac_d_space_
virtual bool GetSpaces(SmartPtr< const VectorSpace > &x_space, SmartPtr< const VectorSpace > &c_space, SmartPtr< const VectorSpace > &d_space, SmartPtr< const VectorSpace > &x_l_space, SmartPtr< const MatrixSpace > &px_l_space, SmartPtr< const VectorSpace > &x_u_space, SmartPtr< const MatrixSpace > &px_u_space, SmartPtr< const VectorSpace > &d_l_space, SmartPtr< const MatrixSpace > &pd_l_space, SmartPtr< const VectorSpace > &d_u_space, SmartPtr< const MatrixSpace > &pd_u_space, SmartPtr< const MatrixSpace > &Jac_c_space, SmartPtr< const MatrixSpace > &Jac_d_space, SmartPtr< const SymMatrixSpace > &Hess_lagrangian_space)
Method for creating the derived vector / matrix types.
Index num_linear_variables_
Number of linear variables.
Index nz_h_
number of non-zeros in the non-fixed-size Hessian
virtual bool Eval_c(const Vector &x, Vector &c)
virtual bool ProcessOptions(const OptionsList &options, const std::string &prefix)
Overload if you want the chance to process options or parameters that may be specific to the NLP.
SmartPtr< const MatrixSpace > px_l_space_
SmartPtr< TNLP > tnlp() const
Accessor method for the underlying TNLP.
DECLARE_STD_EXCEPTION(INVALID_TNLP)
DerivativeTestEnum
Enum for specifying which derivative test is to be performed.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
SmartPtr< const U > ConstPtr(const SmartPtr< U > &smart_ptr)
HessianApproximationType
enumeration for the Hessian information type.
SolverReturn
enum for the return from the optimize algorithm
ipindex Index
Type of all indices of vectors, matrices etc.
ipnumber Number
Type of all numbers.