Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgen-lentz committed Oct 12, 2024
1 parent 93a1452 commit c095cdf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/rampl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,12 @@ bool RAMPL::isRunning() const {
Solve the current model.
:param string problem: The problem that will be solved.
:param string solver: The solver that will be used to solve the problem.
:raises Error: If the underlying interpreter is not running.
*/
void RAMPL::solve() {
_impl.eval("solve;");
void RAMPL::solve(std::string problem = "", std::string solver = "") {
_impl.solve(problem, solver);
//return _impl.solve(); // FIXME: does not print to stdout with R IDE on Windows
}

Expand Down
2 changes: 1 addition & 1 deletion src/rampl.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class RAMPL {
void reset();
void close();
bool isRunning() const;
void solve();
void solve(std::string problem, std::string solver);

Rcpp::DataFrame getData(Rcpp::List statements) const;
SEXP getValue(std::string scalarExpression) const;
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_ampl.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ test_that("test AMPL", {
expect_equal(ampl$getSets()$S$name(), "S")
expect_equal(ampl$getParameters()$l$name(), "l")

ampl$solve()
ampl$solve("", "gurobi")
expect_equal(ampl$getObjective("obj")$value(), 5)

out <- ""
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test_that("test set instance", {
s2 <- ampl$getSet("s2")$get(c())

expect_equal(s$name(), "s")
expect_equal(s$toString(), "set s = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};")
expect_equal(s$toString(), "set s;")

# expect_equal(s$arity(), 1) # FIXME: missing in C++?
expect_equal(s$size(), 10)
Expand Down

0 comments on commit c095cdf

Please sign in to comment.