Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

abacus::OptSense Class Reference

Sense of optimization. More...

#include <ogdf/lib/abacus/optsense.h>

+ Inheritance diagram for abacus::OptSense:

Public Types

enum  SENSE { Min, Max, Unknown }
 The enumeration defining the sense of optimization. More...
 

Public Member Functions

 OptSense (SENSE s=Unknown)
 Initializes the optimization sense tos. More...
 
bool max () const
 Returns true if it is maximization problem,, false otherwise. More...
 
bool min () const
 Returns true If it is minimization problem,, false otherwise. More...
 
SENSE sense () const
 Returns the sense of the optimization. More...
 
void sense (SENSE s)
 Sets the optimization sense to s. More...
 
bool unknown () const
 Returns true if the optimization sense is unknown,, false otherwise. More...
 
- Public Member Functions inherited from abacus::AbacusRoot
virtual ~AbacusRoot ()
 The destructor. More...
 

Private Attributes

SENSE sense_
 The optimization sense. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const OptSense &rhs)
 Output operator for optimization senses. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from abacus::AbacusRoot
static bool ascii2bool (const string &str)
 Converts the string str to a boolean value. More...
 
static bool endsWith (const string &str, const string &end)
 Returns true if str ends with end, false otherwise. More...
 
static double fracPart (double x)
 Returns the absolute value of the fractional part of x. More...
 
static const char * onOff (bool value)
 Converts a boolean variable to the strings "on" and "off". More...
 

Detailed Description

Sense of optimization.

We can either minimize or maximize the objective function. We encapsulate this information in a class since it is required in various classes, e.g., in the master of the branch-and-bound algorithm and in the linear program.

Definition at line 44 of file optsense.h.

Member Enumeration Documentation

◆ SENSE

The enumeration defining the sense of optimization.

Enumerator
Min 

Minimization problem.

Max 

Maximization problem.

Unknown 

Unknown optimization sense, required to recognize uninitialized object.

Definition at line 48 of file optsense.h.

Constructor & Destructor Documentation

◆ OptSense()

abacus::OptSense::OptSense ( SENSE  s = Unknown)
inline

Initializes the optimization sense tos.

Parameters
sThe sense of the optimization. The default value is Unknown.

Definition at line 58 of file optsense.h.

Member Function Documentation

◆ max()

bool abacus::OptSense::max ( ) const
inline

Returns true if it is maximization problem,, false otherwise.

Definition at line 90 of file optsense.h.

◆ min()

bool abacus::OptSense::min ( ) const
inline

Returns true If it is minimization problem,, false otherwise.

Definition at line 84 of file optsense.h.

◆ sense() [1/2]

SENSE abacus::OptSense::sense ( ) const
inline

Returns the sense of the optimization.

Definition at line 80 of file optsense.h.

◆ sense() [2/2]

void abacus::OptSense::sense ( SENSE  s)
inline

Sets the optimization sense to s.

Parameters
sThe new sense of the optimization.

Definition at line 76 of file optsense.h.

◆ unknown()

bool abacus::OptSense::unknown ( ) const
inline

Returns true if the optimization sense is unknown,, false otherwise.

Definition at line 96 of file optsense.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const OptSense rhs 
)
friend

Output operator for optimization senses.

The output operator writes the optimization sense on an output stream in the form maximize, minimize, or unknown.

Parameters
outThe output stream.
rhsThe sense being output.
Returns
The output stream.

Member Data Documentation

◆ sense_

SENSE abacus::OptSense::sense_
private

The optimization sense.

Definition at line 102 of file optsense.h.


The documentation for this class was generated from the following file: