Skip to content

Commit

Permalink
Merge pull request #27 from vcoppe/srflp
Browse files Browse the repository at this point in the history
  • Loading branch information
xgillard committed Jun 12, 2023
2 parents cd61f7c + fbf1ed5 commit 0bbe419
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ddo/examples/srflp/io_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn read_instance<P: AsRef<Path>>(fname: P) -> Result<SrflpInstance, Error> {
continue;
}

let data = line.replace(",", " ");
let data = line.replace(',', " ");
let mut data = data.split_ascii_whitespace();

if i == 0 {
Expand Down
4 changes: 2 additions & 2 deletions ddo/examples/srflp/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Srflp {
cut: vec![0; inst.nb_departments],
depth : 0
};
Self { instance: inst, sorted_lengths: sorted_lengths, sorted_flows: sorted_flows, initial: state }
Self { instance: inst, sorted_lengths, sorted_flows, initial: state }
}
}

Expand Down Expand Up @@ -124,7 +124,7 @@ impl Problem for Srflp {
SrflpState {
must_place: remaining,
maybe_place: maybes,
cut: cut,
cut,
depth: state.depth + 1
}
}
Expand Down
9 changes: 4 additions & 5 deletions ddo/examples/srflp/relax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Relaxation for SrflpRelax<'_> {

maybe_place = maybe_place.diff(must_place);

let maybe_place = if maybe_place.len() > 0 {
let maybe_place = if !maybe_place.is_empty() {
Some(maybe_place)
} else {
None
Expand Down Expand Up @@ -126,10 +126,9 @@ impl Relaxation for SrflpRelax<'_> {
if state.must_place.contains(i) && state.must_place.contains(j) {
flows.push(f);
} else if let Some(maybe) = state.maybe_place.as_ref() {
if state.must_place.contains(i) && maybe.contains(j) && n_flows_from_must_to_maybe_place > 0 {
flows.push(f);
n_flows_from_must_to_maybe_place -= 1;
} else if maybe.contains(i) && state.must_place.contains(j) && n_flows_from_must_to_maybe_place > 0 {
if n_flows_from_must_to_maybe_place > 0 &&
((state.must_place.contains(i) && maybe.contains(j)) ||
(maybe.contains(i) && state.must_place.contains(j))) {
flows.push(f);
n_flows_from_must_to_maybe_place -= 1;
} else if maybe.contains(i) && maybe.contains(j) && n_flows_in_maybe_place > 0 {
Expand Down

0 comments on commit 0bbe419

Please sign in to comment.