ceres_solver_options.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright 2016 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #include "cartographer/common/ceres_solver_options.h"
00018 
00019 namespace cartographer {
00020 namespace common {
00021 
00022 proto::CeresSolverOptions CreateCeresSolverOptionsProto(
00023     common::LuaParameterDictionary* parameter_dictionary) {
00024   proto::CeresSolverOptions proto;
00025   proto.set_use_nonmonotonic_steps(
00026       parameter_dictionary->GetBool("use_nonmonotonic_steps"));
00027   proto.set_max_num_iterations(
00028       parameter_dictionary->GetNonNegativeInt("max_num_iterations"));
00029   proto.set_num_threads(parameter_dictionary->GetNonNegativeInt("num_threads"));
00030   CHECK_GT(proto.max_num_iterations(), 0);
00031   CHECK_GT(proto.num_threads(), 0);
00032   return proto;
00033 }
00034 
00035 ceres::Solver::Options CreateCeresSolverOptions(
00036     const proto::CeresSolverOptions& proto) {
00037   ceres::Solver::Options options;
00038   options.use_nonmonotonic_steps = proto.use_nonmonotonic_steps();
00039   options.max_num_iterations = proto.max_num_iterations();
00040   options.num_threads = proto.num_threads();
00041   return options;
00042 }
00043 
00044 }  // namespace common
00045 }  // namespace cartographer


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:35