16#ifndef ORTOOLS_LP_DATA_LP_TYPES_H_
17#define ORTOOLS_LP_DATA_LP_TYPES_H_
21#include <initializer_list>
28#include "absl/log/check.h"
54inline ColIndex
RowToColIndex(RowIndex row) {
return ColIndex(row.value()); }
57inline RowIndex
ColToRowIndex(ColIndex col) {
return RowIndex(col.value()); }
68#if defined(__ANDROID__)
74static inline double ToDouble(
double f) {
return f; }
255template <
typename IntType,
typename T>
265 return data_[
static_cast<size_t>(i.value())];
268 IntType
size()
const {
return size_; }
272 auto begin()
const {
return data_; }
273 auto end()
const {
return data_ +
static_cast<size_t>(size_.value()); }
285template <
typename IntType,
typename T,
typename Alloc = std::allocator<T>>
301#if !defined(__ANDROID__) && (!defined(_MSC_VER) || (_MSC_VER >= 1800))
303 const Alloc& a = Alloc())
307 template <
typename InputIteratorType>
309 const Alloc& a = Alloc())
319 IntType
size()
const {
return IntType(ParentType::size()); }
321 IntType
capacity()
const {
return IntType(ParentType::capacity()); }
335 DCHECK_GE(
size, IntType(0));
336 DCHECK_LE(
size, IntType(ParentType::size()));
407template <
typename EntryType>
410 using Index =
typename EntryType::Index;
411 using Entry = EntryType;
415 : EntryType(indices, coefficients, i) {}
423 return this->
i_ < other.i_;
425 const Entry&
operator*()
const {
return *
this; }
432 const double kConversionFactor = 2e-9;
433 return kConversionFactor *
static_cast<double>(n);
StrictITISpan< ColIndex, Fractional > View
util_intops::StrongVector< ColIndex, Fractional, std::allocator< Fractional > > ParentType
StrictITISpan< ColIndex, const Fractional > ConstView
StrictITISpan(T *data, IntType size)
reference operator[](IntType i) const
StrictITIVector(std::initializer_list< T > init_list, const Alloc &a=Alloc())
StrictITISpan< IntType, T > View
void assign(IntType size, const T &v)
void AssignToZero(IntType size)
util_intops::StrongVector< IntType, T, Alloc > ParentType
StrictITIVector(IntType size)
StrictITIVector & operator=(ConstView data)
StrictITIVector()=default
void reserve(IntType size)
void resize(IntType size, const T &v)
StrictITISpan< IntType, const T > ConstView
StrictITIVector(const Alloc &a)
void resize_down(IntType size)
StrictITIVector(InputIteratorType first, InputIteratorType last, const Alloc &a=Alloc())
ConstView const_view() const
StrictITIVector(IntType n, const T &v, const Alloc &a=Alloc())
void resize(IntType size)
const Entry & operator*() const
bool operator!=(const VectorIterator &other) const
VectorIterator(const Index *indices, const Fractional *coefficients, EntryIndex i)
typename EntryType::Index Index
void assign(size_type n, const value_type &val)
void reserve(size_type n)
void resize(size_type new_size)
constexpr ColIndex kInvalidCol(-1)
std::string GetVariableTypeString(VariableType variable_type)
StrictITIVector< RowIndex, ColIndex > RowToColMapping
std::vector< RowIndex > RowIndexVector
StrictITIVector< ColIndex, RowIndex > ColToRowMapping
StrictITIVector< RowIndex, bool > DenseBooleanColumn
std::vector< ColIndex > ColIndexVector
StrictITIVector< ColIndex, ColIndex > ColMapping
StrictITIVector< RowIndex, ConstraintStatus > ConstraintStatusColumn
Bitset64< ColIndex > DenseBitRow
std::string GetVariableStatusString(VariableStatus status)
Index ColToIntIndex(ColIndex col)
Bitset64< RowIndex > DenseBitColumn
constexpr Fractional kEpsilon
ColIndex RowToColIndex(RowIndex row)
bool IsFinite(Fractional value)
constexpr RowIndex kInvalidRow(-1)
StrictITIVector< RowIndex, RowIndex > RowMapping
@ UPPER_AND_LOWER_BOUNDED
StrictITIVector< ColIndex, VariableType > VariableTypeRow
RowIndex ColToRowIndex(ColIndex col)
std::string GetConstraintStatusString(ConstraintStatus status)
StrictITIVector< ColIndex, VariableStatus > VariableStatusRow
constexpr Fractional kInfinity
StrictITIVector< RowIndex, Fractional > DenseColumn
StrictITIVector< ColIndex, Fractional > DenseRow
StrictITIVector< ColIndex, bool > DenseBooleanRow
std::ostream & operator<<(std::ostream &os, ProblemStatus status)
@ INFEASIBLE_OR_UNBOUNDED
ConstraintStatus VariableToConstraintStatus(VariableStatus status)
static double DeterministicTimeForFpOperations(int64_t n)
std::string GetProblemStatusString(ProblemStatus problem_status)
Index RowToIntIndex(RowIndex row)
constexpr Fractional kRangeMax
static double ToDouble(double f)
ClosedInterval::Iterator end(ClosedInterval interval)
ClosedInterval::Iterator begin(ClosedInterval interval)
#define DEFINE_STRONG_INT64_TYPE(integer_type_name)
#define DEFINE_STRONG_INDEX_TYPE(index_type_name)