eval.cpp
Go to the documentation of this file.
597 return m + "name them, as in 'repeat n as nodes { each node ... }', and use 'nodes[0]." + e.s + "'";
FloatNum size(void) const
Return size of float value (distance between maximum and minimum).
Definition val.hpp:78
A name bound by a comprehension, visible while the binding exists.
Definition eval.hpp:76
long long int iteration
The iteration of a repeat or instances statement, from 1, or 0.
Definition eval.hpp:117
long long int count(const Expr &e, const char *what)
Return the value of e, a count described by what.
Definition eval.cpp:704
static bool explains(const Expr &e)
Test whether e passes on why it is false (see why).
Definition eval.cpp:372
Seq< int > record_path(int i) const
Return the indices of the record at of the check that select the records of its record name i.
Definition eval.cpp:269
static std::string array_name(const Expr &a)
Describe array a of a comprehension, for messages.
Definition eval.cpp:618
RecordRef records_of(const Expr &e)
Evaluate e, a record or a list of records.
Definition eval.cpp:305
Value comprehension(const Expr &e)
all, any, count, and sum over the elements of an array
Definition eval.cpp:651
std::string located(const std::string &msg)
Return the error message msg with the location and context.
Definition eval.cpp:165
static std::string indexed(const Expr &e)
Describe the array of index expression e, for messages.
Definition eval.cpp:568
const Seq< int > * record_at
The records of the deepest of them, one index per repeat level.
Definition eval.hpp:389
static std::string record_text(const Record &r, const Seq< int > &at)
Describe the records at of record name r, innermost first.
Definition eval.cpp:798
void set(const std::string &n, Value &&v)
Define n as v in the innermost frame.
Definition eval.cpp:214
size_t record_place(const Record &r, const Seq< int > &at)
Return where the record at of record name r starts in the input, or npos if that is unknown.
Definition eval.cpp:784
Seq< Witness > why
Why the last condition evaluated is false, for messages: the elements of the all-comprehensions that ...
Definition eval.hpp:392
Value call(const Expr &e)
Call a function (names and arguments are checked by the parser).
Definition eval.cpp:499
const Value * lookup(const std::string &n) const
Return the value of n, or null if it is not defined.
Definition eval.cpp:227
bool holds(const Stmt &s, std::string &error)
Test whether check s holds, and otherwise store why it fails in error.
Definition eval.cpp:717
bool explained(const Expr &e)
Return whether e is true, with only its own explanation in why.
Definition eval.cpp:411
void fail(const std::string &msg)
Throw an error with message msg at the current position.
Definition eval.cpp:197
const long long int max_effort
Limit for effort, which grows with the input, so that repeated or nested expressions cannot take time...
Definition eval.hpp:397
size_t record_start(const RecordRef &l, int i)
Return where record i of list l starts in the input, or npos.
Definition eval.cpp:294
std::string failure(const Stmt &s, int deepest, const Seq< int > &at)
Return why check s fails for the records at of its record name deepest.
Definition eval.cpp:812
bool distinct(const Expr &e)
Test whether all integers in the arguments of call e differ.
Definition eval.cpp:549
bool compare(const Value &a, const Value &b, const Expr &e)
Compare single values a and b with the operator of e.
Definition eval.cpp:474
const Value & field(const Expr &e, Value &tmp)
Evaluate field e of a record or a list of records.
Definition eval.cpp:344
long long int integer(const Value &v, const std::string &op)
Return the integer of single value v, or fail for op.
Definition eval.cpp:365
const Value & starts(const Stmt *r, const std::string &n)
Return the record starts of repeat r, failing for n if the repeat has not run yet.
Definition eval.cpp:277
const Value & ref(const Expr &e, Value &tmp)
Evaluate e, avoiding a copy for names.
Definition eval.cpp:254
Seq< Context > context
Description of the statements being executed, for errors.
Definition eval.hpp:379
bool ranges(const Stmt &s, int i, int level) const
Test whether record name i of check s is defined and ranges over the repeat at level.
Definition eval.cpp:735
std::string scalar_hint(const Expr &e) const
Return a hint for indexing e, a single value.
Definition eval.cpp:590
bool check_records(const Stmt &s, int deepest, Seq< int > &at, std::string &error)
Evaluate check s for the records inside the records at of its record name deepest,...
Definition eval.cpp:740
void explain(const Expr &e, const RecordRef &r, int i)
Add why element i of the array of all-comprehension e, with records r, is false.
Definition eval.cpp:636
Seq< Seq< Entry > > frames
Values: the outermost frame and one per active repeat iteration.
Definition eval.hpp:377
Evaluator(const SpecImpl &s, const std::string &text, const std::string &origin)
Initialize for spec s and input text from origin.
Definition eval.cpp:158
Place place(size_t q) const
Return the place of position q in the input, or the current place if q is npos.
Definition eval.cpp:793
Value subscript(const Expr &e)
a[i]: element i, counted from 0, of the outermost list of a
Definition eval.cpp:602
RecordRef element_records(const Expr &e, const Expr &a)
Return the records that are the elements of array a of comprehension e, an array of values (see Expr:...
Definition eval.cpp:627
const Stmt * elements
For a comprehension, the repeat whose records are the elements of its array, or null.
Definition impl.hpp:477
enum Gecode::Instance::Expr::Kind kind
int record
Index of a record name among the records of its check (-1 if none).
Definition impl.hpp:470
const Stmt * records
The repeat whose records or lists of records this is, or null.
Definition impl.hpp:472
enum Gecode::Instance::Expr::Op op
Error about the shape or type of a value, located by the caller.
Definition impl.hpp:238
A part of the explanation of a failed check, such as "record 3 of'jobs'", with the position of the re...
Definition eval.hpp:67
Reading instance files described by reader specs.
bool add(long long int x, long long int y, long long int &r)
Store x + y in r unless it overflows.
Definition eval.cpp:54
std::string record_starts(int id)
Return the name of the record starts of the repeat numbered id.
Definition impl.hpp:511
bool sub(long long int x, long long int y, long long int &r)
Store x - y in r unless it overflows.
Definition eval.cpp:62
std::string quote(const std::string &s)
Return s in single quotes, with newlines and tabs escaped.
Definition eval.cpp:43
Gecode toplevel namespace
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Definition element.cpp:39
void path(Home home, const IntVarArgs &x, IntVar s, IntVar e, IntPropLevel ipl=IPL_DEF)
Post propagator such that x forms a Hamiltonian path.
Definition circuit.cpp:169
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for .
Definition arithmetic.cpp:109
Gecode::IntArgs i({1, 2, 3, 4})
