ceres_solver_options.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2016 The Cartographer Authors
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 
18 
19 namespace cartographer {
20 namespace common {
21 
22 proto::CeresSolverOptions CreateCeresSolverOptionsProto(
23  common::LuaParameterDictionary* parameter_dictionary) {
24  proto::CeresSolverOptions proto;
25  proto.set_use_nonmonotonic_steps(
26  parameter_dictionary->GetBool("use_nonmonotonic_steps"));
27  proto.set_max_num_iterations(
28  parameter_dictionary->GetNonNegativeInt("max_num_iterations"));
29  proto.set_num_threads(parameter_dictionary->GetNonNegativeInt("num_threads"));
30  CHECK_GT(proto.max_num_iterations(), 0);
31  CHECK_GT(proto.num_threads(), 0);
32  return proto;
33 }
34 
35 ceres::Solver::Options CreateCeresSolverOptions(
36  const proto::CeresSolverOptions& proto) {
37  ceres::Solver::Options options;
38  options.use_nonmonotonic_steps = proto.use_nonmonotonic_steps();
39  options.max_num_iterations = proto.max_num_iterations();
40  options.num_threads = proto.num_threads();
41  return options;
42 }
43 
44 } // namespace common
45 } // namespace cartographer
ceres::Solver::Options CreateCeresSolverOptions(const proto::CeresSolverOptions &proto)
proto::CeresSolverOptions CreateCeresSolverOptionsProto(common::LuaParameterDictionary *parameter_dictionary)


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58