Skip to content

Commit

Permalink
Merge pull request #30 from regexident/fix-typos
Browse files Browse the repository at this point in the history
Fix comment typos
  • Loading branch information
xgillard committed Jul 7, 2023
2 parents adb714b + 82b76b4 commit 0820dd4
Show file tree
Hide file tree
Showing 45 changed files with 145 additions and 145 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ struct KnapsackState {
/// problem.
depth: usize,
/// the remaining capacity in the knapsack. That is the maximum load the sack
/// can bear withouth cracking **given what is already in the sack**.
/// can bear without cracking **given what is already in the sack**.
capacity: usize
}

/// This structure represents a particular instance of the knapsack problem.
/// This is the sctructure that will implement the knapsack model.
/// This is the structure that will implement the knapsack model.
///
/// The problem definition is quite easy to understand: there is a knapsack having
/// a maximum (weight) capacity, and a set of items to chose from. Each of these
Expand Down Expand Up @@ -172,7 +172,7 @@ implement the `fast_upper_bound()` method of the `Relaxation` trait.
///
/// # Note:
/// In addition to the aforementioned two operations, the KPRelax structure implements
/// an optional `fast_upper_bound` method. Whichone provides a useful bound to
/// an optional `fast_upper_bound` method. Which one provides a useful bound to
/// prune some portions of the state-space as the decision diagrams are compiled.
/// (aka rough upper bound pruning).
struct KPRelax;
Expand Down Expand Up @@ -261,13 +261,13 @@ fn main() {
// 5. Add a dominance relation checker
let dominance = SimpleDominanceChecker::new(KPDominance);

// 6. Decide of a cutoff heuristic (if you dont want to let the solver run for ever)
// 6. Decide of a cutoff heuristic (if you don't want to let the solver run for ever)
let cutoff = NoCutoff; // might as well be a TimeBudget (or something else)

// 7. Create the solver fringe
let mut fringe = SimpleFringe::new(MaxUB::new(&heuristic));

// 8. Instanciate your solver
// 8. Instantiate your solver
let mut solver = DefaultSolver::new(
&problem,
&relaxation,
Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/alp/io_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ pub struct AlpInstance {
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// alp instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
}
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/alp/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct Args {
}

/// An utility function to return an max width heuristic that can either be a fixed width
/// policy (if w is fixed) or an adaptative policy returning the number of unassigned variables
/// policy (if w is fixed) or an adaptive policy returning the number of unassigned variables
/// in the overall problem.
fn max_width<P: Problem>(p: &P, w: Option<usize>) -> Box<dyn WidthHeuristic<P::State> + Send + Sync> {
if let Some(w) = w {
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/alp/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//! This example show how to implement a solver for the pigment sequencint problem
//! This example show how to implement a solver for the pigment sequencing problem
//! using ddo. It is a fairly simple example but it features most of the aspects you will
//! want to copy when implementing your own solver.

Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/golomb/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Problem for Golomb {
let next_mark = state.last_mark as usize+ 1;
for i in next_mark..n2 {
if state.marks.iter().any(|j| state.distances.contains(i - j)) {
continue; // this distance is already present, invalid mark at it (alldifferent)
continue; // this distance is already present, invalid mark at it (all different)
} else {
f.apply(Decision { variable, value: i as isize});
}
Expand Down
16 changes: 8 additions & 8 deletions ddo/examples/knapsack/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ pub struct KnapsackState {
/// problem.
depth: usize,
/// the remaining capacity in the knapsack. That is the maximum load the sack
/// can bear withouth cracking **given what is already in the sack**.
/// can bear without cracking **given what is already in the sack**.
capacity: usize
}

/// This structure represents a particular instance of the knapsack problem.
/// This is the sctructure that will implement the knapsack model.
/// This is the structure that will implement the knapsack model.
///
/// The problem definition is quite easy to understand: there is a knapsack having
/// a maximum (weight) capacity, and a set of items to chose from. Each of these
Expand Down Expand Up @@ -140,7 +140,7 @@ impl Problem for Knapsack {
///
/// # Note:
/// In addition to the aforementioned two operations, the KPRelax structure implements
/// an optional `fast_upper_bound` method. Whichone provides a useful bound to
/// an optional `fast_upper_bound` method. Which one provides a useful bound to
/// prune some portions of the state-space as the decision diagrams are compiled.
/// (aka rough upper bound pruning).
pub struct KPRelax<'a>{pub pb: &'a Knapsack}
Expand Down Expand Up @@ -247,22 +247,22 @@ struct Args {
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// knapsack instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not a knapsack instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
/// The file was not properly formatted.
#[error("ill formed instance")]
Format,
}

/// This funciton is used to read a knapsack instance from file. It returns either a
/// This function is used to read a knapsack instance from file. It returns either a
/// knapsack instance if everything went on well or an error describing the problem.
pub fn read_instance<P: AsRef<Path>>(fname: P) -> Result<Knapsack, Error> {
let f = File::open(fname)?;
Expand Down Expand Up @@ -299,7 +299,7 @@ pub fn read_instance<P: AsRef<Path>>(fname: P) -> Result<Knapsack, Error> {
}

/// An utility function to return an max width heuristic that can either be a fixed width
/// policy (if w is fixed) or an adaptative policy returning the number of unassigned variables
/// policy (if w is fixed) or an adaptive policy returning the number of unassigned variables
/// in the overall problem.
fn max_width<T>(nb_vars: usize, w: Option<usize>) -> Box<dyn WidthHeuristic<T> + Send + Sync> {
if let Some(w) = w {
Expand All @@ -310,7 +310,7 @@ fn max_width<T>(nb_vars: usize, w: Option<usize>) -> Box<dyn WidthHeuristic<T> +
}

/// This is your executable's entry point. It is the place where all the pieces are put together
/// to create a fast an effectuve solver for the knapsack problem.
/// to create a fast an effective solver for the knapsack problem.
fn main() {
let args = Args::parse();
let problem = read_instance(&args.fname).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/lcs/io_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ use crate::model::Lcs;
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// psp instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
/// The file was not properly formatted.
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/lcs/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct Args {
}

/// An utility function to return an max width heuristic that can either be a fixed width
/// policy (if w is fixed) or an adaptative policy returning the number of unassigned variables
/// policy (if w is fixed) or an adaptive policy returning the number of unassigned variables
/// in the overall problem.
fn max_width<P: Problem>(p: &P, w: Option<usize>) -> Box<dyn WidthHeuristic<P::State> + Send + Sync> {
if let Some(w) = w {
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/lcs/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct Lcs {
/// next[str][char][pos] gives the next position after
/// position pos (included) in which character char occurs in string str
next: Vec<Vec<Vec<usize>>>,
/// rem[str][char][pos] gives the number of occurences of
/// rem[str][char][pos] gives the number of occurrences of
/// character char in string str after position pos (included)
rem: Vec<Vec<Vec<isize>>>,
/// Mapping from integers to the original characters
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/max2sat/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct Weighed2Sat {
}


/// This funciton is used to read an instance from file. It returns either an
/// This function is used to read an instance from file. It returns either an
/// instance if everything went on well or an error describing the problem.
pub fn read_instance<P: AsRef<Path>>(fname: P) -> Result<Weighed2Sat, Error> {
let f = File::open(fname)?;
Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/max2sat/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ use std::num::ParseIntError;
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// instance file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
}
14 changes: 7 additions & 7 deletions ddo/examples/misp/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use regex::Regex;
#[cfg(test)]
mod tests;

/// This structure represents an instance of the Maximum Idependent Set Problem.
/// This structure represents an instance of the Maximum Independent Set Problem.
/// It is this structure that implements a simple dynamic programming model for the
/// MISP. In that model, the state is simply a bitset where each bit represents
/// a node that may be kept or left out of the MIS.
Expand Down Expand Up @@ -127,7 +127,7 @@ impl Problem for Misp {
heu.iter_mut().for_each(|i| *i = 0);
}

// count the occurence of each var
// count the occurrence of each var
for s in next_layer {
for sit in s.iter() {
heu[sit] += 1;
Expand Down Expand Up @@ -162,7 +162,7 @@ impl Problem for Misp {
///
/// # Note:
/// In addition to the aforementioned two operations, the MispRelax structure implements
/// an optional `fast_upper_bound` method. Whichone provides a useful bound to
/// an optional `fast_upper_bound` method. Which one provides a useful bound to
/// prune some portions of the state-space as the decision diagrams are compiled.
/// (aka rough upper bound pruning).
pub struct MispRelax<'a>{pb: &'a Misp}
Expand Down Expand Up @@ -238,22 +238,22 @@ struct Args {
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// misp instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
/// The file was not properly formatted.
#[error("ill formed instance")]
Format,
}

/// This funciton is used to read a misp instance from file. It returns either a
/// This function is used to read a misp instance from file. It returns either a
/// misp instance if everything went on well or an error describing the problem.
fn read_instance<P: AsRef<Path>>(fname: P) -> Result<Misp, Error> {
let f = File::open(fname)?;
Expand Down Expand Up @@ -317,7 +317,7 @@ fn read_instance<P: AsRef<Path>>(fname: P) -> Result<Misp, Error> {
}

/// An utility function to return an max width heuristic that can either be a fixed width
/// policy (if w is fixed) or an adaptative policy returning the number of unassigned variables
/// policy (if w is fixed) or an adaptive policy returning the number of unassigned variables
/// in the overall problem.
fn max_width<P: Problem>(p: &P, w: Option<usize>) -> Box<dyn WidthHeuristic<P::State> + Send + Sync> {
if let Some(w) = w {
Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/psp/io_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ use crate::model::Psp;
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// psp instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
/// The file was not properly formatted.
Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/psp/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//! This example show how to implement a solver for the pigment sequencint problem
//! This example show how to implement a solver for the pigment sequencing problem
//! using ddo. It is a fairly simple example but it features most of the aspects you will
//! want to copy when implementing your own solver.

Expand Down Expand Up @@ -63,7 +63,7 @@ struct Args {
}

/// An utility function to return an max width heuristic that can either be a fixed width
/// policy (if w is fixed) or an adaptative policy returning the number of unassigned variables
/// policy (if w is fixed) or an adaptive policy returning the number of unassigned variables
/// in the overall problem.
fn max_width<P: Problem>(p: &P, w: Option<usize>) -> Box<dyn WidthHeuristic<P::State> + Send + Sync> {
if let Some(w) = w {
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/psp/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

//! This example show how to implement a solver for the pigment sequencint problem
//! This example show how to implement a solver for the pigment sequencing problem
//! using ddo. It is a fairly simple example but it features most of the aspects you will
//! want to copy when implementing your own solver.

Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/sop/io_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ pub struct SopInstance {
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// sop instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
}
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/sop/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ pub enum Previous {
/// It can either be at an actual job
Job(usize),
/// Or it can be one among a pool of jobs
/// (relaxed node == job is shroedinger's cat)
/// (relaxed node == job is Schrödinger's cat)
Virtual(BitSet),
}
2 changes: 1 addition & 1 deletion ddo/examples/srflp/io_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct SrflpInstance {
/// This enumeration simply groups the kind of errors that might occur when parsing a
/// srflp instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
Expand Down
2 changes: 1 addition & 1 deletion ddo/examples/srflp/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct Args {
}

/// An utility function to return an max width heuristic that can either be a fixed width
/// policy (if w is fixed) or an adaptative policy returning the number of unassigned variables
/// policy (if w is fixed) or an adaptive policy returning the number of unassigned variables
/// in the overall problem.
fn max_width<P: Problem>(p: &P, w: Option<usize>) -> Box<dyn WidthHeuristic<SrflpState> + Send + Sync> {
if let Some(w) = w {
Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/talentsched/io_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ use std::{num::ParseIntError, path::Path, fs::File, io::{BufReader, BufRead}};
/// This enumeration simply groups the kind of errors that might occur when parsing an
/// instance from file. There can be io errors (file unavailable ?), format error
/// (e.g. the file is not an instance but contains the text of your next paper),
/// or parse int errors (which are actually a variant of the format errror since it tells
/// or parse int errors (which are actually a variant of the format error since it tells
/// you that the parser expected an integer number but got ... something else).
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// There was an io related error
#[error("io error {0}")]
Io(#[from] std::io::Error),
/// The parser expected to read somehting that was an integer but got some garbage
/// The parser expected to read something that was an integer but got some garbage
#[error("parse int {0}")]
ParseInt(#[from] ParseIntError),
/// The file was not properly formatted.
Expand Down
Loading

0 comments on commit 0820dd4

Please sign in to comment.