AIToolbox
A library that offers tools for AI problem solving.
|
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< Point > | findWitness (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... | |
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.
AIToolbox::WitnessLP::WitnessLP | ( | size_t | S | ) |
Basic constructor.
This initializes lp_solve structures.
S | The number of corners of the simplex. |
void AIToolbox::WitnessLP::addOptimalRow | ( | const Hyperplane & | v | ) |
void AIToolbox::WitnessLP::allocate | ( | size_t | rows | ) |
This function reserves space for a certain amount of rows (not counting the simplex) to avoid reallocations.
rows | The max number of constraints for the LP. |
std::optional<Point> AIToolbox::WitnessLP::findWitness | ( | const Hyperplane & | v | ) |
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.