EllAlgo 1.6.13
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
OptimQState< A > Class Template Reference

State machine for the discrete cutting-plane method. More...

#include <cutting_plane.hpp>

Public Types

enum class  Result { Continue , NoSoln , NoMoreAlt }
 

Public Member Functions

 OptimQState (A invalid)
 Construct a new OptimQState object.
 
auto x_best () const -> const A &
 Get the best-so-far solution.
 
auto x_best () -> A &
 Get the best-so-far solution (mutable).
 
auto retry () const -> bool
 Whether the next assessment is a retry (reuse cached point).
 
void on_shrunk (A x)
 Transition on a newly obtained (shrunk) best solution.
 
auto on_update (const CutStatus status, const bool more_alt) -> Result
 Transition on the space update result.
 

Detailed Description

template<typename A>
class OptimQState< A >

State machine for the discrete cutting-plane method.

Encapsulates the mutable state of cutting_plane_optim_q: the best-so-far solution x_best and the retry phase flag. The on_update transition maps a CutStatus (plus the oracle's more_alt hint) onto a control-flow outcome.

Note
State pattern: the driver loop asks the machine for its current phase (retry), feeds it each oracle/space result, and branches only on the returned outcome. The retry/termination bookkeeping that used to be scattered through the loop now lives in one place.
Template Parameters
AArray type of the decision variables

Member Enumeration Documentation

◆ Result

template<typename A >
enum class OptimQState::Result
strong
Enumerator
Continue 
NoSoln 
NoMoreAlt 

Constructor & Destructor Documentation

◆ OptimQState()

template<typename A >
OptimQState< A >::OptimQState ( invalid)
inlineexplicit

Construct a new OptimQState object.

Parameters
[in]invalidSentinel (NaN) value for the initial x_best

Member Function Documentation

◆ on_shrunk()

template<typename A >
void OptimQState< A >::on_shrunk ( x)
inline

Transition on a newly obtained (shrunk) best solution.

Parameters
[in]xThe new best discrete point (moved in)

◆ on_update()

template<typename A >
auto OptimQState< A >::on_update ( const CutStatus  status,
const bool  more_alt 
) -> Result
inline

Transition on the space update result.

Parameters
[in]statusCutStatus returned by space.update_q
[in]more_altWhether the oracle has more alternative cuts
Returns
Result::Continue to keep iterating; NoSoln / NoMoreAlt to stop

◆ retry()

template<typename A >
auto OptimQState< A >::retry ( ) const -> bool
inline

Whether the next assessment is a retry (reuse cached point).

◆ x_best() [1/2]

template<typename A >
auto OptimQState< A >::x_best ( ) -> A&
inline

Get the best-so-far solution (mutable).

◆ x_best() [2/2]

template<typename A >
auto OptimQState< A >::x_best ( ) const -> const A&
inline

Get the best-so-far solution.


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