delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
delpi Namespace Reference

Global namespace for the delpi library. More...

Namespaces

namespace  hash
 Namespace containing all the hash functions and utilities.
namespace  qsopt_ex
 Namespace containing all the utility functions to interact with the QSopt_ex solver.

Classes

class  ArgParser
 Used to parse command line arguments and produce a corresponding Config object to be used throughout the execution. More...
class  BufferLineSource
 A class that provides a source for lines of text buffered in memory. More...
struct  Column
 Convenient structure representing a column in the LP solver. More...
class  Config
 Simple dataclass used to store the configuration of the program. More...
class  DelpiAssertionException
 Exception for assertion failures. More...
class  DelpiException
 Base class for all exceptions in delpi. More...
class  DelpiInvalidArgumentException
 Exception for invalid arguments. More...
class  DelpiLpSolver
 Linear programming solver using a custom implementation of the Simplex algorithm. More...
class  DelpiLpSolverException
 Exception in the LP solver. More...
class  DelpiNotImplementedException
 Exception for not yet implemented features. More...
class  DelpiNotSupportedException
 Exception for not supported features. More...
class  DelpiOutOfRangeException
 Exception for out of range errors. More...
class  DelpiParserException
 Exception for parser errors. More...
class  DelpiUnreachableException
 Exception for unreachable code. More...
class  Driver
 The Driver is the base class for all the parsers. More...
class  Expression
 Represents a symbolic form of an expression. More...
class  ExpressionCell
 Symbolic expression representing an addition between linear monomials. More...
class  Formula
 Symbolic formula used to represent a constraint in the LP problem. More...
class  intrusive_ptr
 Pointer to a generic object that supports intrusive reference counting. More...
class  IterationStats
 Dataclass collecting statistics about some operation or process. More...
class  LineScanner
 LineScanner takes care of parsing the MPS file line by line, keeping an internal state and invoking the correct method of the MpsDriver. More...
class  LpSolver
 Facade class that hides the underlying LP solver used by delpi. More...
struct  LpStats
 Collection of statistics for the LP solver. More...
class  MappedFileSource
 A memory-mapped file source for efficiently reading files line by line. More...
class  OptionValue
 Represents an optional value in dLinear. More...
class  QsoptexLpSolver
 Linear programming solver using QSopt_ex. More...
struct  Row
 Structure representing a row in the LP solver in the form of a linear combination of variables. More...
class  SelfReferenceCountingObject
 Utility class to be inherited from to obtain compatibility with the intrusive_ptr. More...
struct  SolveConfiguration
class  SoplexLpSolver
 Linear programming solver using SoPlex. More...
class  Stats
 Dataclass collecting statistics about some operation or process. More...
class  Timer
 Timer class using the a steady clock. More...
class  TimerBase
 Simple timer class to evaluate the performance of the software. More...
class  TimerGuard
 The TimeGuard wraps a timer object and pauses it when the guard object is destructed. More...
struct  user_clock
 Structure that will hold the user clock data. More...
class  UserTimer
 Timer class using the user_clock. More...
class  Variable
 Real symbolic variable. More...
class  VariableMap
 Map from variables to an arbitrary type T optimised for fast access at the cost of memory. More...
class  VariableSet
 Set of variables optimised for fast access at the cost of memory. More...

Concepts

concept  MapFromTo
 Check if the type T constitutes a map from type From to type To.
concept  SelfReferenceCounter
 Check if the type T is a self-reference counter type.
concept  Iterable
 Check if the type T is an iterable type.
concept  SizedIterable
 Check if the type T is an iterable type with a size() method.
concept  TypedIterable
 Check if the type T is an iterable type with elements of type U.
concept  SizedTypedIterable
 Check if the type T is an iterable type with elements of type U and a size() method.
concept  IsAnyOf
 Check if the type T is any of the types U.
concept  IsNotAnyOf
 Check if the type T is not any of the types U.
