-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
70 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ jobs: | |
with: | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Run cargo-tarpaulin | ||
uses: actions-rs/[email protected] | ||
with: | ||
|
@@ -129,46 +129,4 @@ jobs: | |
components: clippy | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Check Clippy Linter | ||
run: cargo clippy --all-features --all-targets -- -D warnings | ||
|
||
# TODO: move to scip-sys repo | ||
# MacOS-test: | ||
# runs-on: macos-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# | ||
# - name: Cache dependencies (SCIPOptSuite) | ||
# id: cache-scip | ||
# uses: actions/cache@v2 | ||
# with: | ||
# path: | | ||
# ${{ runner.workspace }}/scipoptsuite | ||
# ~/Library/Caches/Homebrew/tbb--* | ||
# /usr/local/opt/tbb* | ||
# ~/Library/Caches/Homebrew/downloads/*--tbb-* | ||
# ~/Library/Caches/Homebrew/boost--* | ||
# /usr/local/opt/boost* | ||
# ~/Library/Caches/Homebrew/downloads/*--boost-* | ||
# key: ${{ runner.os }}-scipopt-${{ env.version }}-${{ hashFiles('**/lockfiles') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-scipopt-${{ env.version }}- | ||
# | ||
# - name: Install dependencies (SCIPOptSuite) | ||
# if: steps.cache-scip.outputs.cache-hit != 'true' | ||
# run: | | ||
# brew install tbb boost bison | ||
# wget --quiet --no-check-certificate https://scipopt.org/download/release/scipoptsuite-${{ env.version }}.tgz | ||
# tar xfz scipoptsuite-${{ env.version }}.tgz | ||
# cd scipoptsuite-${{ env.version }} | ||
# mkdir build | ||
# cd build | ||
# cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${{ runner.workspace }}/scipoptsuite -DIPOPT=off -DSYM=none -DTPI=tny -DREADLINE=off | ||
# make install -j | ||
# | ||
# - name: Build and test | ||
# run: | | ||
# brew install tbb boost bison | ||
# export SCIPOPTDIR=${{ runner.workspace }}/scipoptsuite/ | ||
# export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${{ runner.workspace }}/scipoptsuite/lib | ||
# cargo build | ||
# cargo test | ||
run: cargo clippy --all-features --all-targets -- -D warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use russcip::prelude::*; | ||
|
||
fn main() { | ||
// Create model | ||
let mut model = Model::new() | ||
.hide_output() | ||
.include_default_plugins() | ||
.create_prob("test") | ||
.set_obj_sense(ObjSense::Maximize); | ||
|
||
// Add variables | ||
let x1 = model.add_var(0., f64::INFINITY, 3., "x1", VarType::Integer); | ||
let x2 = model.add_var(0., f64::INFINITY, 4., "x2", VarType::Integer); | ||
|
||
// Add constraints | ||
model.add_cons( | ||
vec![x1.clone(), x2.clone()], | ||
&[2., 1.], | ||
-f64::INFINITY, | ||
100., | ||
"c1", | ||
); | ||
model.add_cons( | ||
vec![x1.clone(), x2.clone()], | ||
&[1., 2.], | ||
-f64::INFINITY, | ||
80., | ||
"c2", | ||
); | ||
|
||
let solved_model = model.solve(); | ||
|
||
let status = solved_model.status(); | ||
println!("Solved with status {:?}", status); | ||
|
||
let obj_val = solved_model.obj_val(); | ||
println!("Objective value: {}", obj_val); | ||
|
||
let sol = solved_model.best_sol().unwrap(); | ||
let vars = solved_model.vars(); | ||
|
||
for var in vars { | ||
println!("{} = {}", &var.name(), sol.val(var)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters