Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- [PR40](https://github.com/scipopt/SCIPpp/pull/40) `Model::addSolution()`, `Model::setObjsense()`, `Model::setParam()`,
and `Model::solve()` are now const member functions.
- [PR38](https://github.com/scipopt/SCIPpp/pull/38) Update to SCIP 10.0.0.

## [1.3.0] - 2025-10-08
Expand Down
10 changes: 5 additions & 5 deletions include/scippp/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Model {
//! Constraints.
std::vector<SCIP_Cons*> m_cons {};
//! Stores the return of the last %SCIP call when the default call wrapper is used.
SCIP_Retcode m_lastReturnCode;
mutable SCIP_Retcode m_lastReturnCode;
//! Wrapper for every call to %SCIP's %C %API.
std::function<void(SCIP_Retcode)> m_scipCallWrapper;

Expand Down Expand Up @@ -204,14 +204,14 @@ class Model {
* Solve the model.
* @since 1.0.0
*/
void solve();
void solve() const;

/**
* Set objective goal.
* @since 1.0.0
* @param objsense Minimize or Maximize.
*/
void setObjsense(Sense objsense);
void setObjsense(Sense objsense) const;

/**
* Returns the solution status.
Expand Down Expand Up @@ -270,7 +270,7 @@ class Model {
* @param value to set the parameter to.
*/
template <typename T, typename PT>
void setParam(params::Param<PT> parameter, T value)
void setParam(params::Param<PT> parameter, T value) const
{
auto ptValue { static_cast<PT>(value) };
const auto* cName { parameter.scipName.data() };
Expand Down Expand Up @@ -346,6 +346,6 @@ class Model {
bool completely = true,
bool checkBounds = true,
bool checkIntegrality = true,
bool checkLpRows = true);
bool checkLpRows = true) const;
};
}
6 changes: 3 additions & 3 deletions source/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ bool Model::isZero(SCIP_Real value) const
return SCIPisZero(m_scip, value);
}

void Model::solve()
void Model::solve() const
{
m_scipCallWrapper(SCIPsolve(m_scip));
}

void Model::setObjsense(Sense objsense)
void Model::setObjsense(Sense objsense) const
{
m_scipCallWrapper(SCIPsetObjsense(m_scip, static_cast<SCIP_Objsense>(objsense)));
}
Expand Down Expand Up @@ -156,7 +156,7 @@ bool Model::addSolution(
bool completely,
bool checkBounds,
bool checkIntegrality,
bool checkLpRows)
bool checkLpRows) const
{
SCIP_Sol* sol { nullptr };
m_scipCallWrapper(SCIPcreateSol(m_scip, &sol, nullptr));
Expand Down
Loading