concept  Arithmetic
 Check if the type T supports the arithmetic operations +, -, *, /.
concept  Numeric
 Check if the type T supports the arithmetic operations +, -, *, / and the comparison operators <, >, <=, >=.

Enumerations

enum class  LpResult {
  UNSOLVED , OPTIMAL , DELTA_OPTIMAL , UNBOUNDED ,
  INFEASIBLE , ERROR
}
 Possible outcomes of the LP solver. More...
enum class  LpRowSense {
  LT = 0 , EQ = 1 , LE = 2 , GE ,
  GT , NQ , IN
}
 Sense of a linear programming row describing a constraint. More...
enum class  FormulaKind {
  Eq , Neq , Gt , Geq ,
  Lt , Leq
}
 Kinds of symbolic formulas. More...

Functions

std::unique_ptr< DriverGetDriverInstance (LpSolver &lp_solver)
 Get the correct driver instance based on the actual format set in the Config.
LpResult operator~ (LpResult result)
 Relax the result of the theory solver (i.e.
bool IsFeasible (LpResult result)
 Check if the result obtained by the LpSolver implies that the problem is feasible.
int ExitCode (LpResult result)
 Convert the result in.
LpRowSense parseLpSense (char sense)
 Parse the sense from a character.
char toChar (LpRowSense sense)
 Convert the sense to a character.
LpRowSense operator! (LpRowSense sense)
 Invert the sense with delta == 0.
LpRowSense operator- (LpRowSense sense)
 Invert the sense with delta > 0.
LpRowSense operator~ (LpRowSense sense)
 Relax the sense, assuming delta > 0.e More specifically, LT -> LE, GT -> GE.
FormulaKind operator- (FormulaKind kind)
 FormulaKind that continues to match the satisfaction of the formula after both sides have been multiplied by -1.
FormulaKind operator! (FormulaKind kind)
 FormulaKind that inverts the satisfaction of the formula.
std::string GetExtension (const std::string &name)
 Get the extension of the file.
std::vector< std::string > SplitStringByWhitespace (const char *in)
 Split a C-string by whitespace.
std::vector< std::string > GetFiles (const std::string &path, const std::string &extension="")
 Get the files in a directory.
template<class T, class... Args>
Min (const T &a, const Args &... args)
 Return the minimum of the given values.
template<class T, class... Args>
Max (const T &a, const Args &... args)
 Return the maximum of the given values.
bool ichar_equals (const char a, const char b) noexcept
 Check whether two characters are equal, ignoring case.
bool ieq (std::string_view a, std::string_view b)
 Check whether two strings are the same, ignoring the case of the characters.
std::string_view nextToken (std::string_view &line) noexcept
 Given a string, find the next word token contained within ignoring all whitespaces.
std::string_view peakNextToken (const std::string_view line) noexcept
 Given a string, find the next word token contained within ignoring all whitespaces.
std::string_view trim (const std::string_view str) noexcept
 Remove leading and trailing whitespace from a string.

Detailed Description

Global namespace for the delpi library.

Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
c3054737
Author
c3054737
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
See also
Type
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)
Author
Ernesto Casablanca (casab.nosp@m.lanc.nosp@m.aerne.nosp@m.sto@.nosp@m.gmail.nosp@m..com)

Enumeration Type Documentation

◆ FormulaKind

enum class delpi::FormulaKind
strong

Kinds of symbolic formulas.

Enumerator
Eq 

=

Neq 

!=

Gt 

Geq 

>=

Lt 

<

Leq 

<=

Definition at line 14 of file FormulaKind.h.

◆ LpResult

enum class delpi::LpResult
strong

Possible outcomes of the LP solver.

Enumerator
UNSOLVED 

The solver has not yet been run.

OPTIMAL 

The problem is optimal.

DELTA_OPTIMAL 

The delta-relaxation of the problem is optimal.

UNBOUNDED 

