AGSol (Art Gallery Solver)  1.0.2
This package contains a software capable of optimally solving the Art Gallery Problem (AGP), one interesting NP-hard problem from the Computational Geometry field. The algorithm implemented in this solution, which can be today considered the state-of-the-art technique on the AGP, can be found in details in the following paper: Davi C. Tozoni, Pedro J. de Rezende, Cid C. de Souza. A Practical Iterative Algorithm for the Art Gallery Problem using Integer Linear Programming
 All Classes Functions
SolverPLIXpress.h
1 /*****************************************************************************
2  * This code is part of Art Gallery Solver (AGSol) Package, which aims the
3  * resolution of the Art Gallery Problem With Point Guards.
4  *
5  * This software version (1.0.2) has been tested under and is compatible with
6  * CGAL 3.9 and GLPK 4.52.
7  *
8  * Authors:
9  * Davi Colli Tozoni - davi.tozoni@gmail.com
10  * Marcelo Castilho Couto - coutomarcelo@gmail.com
11  *
12  * ArtGalleryHope Concept and Design:
13  * Davi Colli Tozoni, Marcelo Castilho Couto, Pedro Jussieu de Rezende & Cid
14  * Carvalho de Souza.
15  *
16  * Other information can be found at:
17  * http://www.ic.unicamp.br/~cid/Problem-instances/Art-Gallery/index.html
18  *
19  * --
20  *
21  * This program is free software: you can redistribute it and/or modify it
22  * under the terms of the GNU General Public License as published by the Free
23  * Software Foundation, either version 3 of the License, or (at your option)
24  * any later version.
25  *
26  * This program is distributed in the hope that it will be useful, but
27  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
28  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29  * for more details.
30  *
31  * You should have received a copy of the GNU General Public License along
32  * with this program. If not, see <http://www.gnu.org/licenses/>.
33  *
34  ****************************************************************************/
35 
36 
37 #ifndef SOLVER_PLI_XPRESS_H
38 #define SOLVER_PLI_XPRESS_H
39 
40 #include <iostream>
41 #include <string>
42 #include <cstdlib>
43 #include <vector>
44 #include "xprs.h"
45 
46 using namespace std;
47 
49  private:
50  static const int MAX_CPU_TIME = 3600;
51 
52  XPRSprob _prob;
53  double* _xStar; // saves best integer solution found
54  double _zStar; // saves best value found
55  int _nCols;
56  int _problemType;
57 
58  double _extLB;
59  bool _extLBstop;
60 
61 
62  SolverPLIXpress(); // avoid this constructor
63 
64  void errorMsg(const string, int, int);
65 
66  public:
67  static const int SET_COVER = 1;
68  static const int USE_XPRESS = 1;
69  static const int NOT_USE_XPRESS = 0;
70 
71  SolverPLIXpress(int, int, int, int, int*, int*, int*, double*, double extLB = 0.0);
72 
73  ~SolverPLIXpress(){
74  /* Frees memory */
75  int xpressRet = XPRSdestroyprob(_prob);
76  if (xpressRet) errorMsg("Main [XPRSdestroyprob]", __LINE__, xpressRet);
77 
78  xpressRet = XPRSfree();
79  if (xpressRet) errorMsg("Main [XPRSfree]", __LINE__, xpressRet);
80 
81  freeXStar();
82  }
83 
93  int loadSetCoverProblem(int, int, int*, int*, int*, double*);
94 
98  static void XPRS_CC callbackBestSolution(XPRSprob, void*);
99 
103  void solveSetCov();
104 
108  void solve();
109 
113  bool isOptimal();
114 
118  void setUB(double value);
119 
123  void setViableSolution(vector<int> solution);
124 
128  void writeProblem();
129 
133  double getZStar(){ return _zStar; }
134  double getExtLB(){ return _extLB; }
135  void setZStar(double zStar){ _zStar = zStar; }
136  int getNumCols() { return _nCols; }
137  void freeXStar() { if (_xStar != NULL) delete[] _xStar; }
138  void setXStar(double* xStar){ _xStar = xStar; }
139  double* getXStar() { return _xStar; }
140  int getProblemType() { return _problemType; }
141  void setLBstop(bool value) { _extLBstop = value;};
142 
143 };
144 
145 #endif
146 #define SOLVER_PLI_XPRESS_H
Definition: SolverPLIXpress.h:48
double getZStar()
Definition: SolverPLIXpress.h:133