diff --git a/src/rampl.cpp b/src/rampl.cpp index e5c44da..06965a2 100644 --- a/src/rampl.cpp +++ b/src/rampl.cpp @@ -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 } diff --git a/src/rampl.h b/src/rampl.h index df3e385..3cab5f0 100644 --- a/src/rampl.h +++ b/src/rampl.h @@ -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; diff --git a/tests/testthat/test_ampl.R b/tests/testthat/test_ampl.R index 7184a2d..9229c89 100644 --- a/tests/testthat/test_ampl.R +++ b/tests/testthat/test_ampl.R @@ -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 <- "" diff --git a/tests/testthat/test_set.R b/tests/testthat/test_set.R index 666292f..99f12b8 100644 --- a/tests/testthat/test_set.R +++ b/tests/testthat/test_set.R @@ -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)