Skip to content

Commit

Permalink
fix docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurorororo committed Dec 14, 2023
1 parent da6ae13 commit e92802d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
2 changes: 1 addition & 1 deletion didppy/docs/ref.bib
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ @inproceedings{LNBS

@inproceedings{DIDPParallel,
author = {Ryo Kuroiwa and J. Christopher Beck},
booktitle = {Proceedings of the 38th Annual AAAI Conference on Artificial Intelligence},
booktitle = {Proceedings of the 38th Annual AAAI Conference on Artificial Intelligence (AAAI)},
title = {Parallel Beam Search Algorithms for Domain-Independent Dynamic Programming},
year = {2024}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crossbeam_channel::{Receiver, Sender};
/// # References
///
/// Friedmann Mattern. "Algorithms for Distributed Termination Detection,"
/// Distributed Computing, vol. 2, pp 161-175, 1987
/// Distributed Computing, vol. 2, pp. 161-175, 1987.
pub struct HdNodeChannel<N> {
node_txs: Vec<Sender<(usize, N)>>,
node_rx: Receiver<(usize, N)>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::cmp::max;
/// # References
///
/// Friedmann Mattern. "Algorithms for Distributed Termination Detection,"
/// Distributed Computing, vol. 2, pp 161-175, 1987
/// Distributed Computing, vol. 2, pp. 161-175, 1987.
pub struct TerminationDetector {
id: usize,
clock: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ mod tests {
use dypdl::variable_type::Set;
use dypdl::StateInterface;
use dypdl::{expression::*, TableRegistry};
use std::rc::Rc;

#[test]
fn hashable_signature_variables() {
Expand Down Expand Up @@ -906,6 +907,64 @@ mod tests {
);
}

#[test]
fn state_with_hashable_signature_variable_from_state_in_registry() {
let mut set1 = Set::with_capacity(3);
set1.insert(0);
set1.insert(2);
let mut set2 = Set::with_capacity(3);
set2.insert(0);
set2.insert(1);
let signature_variables = HashableSignatureVariables {
set_variables: vec![set1, set2],
vector_variables: vec![vec![0, 2], vec![1, 2]],
element_variables: vec![1, 2],
integer_variables: vec![1, 2, 3],
continuous_variables: vec![OrderedFloat(1.0), OrderedFloat(2.0), OrderedFloat(3.0)],
};
let resource_variables = dypdl::ResourceVariables {
element_variables: vec![],
integer_variables: vec![4, 5, 6],
continuous_variables: vec![4.0, 5.0, 6.0],
};
let state = StateWithHashableSignatureVariables::from(StateInRegistry {
signature_variables: Rc::new(signature_variables.clone()),
resource_variables: resource_variables.clone(),
});
assert_eq!(
state.signature_variables.set_variables,
signature_variables.set_variables
);
assert_eq!(
state.signature_variables.vector_variables,
signature_variables.vector_variables
);
assert_eq!(
state.signature_variables.element_variables,
signature_variables.element_variables
);
assert_eq!(
state.signature_variables.integer_variables,
signature_variables.integer_variables
);
assert_eq!(
state.signature_variables.continuous_variables,
vec![OrderedFloat(1.0), OrderedFloat(2.0), OrderedFloat(3.0)]
);
assert_eq!(
state.resource_variables.element_variables,
resource_variables.element_variables
);
assert_eq!(
state.resource_variables.integer_variables,
resource_variables.integer_variables
);
assert_eq!(
state.resource_variables.continuous_variables,
resource_variables.continuous_variables
);
}

#[test]
fn state_with_hashable_signature_variables_get_number_of_set_variables() {
let state = StateWithHashableSignatureVariables {
Expand Down

0 comments on commit e92802d

Please sign in to comment.