Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mmghannam authored Sep 17, 2023
2 parents 444895f + 667ad6c commit 3d93a06
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ jobs:
wget --quiet --no-check-certificate https://github.com/scipopt/scip/releases/download/$(echo "v${{env.version}}" | tr -d '.')/SCIPOptSuite-${{ env.version }}-Linux-ubuntu.deb
sudo apt-get update && sudo apt install -y ./SCIPOptSuite-${{ env.version }}-Linux-ubuntu.deb
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Run tests
run: cargo tarpaulin --verbose --all --out Xml
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
with:
version: '0.15.0'
args: '--verbose --all --out Xml'

- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ raw = []
[dependencies]
scip-sys = "0.1.4"
doc-comment = "0.3.3"

[dev-dependencies]
rayon = "1.5.1"
19 changes: 16 additions & 3 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl Model<ProblemCreated> {
.set_cons_modifiable(cons, modifiable)
.expect("Failed to set constraint modifiable");
}

/// Informs the SCIP instance that the objective value is always integral and returns the same `Model` instance.
pub fn set_obj_integral(mut self) -> Self {
self.scip
Expand Down Expand Up @@ -1081,11 +1081,11 @@ impl From<ObjSense> for ffi::SCIP_OBJSENSE {

#[cfg(test)]
mod tests {
use crate::status::Status;
use rayon::prelude::*;
use std::fs;
use std::path::Path;

use crate::status::Status;

use super::*;

#[test]
Expand Down Expand Up @@ -1505,4 +1505,17 @@ mod tests {

assert_eq!(model.status(), Status::TimeLimit);
}

#[test]
fn test_thread_safety() {
let statuses = (0..1000)
.into_par_iter()
.map(|_| {
let model = create_model().hide_output().solve();
model.status()
})
.collect::<Vec<_>>();

assert!(statuses.iter().all(|&s| s == Status::Optimal));
}
}

0 comments on commit 3d93a06

Please sign in to comment.