Skip to content

Commit

Permalink
Add Var::getVar
Browse files Browse the repository at this point in the history
  • Loading branch information
hedtke committed Nov 8, 2024
1 parent bb9f30d commit 71e7a59
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
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]] const SCIP_Var* getVar() const;

/**
* Get the assigned value in the solution.
* @since 1.0.0
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()

Check warning on line 10 in source/var.cpp

View check run for this annotation

Codecov / codecov/patch

source/var.cpp#L10

Added line #L10 was not covered by tests
{
return var;

Check warning on line 12 in source/var.cpp

View check run for this annotation

Codecov / codecov/patch

source/var.cpp#L12

Added line #L12 was not covered by tests
}

const SCIP_Var* Var::getVar() const

Check warning on line 15 in source/var.cpp

View check run for this annotation

Codecov / codecov/patch

source/var.cpp#L15

Added line #L15 was not covered by tests
{
return var;

Check warning on line 17 in source/var.cpp

View check run for this annotation

Codecov / codecov/patch

source/var.cpp#L17

Added line #L17 was not covered by tests
}

double Var::getSolVal(const Solution& sol) const
{
return SCIPgetSolVal(sol.scip, sol.sol, var);
Expand Down

0 comments on commit 71e7a59

Please sign in to comment.