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 | |
~QueensSolver () | |
destructor this is the place to release the SCIP_VAR and SCIP_CONS pointers and to free the SCIP pointer afterwards | |
void | solve (void) |
solves the queens problem using SCIPsolve | |
void | disp (std::ostream &out=std::cout) |
display the solution |
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
[in] | n | the number of queens |
Definition at line 28 of file queens.cpp.
References FALSE, i, NULL, SCIP_CALL_EXC, SCIP_OBJSENSE_MAXIMIZE, SCIP_VARTYPE_BINARY, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPcreate(), SCIPcreateConsLinear(), SCIPcreateProb(), SCIPcreateVar(), SCIPgetMessagehdlr(), SCIPincludeDefaultPlugins(), SCIPmessagehdlrSetQuiet(), SCIPsetObjsense(), TRUE, and var.
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 i, SCIP_CALL_EXC, SCIPfree(), SCIPreleaseCons(), SCIPreleaseVar(), and SCIPException::what().
void QueensSolver::solve | ( | void | ) |
solves the queens problem using SCIPsolve
Definition at line 244 of file queens.cpp.
References SCIP_CALL_EXC, and SCIPsolve().
Referenced by main().
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
[in,out] | out | ostream class for output(default cout) |
Definition at line 173 of file queens.cpp.
References i, NULL, SCIPgetBestSol(), SCIPgetSolVal(), and sol.
Referenced by main().