AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::WitnessLP Class Reference

This class implements an easy interface to do Witness discovery through linear programming. More...

#include <AIToolbox/Utils/Polytope.hpp>

Public Member Functions

 WitnessLP (size_t S)
 Basic constructor. More...
 
void addOptimalRow (const Hyperplane &v)
 This function adds a new optimal constraint to the LP, which will not be removed unless the LP is reset. More...
 
std::optional< PointfindWitness (const Hyperplane &v)
 This function solves the currently set LP. More...
 
void reset ()
 This function resets the internal LP to only the simplex constraint. More...
 
void allocate (size_t rows)
 This function reserves space for a certain amount of rows (not counting the simplex) to avoid reallocations. More...
 

Detailed Description

This class implements an easy interface to do Witness discovery through linear programming.

Witness discovery is the process of determining whether a given Hyperplane is higher than any other; and if so, where.

This class is meant to help finding witness points by solving the linear programming needed. As such, it contains a linear programming problem where constraints can be set. This class automatically sets the simplex constraint, where a found Point's coordinates need to sum up to one.

Optimal constraints can be progressively added as soon as found. When a new constraint needs to be tested to see if a witness is available, the findWitness() function can be called.

Constructor & Destructor Documentation

◆ WitnessLP()

AIToolbox::WitnessLP::WitnessLP ( size_t  S)

Basic constructor.

This initializes lp_solve structures.

Parameters
SThe number of corners of the simplex.

Member Function Documentation

◆ addOptimalRow()

void AIToolbox::WitnessLP::addOptimalRow ( const Hyperplane v)

This function adds a new optimal constraint to the LP, which will not be removed unless the LP is reset.

This function is used to add the optimal hyperplanes.

Parameters
vThe optimal Hyperplane to add.

◆ allocate()

void AIToolbox::WitnessLP::allocate ( size_t  rows)

This function reserves space for a certain amount of rows (not counting the simplex) to avoid reallocations.

Parameters
rowsThe max number of constraints for the LP.

◆ findWitness()

std::optional<Point> AIToolbox::WitnessLP::findWitness ( const Hyperplane v)

This function solves the currently set LP.

This function tries to solve the underlying LP, and if successful returns the witness point which satisfies the solution.

Parameters
vThe Hyperplane to test against the optimal ones already added.
Returns
If found, the Point witness to the set problem.

◆ reset()

void AIToolbox::WitnessLP::reset ( )

This function resets the internal LP to only the simplex constraint.

This function does not mess with the already allocated memory.


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