diff --git a/include/PowerTools++/Model.h b/include/PowerTools++/Model.h index 53be216..e5c37d9 100644 --- a/include/PowerTools++/Model.h +++ b/include/PowerTools++/Model.h @@ -81,7 +81,7 @@ class Model { void update_hess_link(); var_* getVar(int vid); void delVar(var_* v); - void addConstraint(Constraint c); + void addConstraint(const Constraint& c); void addConstraint(Constraint* c); void on_off(Constraint c, var& on); void on_off(var<>& v, var& on); diff --git a/include/PowerTools++/PTSolver.h b/include/PowerTools++/PTSolver.h index 42dabd3..eb833ac 100644 --- a/include/PowerTools++/PTSolver.h +++ b/include/PowerTools++/PTSolver.h @@ -39,6 +39,6 @@ class PTSolver { /* Destructor */ ~PTSolver(); - int run(int output, bool relax); + int run(int output, bool relax, int print_lvl=5); }; #endif /* defined(__PowerTools____Solver__) */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 387fd55..4fe337a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ find_library(BLAS_LIBRARIES NAMES blas coinblas PATHS ENV LIBRARY_PATH) find_library(LAPACK_LIBRARIES NAMES lapack coinlapack PATHS ENV LIBRARY_PATH) find_library(MUMPS_LIBRARIES NAMES coinmumps PATHS ENV LIBRARY_PATH) add_library(PowerTools++ ${SOURCES} ${HEADERS}) -target_link_libraries(PowerTools++ ${GUROBI_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${IPOPT_LIBRARIES} dl coinhsl coinmetis ${MUMPS_LIBRARIES}) +target_link_libraries(PowerTools++ ${GUROBI_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${IPOPT_LIBRARIES} dl) add_executable(PowerTools main.cpp) diff --git a/src/IpoptProgram.cpp b/src/IpoptProgram.cpp index e3f69f7..f3c9bcb 100644 --- a/src/IpoptProgram.cpp +++ b/src/IpoptProgram.cpp @@ -93,7 +93,7 @@ void IpoptProgram::finalize_solution( Ipopt::SolverReturn statu } // model->check_feasible(x); model->_opt = model->_obj->eval(x); - cout << "\n************** Objective Function Value = " << model->_opt << " **************" << endl; + //cout << "\n************** Objective Function Value = " << model->_opt << " **************" << endl; } bool IpoptProgram::get_bounds_info(Index n, Number* x_l, Number* x_u, diff --git a/src/Model.cpp b/src/Model.cpp index f821349..015b984 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -173,7 +173,7 @@ void Model::delVar(var_* v){ assert(false); }; -void Model::addConstraint(Constraint c_){ +void Model::addConstraint(const Constraint &c_){ Constraint* c = new Constraint(c_); _cons.push_back(c); c->set_idx(_idx_con++); diff --git a/src/PTSolver.cpp b/src/PTSolver.cpp index c9c7598..85717f1 100644 --- a/src/PTSolver.cpp +++ b/src/PTSolver.cpp @@ -66,7 +66,7 @@ void PTSolver::set_model(Model* m) { } -int PTSolver::run(int output, bool relax){ +int PTSolver::run(int output, bool relax, int print_lvl){ //GurobiProgram* grbprog; // Initialize the IpoptApplication and process the options @@ -89,7 +89,9 @@ int PTSolver::run(int output, bool relax){ // iapp.Options()->SetNumericValue("tol", 1e-6); // iapp->Options()->SetStringValue("derivative_test", "second-order"); // iapp.Options()->SetNumericValue("bound_relax_factor", 0); - // iapp.Options()->SetIntegerValue("print_level", 5); + iapp.Options()->SetIntegerValue("print_level", print_lvl); + if (print_lvl == 0) // stop printing of banner + iapp.Options()->SetStringValue("sb", "yes"); // iapp.Options()->SetStringValue("derivative_test_print_all", "yes"); status = iapp.OptimizeTNLP(tmp);