FLOPC++
MP_variable.hpp
Go to the documentation of this file.
1 // ******************** FlopCpp **********************************************
2 // File: MP_variable.hpp
3 // $Id$
4 // Author: Tim Helge Hultberg (thh@mat.ua.pt)
5 // Copyright (C) 2003 Tim Helge Hultberg
6 // All Rights Reserved.
7 //****************************************************************************
8 
9 #ifndef _MP_variable_hpp_
10 #define _MP_variable_hpp_
11 
12 #include "MP_set.hpp"
13 #include "MP_index.hpp"
14 #include "MP_expression.hpp"
15 #include "MP_domain.hpp"
16 #include "MP_data.hpp"
17 
18 namespace flopc {
19 
24 
25  class MP_model;
26  class MP_variable;
27 
35  class MP_variable : public RowMajor, public Functor , public Named {
36  friend class MP_model;
37  friend class DisplayVariable;
38  friend class VariableRef;
39  public:
41  const MP_set_base &s2 = MP_set::getEmpty(),
42  const MP_set_base &s3 = MP_set::getEmpty(),
43  const MP_set_base &s4 = MP_set::getEmpty(),
44  const MP_set_base &s5 = MP_set::getEmpty());
45 
46  void display(const std::string &s = "");
47 
49  }
50 
52  double level(int i1=0, int i2=0, int i3=0, int i4=0, int i5=0);
53 
56  const MP_index_exp& d1 = MP_index_exp::getEmpty(),
57  const MP_index_exp& d2 = MP_index_exp::getEmpty(),
59  const MP_index_exp& d4 = MP_index_exp::getEmpty(),
61  ) {
62  return *new VariableRef(this, d1, d2, d3, d4, d5);
63  }
64 
65  //void display(string s = "");
66 
68  void binary() {
70  type = discrete;
71  }
72 
74  void integer() {
75  type = discrete;
76  }
77 
82  private:
83  void operator()() const;
84  const MP_set_base *S1, *S2, *S3, *S4, *S5;
86 
89  int offset;
90  };
91 
97  public:
99  const MP_set_base &s2 = MP_set::getEmpty(),
100  const MP_set_base &s3 = MP_set::getEmpty(),
101  const MP_set_base &s4 = MP_set::getEmpty(),
102  const MP_set_base &s5 = MP_set::getEmpty()) :
103  MP_variable(s1,s2,s3,s4,s5) {
104  binary();
105  }
106  };
107 
108 } // End of namespace flopc
109 #endif
void operator()() const
Definition: MP_variable.cpp:42
static MP_set & getEmpty()
gets the distinct 'empty' MP_set.
Definition: MP_set.cpp:17
MP_variable(const MP_set_base &s1=MP_set::getEmpty(), const MP_set_base &s2=MP_set::getEmpty(), const MP_set_base &s3=MP_set::getEmpty(), const MP_set_base &s4=MP_set::getEmpty(), const MP_set_base &s5=MP_set::getEmpty())
Definition: MP_variable.cpp:22
const VariableRef & operator()(const MP_index_exp &d1=MP_index_exp::getEmpty(), const MP_index_exp &d2=MP_index_exp::getEmpty(), const MP_index_exp &d3=MP_index_exp::getEmpty(), const MP_index_exp &d4=MP_index_exp::getEmpty(), const MP_index_exp &d5=MP_index_exp::getEmpty())
Interal use only.
Definition: MP_variable.hpp:55
void integer()
Call this method to turn the MP_variable into an integer variable.
Definition: MP_variable.hpp:74
Representation of an index.This is one of the main public interface classes. It is used to iterate th...
Definition: MP_index.hpp:53
friend class DisplayVariable
Definition: MP_variable.hpp:37
MP_data upperLimit
Upper bound on the variable value.
Definition: MP_variable.hpp:79
void binary()
Call this method to turn the variable into a binary variable.
Definition: MP_variable.hpp:68
const MP_set_base * S1
Definition: MP_variable.hpp:84
variableType
Enumeration for indicating variable type.
Definition: MP_variable.hpp:23
void initialize(double d)
similar to value() but copies the same value to all entries.
Definition: MP_data.hpp:79
friend class VariableRef
Definition: MP_variable.hpp:38
Utility interface class for adding a string name onto a structure.
void display(const std::string &s="")
Definition: MP_variable.cpp:56
Representation of an expression involving an index.This is one of the main public interface classes...
Definition: MP_index.hpp:141
const MP_set_base * S5
Definition: MP_variable.hpp:84
static const MP_index_exp & getEmpty()
Return the unique empty expression.
Definition: MP_index.cpp:26
This is the anchor point for all constructs in a FlopC++ model.The constructors take an OsiSolverInte...
Definition: MP_model.hpp:90
All flopc++ code is contained within the flopc namespace.
Definition: flopc.cpp:11
double level(int i1=0, int i2=0, int i3=0, int i4=0, int i5=0)
Returns the value of the variable given the specific index values.
Definition: MP_variable.cpp:38
const MP_set_base * S2
Definition: MP_variable.hpp:84
MP_binary_variable(const MP_set_base &s1=MP_set::getEmpty(), const MP_set_base &s2=MP_set::getEmpty(), const MP_set_base &s3=MP_set::getEmpty(), const MP_set_base &s4=MP_set::getEmpty(), const MP_set_base &s5=MP_set::getEmpty())
Definition: MP_variable.hpp:98
Symantic representation of a variable.This is one of the main public interface classes. It should be directly declared by clients of the FlopC++. The parametersof construction are MP_set s which specify the indexes over which the variable is defined.
Definition: MP_variable.hpp:35
Function object. Often used.
Input data set.This is one of the main public interface classes. It is normally directly constructed ...
Definition: MP_data.hpp:71
const MP_set_base * S3
Definition: MP_variable.hpp:84
Internal representation of a "set".
Definition: MP_set.hpp:30
variableType type
Definition: MP_variable.hpp:88
const MP_set_base * S4
Definition: MP_variable.hpp:84
MP_data lowerLimit
Lower bound on the variable value.
Definition: MP_variable.hpp:81