Function pcp::propagators::cmp::x_greater_y

source ·
pub fn x_greater_y<VStore>(x: Var<VStore>, y: Var<VStore>) -> XGreaterY<VStore>
Examples found in repository?
src/libpcp/propagators/cmp/mod.rs (line 49)
44
45
46
47
48
49
50
pub fn x_geq_y<VStore, Domain, Bound>(x: Var<VStore>, y: Var<VStore>) -> XGreaterEqY<VStore> where
  VStore: VStoreConcept<Item=Domain> + 'static,
  Domain: Collection<Item=Bound> + IntDomain,
  Bound: IntBound
{
  x_greater_y(Box::new(Addition::new(x, Bound::one())), y)
}
More examples
Hide additional examples
src/libpcp/search/branch_and_bound.rs (line 73)
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  fn enter(&mut self, mut current: Space<VStore, CStore, R>)
    -> (<Space<VStore, CStore, R> as Freeze>::FrozenState, Status<Space<VStore, CStore, R>>)
  {
    if let Some(bound) = self.value.clone() {
      let bound = Box::new(Constant::new(bound)) as Var<VStore>;
      match self.mode {
        Mode::Minimize => current.cstore.alloc(Box::new(XLessY::new(self.var.bclone(), bound.bclone()))),
        Mode::Maximize => current.cstore.alloc(Box::new(x_greater_y(self.var.bclone(), bound.bclone()))),
      };
    }
    let (mut immutable_state, status) = self.child.enter(current);
    if status == Satisfiable {
      let space = immutable_state.unfreeze();
      self.value = Some(self.var.read(&space.vstore).lower());
      immutable_state = space.freeze();
    }
    (immutable_state, status)
  }
src/libpcp/search/branching/binary_split.rs (line 47)
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  fn distribute(&mut self, space: Space<VStore, CStore, R>, var_idx: usize, val: Bound) ->
    (<Space<VStore, CStore, R> as Freeze>::FrozenState, Vec<Branch<Space<VStore, CStore, R>>>)
  {
    // See notes in Enumerate::distribute.
    Branch::distribute(space,
      vec![
        Box::new(move |space: &mut Space<VStore, CStore, R>| {
          let x = Box::new(Identity::<Domain>::new(var_idx)) as Var<VStore>;
          let v = Box::new(Constant::new(val)) as Var<VStore>;
          let x_less_v = x_leq_y::<_,_,Bound>(x.bclone(), v.bclone());
          space.cstore.alloc(Box::new(x_less_v));
        }),
        Box::new(move |space: &mut Space<VStore, CStore, R>| {
          let x = Box::new(Identity::<Domain>::new(var_idx)) as Var<VStore>;
          let v = Box::new(Constant::new(val)) as Var<VStore>;
          let x_geq_v = x_greater_y(x, v);
          space.cstore.alloc(Box::new(x_geq_v));
        })
      ]
    )
  }