Scippy

SCIP

Solving Constraint Integer Programs

main.cpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program PolySCIP */
4 /* */
5 /* Copyright (C) 2012-2021 Konrad-Zuse-Zentrum */
6 /* fuer Informationstechnik Berlin */
7 /* */
8 /* PolySCIP is distributed under the terms of the ZIB Academic License. */
9 /* */
10 /* You should have received a copy of the ZIB Academic License */
11 /* along with PolySCIP; see the file LICENCE. */
12 /* */
13 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14 
15 /**
16  * @file PolySCIP/src/main.cpp
17  * @brief PolySCIP main file
18  * @author Sebastian Schenker
19  *
20  */
21 
22 #include <iostream>
23 
24 #include "polyscip.h"
25 #include "scip/def.h"
26 #include "tclap/ArgException.h"
27 
28 using polyscip::Polyscip;
29 using Status = polyscip::Polyscip::PolyscipStatus; ///< abbreviation
30 using std::cout;
31 
32 /**
33  * Main function
34  * @param argc Argument count
35  * @param argv Argument vector
36  * @return 0
37  */
38 int main(int argc, char** argv) {
39  try {
40  cout << "Starting PolySCIP...\n";
41  Polyscip polyscip(argc, (const char *const *) argv);
42  SCIP_CALL( polyscip.readProblem() );
43  SCIP_CALL( polyscip.computeNondomPoints() );
44  polyscip.printStatus();
45  auto poly_status = polyscip.getStatus();
46  if (poly_status == Status::Finished ||
47  poly_status == Status::TimeLimitReached) {
48  cout << "Number of bounded results: " << polyscip.numberOfBoundedResults() << "\n";
49  cout << "Number of unbounded results: " << polyscip.numberofUnboundedResults() << "\n";
50  if (polyscip.writeResults())
51  polyscip.writeResultsToFile();
52  else
53  polyscip.printResults();
54  }
55  assert (!polyscip.dominatedPointsFound());
56  }
57  catch (TCLAP::ArgException& e) {
58  std::cerr << "ERROR: " << e.error() << " " << e.argId() << "\n";
59  }
60  catch (TCLAP::ExitException& e) {
61  std::cerr << "\n";
62  }
63  return 0;
64 }
void writeResultsToFile() const
Definition: polyscip.cpp:1828
bool dominatedPointsFound() const
Definition: polyscip.cpp:1880
int main(int argc, char **argv)
Definition: main.cpp:38
std::size_t numberOfBoundedResults() const
Definition: polyscip.cpp:1270
std::size_t numberofUnboundedResults() const
Definition: polyscip.cpp:1278
Status if problem was solved successfully.
SCIP_RETCODE readProblem()
Definition: polyscip.cpp:1746
#define SCIP_CALL(x)
Definition: def.h:370
Class for PolySCIP solver functions.
Definition: polyscip.h:295
void printResults(std::ostream &os=std::cout) const
Definition: polyscip.cpp:1574
PolySCIP solver class.
Status if given time limit was reached.
SCIP_RETCODE computeNondomPoints()
Definition: polyscip.cpp:526
bool writeResults() const
Definition: polyscip.h:344
PolyscipStatus getStatus() const
Definition: polyscip.cpp:1262
void printStatus(std::ostream &os=std::cout) const
Definition: polyscip.cpp:492
common defines and data types used in all packages of SCIP