Detailed Description
solver class for the n-queens problem
this class implements a solver for the n-queens problem as an mip model, which will be solved using SCIP
Definition at line 34 of file queens.hpp.
solver class for the n-queens problem More...
#include <queens.hpp>
Public Member Functions | |
QueensSolver (size_t n=8) | |
constructs the BP model for the n-queens problem More... | |
~QueensSolver () | |
destructor this is the place to release the SCIP_VAR and SCIP_CONS pointers and to free the SCIP pointer afterwards More... | |
void | solve (void) |
solves the queens problem using SCIPsolve More... | |
void | disp (std::ostream &out=std::cout) |
display the solution More... | |
Constructor & Destructor Documentation
◆ QueensSolver()
scipexamples::QueensSolver::QueensSolver | ( | size_t | n = 8 | ) |
constructs the BP model for the n-queens problem
the constructor builds a BP model in scip for the n-queens problem
- Parameters
-
[in] n the number of queens
Definition at line 28 of file queens.cpp.
References FALSE, NULL, SCIP_CALL_EXC, SCIP_OBJSENSE_MAXIMIZE, SCIP_VARTYPE_BINARY, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPcreate(), SCIPcreateConsLinear(), SCIPcreateProb(), SCIPcreateVar(), SCIPgetMessagehdlr(), SCIPincludeDefaultPlugins(), SCIPmessagehdlrSetQuiet(), SCIPsetObjsense(), and TRUE.
◆ ~QueensSolver()
scipexamples::QueensSolver::~QueensSolver | ( | void | ) |
destructor this is the place to release the SCIP_VAR and SCIP_CONS pointers and to free the SCIP pointer afterwards
Definition at line 210 of file queens.cpp.
References SCIP_CALL_EXC, SCIPfree(), SCIPreleaseCons(), and SCIPreleaseVar().
Member Function Documentation
◆ solve()
void QueensSolver::solve | ( | void | ) |
solves the queens problem using SCIPsolve
Definition at line 231 of file queens.cpp.
References SCIP_CALL_EXC, and SCIPsolve().
Referenced by main().
◆ disp()
void scipexamples::QueensSolver::disp | ( | std::ostream & | out = std::cout | ) |
display the solution
a simplex ASCII output function to display the solution of the n - queens problem
- Parameters
-
[in,out] out ostream class for output(default cout)
Definition at line 173 of file queens.cpp.
References NULL, SCIPgetBestSol(), and SCIPgetSolVal().
Referenced by main().