Shared distances between indexed sites. More...
#include <gecode/int.hh>
Classes | |
| class | Data |
| Shared matrix or callable. More... | |
Public Member Functions | |
| IntDistance (int n, const IntArgs &matrix) | |
| Copy and validate an n by n row-major distance matrix. | |
| IntDistance (int n, std::function< int(int, int)> function) | |
| Compute distances on demand for n sites. | |
| int | size (void) const |
| Number of sites. | |
| int | operator() (int a, int b) const |
| Distance between valid indices a and b. | |
| Public Member Functions inherited from Gecode::SharedHandle | |
| SharedHandle (void) | |
| Create shared handle with no object pointing to. | |
| SharedHandle (SharedHandle::Object *so) | |
| Create shared handle that points to shared object so. | |
| SharedHandle (const SharedHandle &sh) | |
| Copy constructor maintaining reference count. | |
| SharedHandle & | operator= (const SharedHandle &sh) |
| Assignment operator maintaining reference count. | |
| ~SharedHandle (void) | |
| Destructor that maintains reference count. | |
| operator bool (void) const | |
| Whether handle points to an object. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Gecode::SharedHandle | |
| SharedHandle::Object * | object (void) const |
| Access to the shared object. | |
| void | object (SharedHandle::Object *n) |
| Modify shared object. | |
Detailed Description
Shared distances between indexed sites.
Distances are nonnegative, symmetric, and zero on the diagonal. No triangle inequality is required. Site indices range from zero to size()-1. Matrix entries or a callable are shared across propagators, clones, and search threads.
Constructor & Destructor Documentation
◆ IntDistance() [1/2]
| Gecode::IntDistance::IntDistance | ( | int | n, |
| const IntArgs & | matrix ) |
Copy and validate an n by n row-major distance matrix.
Throws Int::OutOfLimits for invalid sizes or distances, Int::ArgumentSizeMismatch for a wrong number of entries, and Int::IllegalOperation for asymmetry or a nonzero diagonal.
◆ IntDistance() [2/2]
| Gecode::IntDistance::IntDistance | ( | int | n, |
| std::function< int(int, int)> | function ) |
Compute distances on demand for n sites.
The callable must return a stable, symmetric, nonnegative distance within Int::Limits, and zero for equal indices. It must own or share its captured data, be safe for concurrent calls, and not depend on a Space. Construction does not evaluate it or materialize a matrix. Results are checked for range and a zero diagonal when evaluated; symmetry is the caller's responsibility. Throws Int::OutOfLimits for an invalid site count and InvalidFunction for an empty callable.
Member Function Documentation
◆ size()
|
inline |
Number of sites.
Definition at line 41 of file min-distance.hpp.
◆ operator()()
|
inline |
Distance between valid indices a and b.
Definition at line 46 of file min-distance.hpp.
The documentation for this class was generated from the following files:
- gecode/int.hh
- gecode/int/min-distance.hpp
