Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
parameters_validation.cc File Reference
#include "ortools/glop/parameters_validation.h"
#include <cmath>
#include <string>
#include "absl/strings/str_cat.h"
#include "ortools/glop/parameters.pb.h"

Go to the source code of this file.

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 
namespace  operations_research::glop
 

Macros

#define TEST_FINITE_AND_NON_NEGATIVE(name)
 
#define TEST_INTEGER_NON_NEGATIVE(name)
 
#define TEST_NON_NEGATIVE(name)
 
#define TEST_NOT_NAN(name)
 

Functions

std::string operations_research::glop::ValidateParameters (const GlopParameters &params)
 

Macro Definition Documentation

◆ TEST_FINITE_AND_NON_NEGATIVE

#define TEST_FINITE_AND_NON_NEGATIVE ( name)
Value:
if (!std::isfinite(params.name())) { \
return absl::StrCat("parameter '", #name, "' is NaN or not finite"); \
} \
if (params.name() < 0) { \
return absl::StrCat("Parameters '", #name, "' must be non-negative"); \
}
const std::string name
A name for logging purposes.

Definition at line 24 of file parameters_validation.cc.

◆ TEST_INTEGER_NON_NEGATIVE

#define TEST_INTEGER_NON_NEGATIVE ( name)
Value:
if (params.name() < 0) { \
return absl::StrCat("Parameters '", #name, "' must be non-negative"); \
}

We need an integer version of the test as std::isnan can fail to compile on windows platforms when passed integer values.

Definition at line 34 of file parameters_validation.cc.

◆ TEST_NON_NEGATIVE

#define TEST_NON_NEGATIVE ( name)
Value:
if (std::isnan(params.name())) { \
return absl::StrCat("parameter '", #name, "' is NaN"); \
} \
if (params.name() < 0) { \
return absl::StrCat("Parameters '", #name, "' must be non-negative"); \
}

Definition at line 39 of file parameters_validation.cc.

◆ TEST_NOT_NAN

#define TEST_NOT_NAN ( name)
Value:
if (std::isnan(params.name())) { \
return absl::StrCat("parameter '", #name, "' is NaN"); \
}

Definition at line 47 of file parameters_validation.cc.