Apollo 10.0
自动驾驶开放平台
distance_approach_interface.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17/*
18 * @file
19 */
20
21#pragma once
22
23#include <omp.h>
24
25#include <adolc/adolc.h>
26#include <adolc/adolc_openmp.h>
27#include <adolc/adolc_sparse.h>
28#include <adolc/adouble.h>
29#include <coin/IpTNLP.hpp>
30#include <coin/IpTypes.hpp>
31
32#include "Eigen/Dense"
33
34#include "modules/common_msgs/config_msgs/vehicle_config.pb.h"
35#include "modules/planning/planning_open_space/proto/planner_open_space_config.pb.h"
36
37#include "cyber/common/log.h"
38#include "cyber/common/macros.h"
43
44#define tag_f 1
45#define tag_g 2
46#define tag_L 3
47#define HPOFF 30
48
49namespace apollo {
50namespace planning {
51
52class DistanceApproachInterface : public Ipopt::TNLP {
53 public:
54 virtual ~DistanceApproachInterface() = default;
55
57 virtual bool get_nlp_info(int& n, int& m,
58 int& nnz_jac_g, // NOLINT
59 int& nnz_h_lag, // NOLINT
60 IndexStyleEnum& index_style) = 0; // NOLINT
61
63 virtual bool get_bounds_info(int n, double* x_l, double* x_u, int m,
64 double* g_l, double* g_u) = 0;
65
67 virtual bool get_starting_point(int n, bool init_x, double* x, bool init_z,
68 double* z_L, double* z_U, int m,
69 bool init_lambda, double* lambda) = 0;
70
72 virtual bool eval_f(int n, const double* x,
73 bool new_x, // NOLINT
74 double& obj_value) = 0; // NOLINT
75
77 virtual bool eval_grad_f(int n, const double* x, bool new_x,
78 double* grad_f) = 0;
79
81 virtual bool eval_g(int n, const double* x, bool new_x, int m, double* g) = 0;
82
84 virtual bool check_g(int n, const double* x, int m, const double* g) = 0;
85
90 virtual bool eval_jac_g(int n, const double* x, bool new_x, int m,
91 int nele_jac, int* iRow, int* jCol,
92 double* values) = 0;
93 // sequential implementation to jac_g
94 virtual bool eval_jac_g_ser(int n, const double* x, bool new_x, int m,
95 int nele_jac, int* iRow, int* jCol,
96 double* values) = 0;
97
103 virtual bool eval_h(int n, const double* x, bool new_x, double obj_factor,
104 int m, const double* lambda, bool new_lambda,
105 int nele_hess, int* iRow, int* jCol, double* values) = 0;
106
110 virtual void finalize_solution(Ipopt::SolverReturn status, int n,
111 const double* x, const double* z_L,
112 const double* z_U, int m, const double* g,
113 const double* lambda, double obj_value,
114 const Ipopt::IpoptData* ip_data,
115 Ipopt::IpoptCalculatedQuantities* ip_cq) = 0;
116
118 Eigen::MatrixXd* state_result, Eigen::MatrixXd* control_result,
119 Eigen::MatrixXd* time_result, Eigen::MatrixXd* dual_l_result,
120 Eigen::MatrixXd* dual_n_result) const = 0;
121};
122
123} // namespace planning
124} // namespace apollo
virtual bool eval_grad_f(int n, const double *x, bool new_x, double *grad_f)=0
Method to return the gradient of the objective
virtual bool eval_jac_g(int n, const double *x, bool new_x, int m, int nele_jac, int *iRow, int *jCol, double *values)=0
Method to return: 1) The structure of the jacobian (if "values" is nullptr) 2) The values of the jaco...
virtual bool eval_h(int n, const double *x, bool new_x, double obj_factor, int m, const double *lambda, bool new_lambda, int nele_hess, int *iRow, int *jCol, double *values)=0
Method to return: 1) The structure of the hessian of the lagrangian (if "values" is nullptr) 2) The v...
virtual bool check_g(int n, const double *x, int m, const double *g)=0
Check unfeasible constraints for further study
virtual bool eval_jac_g_ser(int n, const double *x, bool new_x, int m, int nele_jac, int *iRow, int *jCol, double *values)=0
virtual bool get_starting_point(int n, bool init_x, double *x, bool init_z, double *z_L, double *z_U, int m, bool init_lambda, double *lambda)=0
Method to return the starting point for the algorithm
virtual void get_optimization_results(Eigen::MatrixXd *state_result, Eigen::MatrixXd *control_result, Eigen::MatrixXd *time_result, Eigen::MatrixXd *dual_l_result, Eigen::MatrixXd *dual_n_result) const =0
virtual void finalize_solution(Ipopt::SolverReturn status, int n, const double *x, const double *z_L, const double *z_U, int m, const double *g, const double *lambda, double obj_value, const Ipopt::IpoptData *ip_data, Ipopt::IpoptCalculatedQuantities *ip_cq)=0
This method is called when the algorithm is complete so the TNLP can store/write the solution
virtual bool get_bounds_info(int n, double *x_l, double *x_u, int m, double *g_l, double *g_u)=0
Method to return the bounds for my problem
virtual bool eval_f(int n, const double *x, bool new_x, double &obj_value)=0
Method to return the objective value
virtual bool eval_g(int n, const double *x, bool new_x, int m, double *g)=0
Method to return the constraint residuals
virtual bool get_nlp_info(int &n, int &m, int &nnz_jac_g, int &nnz_h_lag, IndexStyleEnum &index_style)=0
Method to return some info about the nlp
Planning module main class.
Math-related util functions.
Some util functions.
class register implement
Definition arena_queue.h:37