pcp/variable/
mod.rs

1// Copyright 2015 Pierre Talbot (IRCAM)
2
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6
7//     http://www.apache.org/licenses/LICENSE-2.0
8
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! A variable is a pair `(location, value)` where the value lives inside a block of memory, called the *variables store*. The store is parametrized by the type of the values it will contain, it is the *domain* of the variables.
16//!
17//! We initialize a variable in the store by providing the associated value and the store gives back a location associated to it. Further read or write operations of the value must be done explicitly through the store with the location returned during the allocation. An important property is that only monotonic updates of a value are allowed, it means that the domains can only become smaller. For example, the variable `x: [1..10]` can be updated to `x: [2..10]` or `x: [5..5]` but not to `x: [1..11]`.
18//!
19//! A subset of arithmetics is provided with *views* on variables. It allows to manipulate an expression such as `x + 5` as if it was a single variable and to avoid implementing specific instances of propagation algorithms such as `x + c < y` which is just `x < y` with `x` being a view. The view acts as a proxy between operations on variable and the store. It implies that operations must be called on the views instead of applying them directly to the store.
20
21pub mod memory;
22pub mod concept;
23pub mod ops;
24pub mod store;
25
26pub use variable::ops::Iterable;
27
28use variable::store::*;
29use variable::memory::TimestampTrailMemory;
30use variable::memory::CopyMemory;
31use propagation::events::FDEvent;
32use interval::interval::*;
33use interval::interval_set::*;
34
35pub type VStoreTrail<Domain> = Store<TimestampTrailMemory<Domain>, FDEvent>;
36pub type VStoreCopy<Domain> = Store<CopyMemory<Domain>, FDEvent>;
37pub type VStoreFD = VStoreTrail<Interval<i32>>;
38pub type VStoreSet = VStoreTrail<IntervalSet<i32>>;