Skip to content
Merged
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: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: ssciwr/doxygen-install@v1
with:
version: "1.20.0"
version: "1.12.0"
- uses: ts-graphviz/setup-graphviz@v1
- name: Prepare Doxygen Config
run: echo "PROJECT_NUMBER = ${GITHUB_REF}" >> Doxyfile
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [PR27](https://github.com/scipopt/SCIPpp/pull/27) Update to SCIP 9.2.0.

## Added

- [PR28](https://github.com/scipopt/SCIPpp/pull/28) Add `Var::getVar`.

## [1.2.0] - 2024-05-21

### Changed
Expand Down
21 changes: 20 additions & 1 deletion include/scippp/var.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,27 @@ struct Solution;
* @since 1.0.0
*/
struct Var {
//! Pointer to the underlying %SCIP variable.
/**
* Pointer to the underlying %SCIP variable.
* @deprecated since 1.3.0: Use #getVar() instead
*/
SCIP_Var* var { nullptr };

/**
* Pointer to the underlying %SCIP variable.
* @since 1.3.0
* @return underlying %SCIP variable.
*/
[[nodiscard]] SCIP_Var* getVar();

/**
* Pointer to the underlying %SCIP variable.
*
* @since 1.3.0
* @return underlying %SCIP variable.
*/
[[nodiscard]] SCIP_Var* const getVar() const;

/**
* Get the assigned value in the solution.
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion source/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void Model::addConstr(const scippp::LinIneq& ineq, const std::string& name)
ineq.m_lhs, /* left hand side of constraint */
ineq.m_rhs.has_value() ? ineq.m_rhs.value() : infinity()));
for (size_t index { 0 }; index < ineq.m_linExpr.m_vars.size(); index++) {
m_scipCallWrapper(SCIPaddCoefLinear(m_scip, con, ineq.m_linExpr.m_vars.at(index).var, ineq.m_linExpr.m_coeffs.at(index)));
m_scipCallWrapper(SCIPaddCoefLinear(m_scip, con, ineq.m_linExpr.m_vars.at(index).getVar(), ineq.m_linExpr.m_coeffs.at(index)));
}
m_scipCallWrapper(SCIPaddCons(m_scip, con));
m_cons.push_back(con);
Expand Down
11 changes: 11 additions & 0 deletions source/var.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#include "scippp/var.hpp"

#include "scippp/solution.hpp"

#include <scip/scip_numerics.h>
#include <scip/scip_sol.h>

namespace scippp {

SCIP_Var* Var::getVar()
{
return var;
}

SCIP_Var* const Var::getVar() const
{
return var;
}

double Var::getSolVal(const Solution& sol) const
{
return SCIPgetSolVal(sol.scip, sol.sol, var);
Expand Down
1 change: 1 addition & 0 deletions test/test_var.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ BOOST_AUTO_TEST_CASE(IsVoid)
{
scippp::Var x;
BOOST_TEST(x.var == nullptr);
BOOST_TEST(x.getVar() == nullptr);
BOOST_TEST(x.isVoid());

Model model("Simple");
Expand Down
Loading