GAMSlinks  0.4
GamsHandlerSmag.hpp
Go to the documentation of this file.
1 // Copyright (C) 2008
2 // All Rights Reserved.
3 // This code is published under the Common Public License.
4 //
5 // $Id: GamsHandlerSmag.hpp 510 2008-08-16 19:31:27Z stefan $
6 //
7 // Author: Stefan Vigerske
8 
9 #ifndef GAMSHANDLERSMAG_HPP_
10 #define GAMSHANDLERSMAG_HPP_
11 
12 #include "GamsHandler.hpp"
13 
14 #ifdef HAVE_CSTDLIB
15 #include <cstdlib>
16 #else
17 #ifdef HAVE_STDLIB_H
18 #include <stdlib.h>
19 #else
20 #error "don't have header file for stdlib"
21 #endif
22 #endif
23 
24 struct smagRec;
25 
28 class GamsHandlerSmag : public GamsHandler {
29 private:
30  smagRec* smag;
31 
32  static inline int translateMask(const PrintMask& mask);
33 
34 public:
38  GamsHandlerSmag(smagRec* smag_ = NULL) : smag(smag_) { }
39 
43  void setSmag(smagRec* smag_) { smag=smag_; }
44 
45  void print(PrintMask mask, const char* msg) const;
46 
47  void println(PrintMask mask, const char* msg) const;
48 
49  void flush(PrintMask mask=AllMask) const;
50 
51  void translateToGamsSpaceX(const double* x_, double objval_, double* x) const;
52  void translateToGamsSpaceLB(const double* lb_, double* lb) const;
53  void translateToGamsSpaceUB(const double* ub_, double* ub) const;
54  void translateFromGamsSpaceX(const double* x_, double* x) const;
55  bool translateFromGamsSpaceCol(const int* indices_, int* indices, int nr) const;
56  int translateToGamsSpaceCol(int colindex) const;
57  int translateToGamsSpaceRow(int rowindex) const;
58 
59  double getMInfinity() const;
60  double getPInfinity() const;
61 
62  int getObjSense() const;
63 
64  int getColCount() const;
65  int getColCountGams() const;
66  int getObjVariable() const;
67  int getObjRow() const;
68 
69  const char* getSystemDir() const;
70 
71  bool isDictionaryWritten() const;
72  const char* dictionaryFile() const;
73  int dictionaryVersion() const;
74 }; // class GamsHandlerSmag
75 
76 
77 #endif /*GAMSHANDLERSMAG_HPP_*/
int translateToGamsSpaceCol(int colindex) const
Translates given column index into the original gams space.
void translateToGamsSpaceX(const double *x_, double objval_, double *x) const
Translates a given point as seem by the GamsModel or smag user into the original gams space...
double getPInfinity() const
GAMS value for plus infinity.
void translateToGamsSpaceLB(const double *lb_, double *lb) const
Translates a given lower bound as seem by the GamsModel or smag user into the original gams space...
const char * dictionaryFile() const
Gives the name of a dictionary file, if any.
void translateToGamsSpaceUB(const double *ub_, double *ub) const
Translates a given upper bound as seem by the GamsModel or smag user into the original gams space...
static int translateMask(const PrintMask &mask)
const char * getSystemDir() const
Path to GAMS system.
void println(PrintMask mask, const char *msg) const
Prints the given message plus an extra newline into the GAMS output channels (log and/or status file)...
void translateFromGamsSpaceX(const double *x_, double *x) const
Translates a given point from the original gams space into what the user sees in a GamsModel or smag...
Forwards requests for output, point transformations, dictionary files, and other things to a GAMS I/O...
Definition: GamsHandler.hpp:18
Forwards requests for output and point transformations to the GAMS I/O library smag.
GamsHandlerSmag(smagRec *smag_=NULL)
Constructor.
bool isDictionaryWritten() const
Indicates whether GAMS has written a dictionary file.
double getMInfinity() const
GAMS value for minus infinity.
bool translateFromGamsSpaceCol(const int *indices_, int *indices, int nr) const
Translates given column indices from the original gams space into what the user sees in a GamsModel o...
void print(PrintMask mask, const char *msg) const
Prints the given message into the GAMS output channels (log and/or status file).
PrintMask
Distinguishing between message types.
Definition: GamsHandler.hpp:23
int getColCountGams() const
The number of columns in the original gams space.
int dictionaryVersion() const
Gives the dictionary version.
void setSmag(smagRec *smag_)
Sets SMAG Handler.
void flush(PrintMask mask=AllMask) const
Flushes the buffer of a GAMS output channel.
int getObjRow() const
The index of the objective row in the original gams space.
int getObjSense() const
Objective sense: +1 for min, -1 for max.
int getObjVariable() const
The index of the objective variable in the original gams space.
int getColCount() const
The number of columns in the possibly transformed problem space.
int translateToGamsSpaceRow(int rowindex) const
Translates given row index into the original gams space.