The problem is unbounded.

INFEASIBLE 

The problem is infeasible.

ERROR 

An error occurred.

Definition at line 14 of file LpResult.h.

◆ LpRowSense

enum class delpi::LpRowSense
strong

Sense of a linear programming row describing a constraint.

If the sense is strict, it means that the variable cannot assume the right-hand-side value. When using delta complete solvers, strict senses can be relaxed to non-strict senses.

Warning
The order of the enum is important and should not be changed. It is used to compare the senses.
Enumerator
LT 

Less than.

EQ 

Equal to.

LE 

Less than or equal to.

GE 

Greater than or equal to.

GT 

Greater than.

NQ 

Not equal to.

IN 

Inactive.

Definition at line 20 of file LpRowSense.h.

Function Documentation

◆ ExitCode()

int delpi::ExitCode ( LpResult result)

Convert the result in.

Parameters
resultresult used to produce the exit code
Returns
0 if the problem is optimal, delta-optimal, unbounded or infeasible
1 if an error was detected
2 any other case

Definition at line 53 of file LpResult.cpp.

◆ GetDriverInstance()

std::unique_ptr< Driver > delpi::GetDriverInstance ( LpSolver & lp_solver)

Get the correct driver instance based on the actual format set in the Config.

Parameters
lp_solverLP solver to populate
Returns
A new instance of the correct driver based on the actual format set in the Config

Definition at line 34 of file parser.cpp.

◆ GetExtension()

std::string delpi::GetExtension ( const std::string & name)

Get the extension of the file.

Extracts the extension from name, meaning the part of the file name after the last dot.

Note
It returns an empty string if there is no extension in name.
Parameters
namename of the file
Returns
extension of the file

Definition at line 18 of file filesystem.cpp.

◆ GetFiles()

std::vector< std::string > delpi::GetFiles ( const std::string & path,
const std::string & extension = "" )

Get the files in a directory.

Parameters
pathpath to the directory
extensionfilter the selection to files that have a matching extension
Returns
vector of strings, each string being the path to each file in the directory.

Definition at line 37 of file filesystem.cpp.

◆ ichar_equals()

bool delpi::ichar_equals ( const char a,
const char b )
inlinenoexcept

Check whether two characters are equal, ignoring case.

Parameters
afirst character
bsecond character
Returns
true if the two characters are the same
false if the two characters are different

Definition at line 23 of file strings.hpp.

◆ ieq()

bool delpi::ieq ( std::string_view a,
std::string_view b )
inline

Check whether two strings are the same, ignoring the case of the characters.

Parameters
afirst string
bsecond string
Returns
true if the two strings are the same
false if the two strings are different

Definition at line 34 of file strings.hpp.

◆ IsFeasible()

bool delpi::IsFeasible ( LpResult result)

Check if the result obtained by the LpSolver implies that the problem is feasible.

Parameters
resultresult to check
Returns
true if the result implies that the problem is feasible
false if the result implies that the problem is infeasible

Definition at line 43 of file LpResult.cpp.

◆ Max()

template<class T, class... Args>
T delpi::Max ( const T & a,
const Args &... args )

Return the maximum of the given values.

Template Parameters
Ttype of the values
Parameters
afirst value
argsremaining values
Returns
maximum of the values

Definition at line 37 of file math.h.

◆ Min()

template<class T, class... Args>
T delpi::Min ( const T & a,
const Args &... args )

Return the minimum of the given values.

Template Parameters
Ttype of the values
Parameters
afirst value
argsremaining values
Returns
minimum of the values

Definition at line 21 of file math.h.

◆ nextToken()

std::string_view delpi::nextToken ( std::string_view & line)
inlinenoexcept

Given a string, find the next word token contained within ignoring all whitespaces.

Whitespace characters are defined according to the std::isspace standard function.

