/usr/include/coin/MP_variable.hpp is in coinor-libflopc++-dev 1.0.6-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | // ******************** FlopCpp **********************************************
// File: MP_variable.hpp
// $Id$
// Author: Tim Helge Hultberg (thh@mat.ua.pt)
// Copyright (C) 2003 Tim Helge Hultberg
// All Rights Reserved.
//****************************************************************************
#ifndef _MP_variable_hpp_
#define _MP_variable_hpp_
#include "MP_set.hpp"
#include "MP_index.hpp"
#include "MP_expression.hpp"
#include "MP_domain.hpp"
#include "MP_data.hpp"
namespace flopc {
/** @brief Enumeration for indicating variable type
@ingroup INTERNAL_USE
*/
enum variableType {continuous, discrete};
class MP_model;
class MP_variable;
/** @brief Symantic representation of a variable.
@ingroup PublicInterface
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.
*/
class MP_variable : public RowMajor, public Functor , public Named {
friend class MP_model;
friend class DisplayVariable;
friend class VariableRef;
public:
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());
void display(const std::string &s = "");
~MP_variable() {
}
/// Returns the value of the variable given the specific index values.
double level(int i1=0, int i2=0, int i3=0, int i4=0, int i5=0);
/// Interal use only.
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()
) {
return *new VariableRef(this, d1, d2, d3, d4, d5);
}
//void display(string s = "");
/// Call this method to turn the variable into a binary variable
void binary() {
upperLimit.initialize(1);
type = discrete;
}
/// Call this method to turn the MP_variable into an integer variable
void integer() {
type = discrete;
}
/// Upper bound on the variable value.
MP_data upperLimit;
/// Lower bound on the variable value.
MP_data lowerLimit;
private:
void operator()() const;
const MP_set_base *S1, *S2, *S3, *S4, *S5;
MP_index i1,i2,i3,i4,i5;
MP_model *M;
variableType type;
int offset;
};
/** Specialized subclass of MP_variable where the variable is
pre-specified to be binary.
@ingroup PublicInterface
*/
class MP_binary_variable : public MP_variable {
public:
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()) :
MP_variable(s1,s2,s3,s4,s5) {
binary();
}
};
} // End of namespace flopc
#endif
|