idol
A C++ Framework for Optimization
Loading...
Searching...
No Matches
Types.h
1//
2// Created by henri on 07/09/22.
3//
4
5#ifndef OPTIMIZE_TYPES_H
6#define OPTIMIZE_TYPES_H
7
8#include "idol/general/utils/exceptions/Exception.h"
9
10namespace idol {
11
12 enum VarType : int {
13 Continuous,
14 Integer,
15 Binary
16 };
17
18 enum CtrType : int {
19 LessOrEqual,
20 GreaterOrEqual,
21 Equal
22 };
23
24 enum ObjectiveSense : int {
25 Minimize,
26 Maximize
27 };
28
29 static std::ostream &operator<<(std::ostream &t_os, VarType t_type) {
30 switch (t_type) {
31 case Continuous:
32 return t_os << "Continuous";
33 case Integer:
34 return t_os << "Integer";
35 case Binary:
36 return t_os << "Binary";
37 default:;
38 }
39 throw Exception("Enum out of bounds.");
40 }
41
42 static std::ostream &operator<<(std::ostream &t_os, CtrType t_type) {
43 switch (t_type) {
44 case LessOrEqual:
45 return t_os << "<=";
46 case GreaterOrEqual:
47 return t_os << ">=";
48 case Equal:
49 return t_os << "=";
50 default:;
51 }
52 throw Exception("Enum out of bounds.");
53 }
54
55 static std::ostream &operator<<(std::ostream &t_os, ObjectiveSense t_type) {
56 switch (t_type) {
57 case Minimize:
58 return t_os << "Minimize";
59 case Maximize:
60 return t_os << "Maximize";
61 default:;
62 }
63 throw Exception("Enum out of bounds.");
64 }
65
66}
67
68#endif //OPTIMIZE_TYPES_H