OR-Tools
8.1
cached_log.h
Go to the documentation of this file.
1
// Copyright 2010-2018 Google LLC
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13
14
#ifndef OR_TOOLS_UTIL_CACHED_LOG_H_
15
#define OR_TOOLS_UTIL_CACHED_LOG_H_
16
17
#include <math.h>
18
19
#include <vector>
20
21
#include "
ortools/base/basictypes.h
"
22
#include "
ortools/base/integral_types.h
"
23
#include "
ortools/base/logging.h
"
24
#include "
ortools/base/macros.h
"
25
26
namespace
operations_research
{
27
// This class is used when manipulating search space estimations. It
28
// provides fast access to log of a domain size.
29
// Future Extensions:
30
// - Sum of log on an array.
31
// - Sum of log on an array with callback.
32
33
class
CachedLog
{
34
public
:
35
CachedLog
();
36
~CachedLog
();
37
38
// This method can only be called once, and with a cache_size > 0.
39
void
Init
(
int
cache_size);
40
41
// Returns the log2 of 'input'.
42
double
Log2
(
int64
input
)
const
;
43
44
private
:
45
std::vector<double> cache_;
46
DISALLOW_COPY_AND_ASSIGN(
CachedLog
);
47
};
48
}
// namespace operations_research
49
50
#endif // OR_TOOLS_UTIL_CACHED_LOG_H_
integral_types.h
operations_research::CachedLog
Definition:
cached_log.h:33
operations_research::CachedLog::Log2
double Log2(int64 input) const
Definition:
cached_log.cc:43
logging.h
operations_research::CachedLog::Init
void Init(int cache_size)
Definition:
cached_log.cc:34
macros.h
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition:
dense_doubly_linked_list.h:21
int64
int64_t int64
Definition:
integral_types.h:34
operations_research::CachedLog::CachedLog
CachedLog()
Definition:
cached_log.cc:20
basictypes.h
operations_research::CachedLog::~CachedLog
~CachedLog()
Definition:
cached_log.cc:22
input
static int input(yyscan_t yyscanner)
ortools
util
cached_log.h
Generated by
1.8.20