delpi
0.0.1
DElta-complete LP solver
Toggle main menu visibility
Loading...
Searching...
No Matches
qsopt_ex.h
1
11
#pragma once
12
13
#ifndef DELPI_ENABLED_QSOPTEX
14
#error QSopt_ex is not enabled. Please enable it by adding "--//tools:enable_qsoptex" to the bazel command.
15
#endif
16
17
#include <gmpxx.h>
18
19
extern
"C"
{
20
#include <qsopt_ex/QSopt_ex.h>
// IWYU pragma: export
21
}
22
23
// These #defines from <qsopt_ex/QSopt_ex.h> cause problems for us
24
// because they mess with SoPlex's enums.
25
#undef OPTIMAL
26
#undef DUAL_INFEASIBLE
27
28
#include <iosfwd>
29
#include <string>
30
32
namespace
delpi::qsopt_ex
{
33
40
mpq_class *
StringToMpqPtr
(
const
std::string &str);
46
mpq_class
StringToMpq
(
const
std::string &str);
53
mpq_class *
CStringToMpqPtr
(
const
char
str[]);
59
mpq_class
CStringToMpq
(
const
char
str[]);
60
66
class
MpqArray
{
67
public
:
72
explicit
MpqArray
(
size_t
n_elements = 0);
73
MpqArray
(
const
MpqArray
&) =
delete
;
74
MpqArray
(
MpqArray
&&) =
delete
;
75
MpqArray
&operator=(
const
MpqArray
&) =
delete
;
76
MpqArray
&operator=(
MpqArray
&&) =
delete
;
78
~MpqArray
();
79
84
operator
const
mpq_t *
const
*()
const
{
return
&
array_
; }
89
operator
mpq_t **() {
return
&(
array_
); }
90
95
operator
const
mpq_t *()
const
{
return
array_
; }
96
101
operator
mpq_t *() {
return
array_
; }
102
103
mpq_t &operator[](
const
int
idx) {
return
array_
[idx]; }
104
const
mpq_t &operator[](
const
int
idx)
const
{
return
array_
[idx]; }
105
mpq_t &operator[](
const
std::size_t idx) {
return
array_
[idx]; }
106
const
mpq_t &operator[](
const
std::size_t idx)
const
{
return
array_
[idx]; }
107
109
[[nodiscard]]
size_t
size()
const
{
return
array_
?
reinterpret_cast<
size_t
*
>
(
array_
)[-1] : 0; }
110
117
void
Resize
(
size_t
nElements);
118
119
private
:
120
mpq_t *
array_
;
121
129
void
AllocateMpqArray
(
size_t
n_elements);
130
132
void
FreeMpqArray
();
133
};
134
135
std::ostream &operator<<(std::ostream &os,
const
MpqArray
&array);
136
137
void
QSXStart();
138
void
QSXFinish();
139
140
}
// namespace delpi::qsopt_ex
141
142
#ifdef DELPI_INCLUDE_FMT
143
144
#include "delpi/util/logging.h"
145
146
OSTREAM_FORMATTER(
delpi::qsopt_ex::MpqArray
);
147
148
#endif
delpi::qsopt_ex::MpqArray
A wrapper around an array of mpq_t elements.
Definition
qsopt_ex.h:66
delpi::qsopt_ex::MpqArray::Resize
void Resize(size_t nElements)
Resize the array to have nElements elements.
Definition
qsopt_ex.cpp:64
delpi::qsopt_ex::MpqArray::array_
mpq_t * array_
array of mpq_t. It is allocated by AllocateMpqArray() and freed by FreeMpqArray().
Definition
qsopt_ex.h:120
delpi::qsopt_ex::MpqArray::~MpqArray
~MpqArray()
Destroy the MpqArray object, freeing the array.
Definition
qsopt_ex.cpp:62
delpi::qsopt_ex::MpqArray::FreeMpqArray
void FreeMpqArray()
Free the array of mpq_t.
Definition
qsopt_ex.cpp:50
delpi::qsopt_ex::MpqArray::AllocateMpqArray
void AllocateMpqArray(size_t n_elements)
Allocate the array with n_elements elements.
Definition
qsopt_ex.cpp:34
delpi::qsopt_ex::MpqArray::MpqArray
MpqArray(size_t n_elements=0)
Construct a new MpqArray object, allocating the array with n_elements elements.
Definition
qsopt_ex.cpp:60
delpi::qsopt_ex
Namespace containing all the utility functions to interact with the QSopt_ex solver.
Definition
qsopt_ex.cpp:13
delpi::qsopt_ex::StringToMpq
mpq_class StringToMpq(const std::string &str)
Convert a string to a mpq_class.
Definition
qsopt_ex.cpp:16
delpi::qsopt_ex::StringToMpqPtr
mpq_class * StringToMpqPtr(const std::string &str)
Convert a string to a mpq_class.
Definition
qsopt_ex.cpp:15
delpi::qsopt_ex::CStringToMpqPtr
mpq_class * CStringToMpqPtr(const char str[])
Convert a C-string to a mpq_class.
Definition
qsopt_ex.cpp:17
delpi::qsopt_ex::CStringToMpq
mpq_class CStringToMpq(const char str[])
Convert a string to a mpq_class.
Definition
qsopt_ex.cpp:25
delpi
libs
qsopt_ex.h
Generated by
1.17.0