Warning
This function WILL modify the input string view by removing the token and all leading whitespace from it.
Parameters
linestring to check
Returns
view of a word in the string without any whitespaces. Can be emtpy if such a word does not exist.

Definition at line 43 of file strings.hpp.

◆ operator!() [1/2]

FormulaKind delpi::operator! ( FormulaKind kind)

FormulaKind that inverts the satisfaction of the formula.

Parameters
kindoriginal formula kind
Returns
inverted kind

Definition at line 28 of file FormulaKind.cpp.

◆ operator!() [2/2]

LpRowSense delpi::operator! ( LpRowSense sense)

Invert the sense with delta == 0.

More specifically, !LE == GT, !GE == LT, !EQ == NQ, !NQ == EQ, !IN == IN, !GT == LE, !LT == GE.

Warning
This is not the same as operator-()
Parameters
sensesense to invert
Returns
inverted sense
See also
operator-(LpRowSense)

Definition at line 59 of file LpRowSense.cpp.

◆ operator-() [1/2]

FormulaKind delpi::operator- ( FormulaKind kind)

FormulaKind that continues to match the satisfaction of the formula after both sides have been multiplied by -1.

Parameters
kindoriginal formula kind
Returns
negated kind

Definition at line 14 of file FormulaKind.cpp.

◆ operator-() [2/2]

LpRowSense delpi::operator- ( LpRowSense sense)

Invert the sense with delta > 0.

More specifically, -LE == GT, -GE == LE, -EQ == NQ, -NQ == EQ. Any other sense generates an assertion error

Warning
This is not the same as operator!()
Parameters
sensesense to invert
Returns
inverted sense
See also
operator!(LpRowSense)

Definition at line 80 of file LpRowSense.cpp.

◆ operator~() [1/2]

LpResult delpi::operator~ ( LpResult result)

Relax the result of the theory solver (i.e.

transform OPTIMAL to DELTA_OPTIMAL). All other results are left unchanged.

Parameters
resultresult to relax
Returns
relaxed result

Definition at line 33 of file LpResult.cpp.

◆ operator~() [2/2]

LpRowSense delpi::operator~ ( LpRowSense sense)

Relax the sense, assuming delta > 0.e More specifically, LT -> LE, GT -> GE.

The other senses remain unchanged.

Parameters
sensesense to relax
Returns
relaxed sense

Definition at line 95 of file LpRowSense.cpp.

◆ parseLpSense()

LpRowSense delpi::parseLpSense ( char sense)

Parse the sense from a character.

Parameters
sensecharacter to parse
Returns
corresponding sense

Definition at line 14 of file LpRowSense.cpp.

◆ peakNextToken()

std::string_view delpi::peakNextToken ( const std::string_view line)
inlinenoexcept

Given a string, find the next word token contained within ignoring all whitespaces.

Whitespace characters are defined according to the std::isspace standard function.

Parameters
linestring to check
Returns
view of a word in the string without any whitespaces. Can be emtpy if such a word does not exist.

Definition at line 68 of file strings.hpp.

◆ SplitStringByWhitespace()

std::vector< std::string > delpi::SplitStringByWhitespace ( const char * in)

Split a C-string by whitespace.

Each word is returned as a separate string in a vector.

Note
This function is not Unicode-aware.
The words are trimmed.
Parameters
ininput string to split
Returns
vector os strings

Definition at line 24 of file filesystem.cpp.

◆ toChar()

char delpi::toChar ( LpRowSense sense)

Convert the sense to a character.

Parameters
sensesense to convert
Returns
corresponding character

Definition at line 38 of file LpRowSense.cpp.

◆ trim()

std::string_view delpi::trim ( const std::string_view str)
inlinenoexcept

Remove leading and trailing whitespace from a string.

Whitespace characters are defined according to the std::isspace standard function.

Parameters
strstring to trim
Returns
view of the input string without leading or trailing whitespace. Can be empty if the input string is only whitespace.

Definition at line 87 of file strings.hpp.