TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
tmk::place::detail::Annealer Class Reference

#include <place/anneal_state.hpp>

Public Member Functions

 Annealer (const Problem &p, const std::vector< std::vector< int > > &pn, const Placement &start, const AnnealOptions &o, int stream)
std::int64_t cost () const
std::int64_t crossings () const
std::int64_t overflow () const
const Placement & current () const
double estimate_t0 (double p0)
 Initial temperature: mean uphill delta of random shift moves, accepted with probability p0.
Coord r0 () const
void run (std::uint64_t moves, std::chrono::steady_clock::time_point deadline, bool has_deadline)
 Simulated annealing with a geometric schedule over moves steps (independent-runs mode).
void sweep (Slot &s, std::uint64_t n)
 n steps at the slot's fixed temperature (parallel tempering).
void step (Slot &s)
 One step: an ordinary move at temperature t, or (with probability lns_rate, while LNS is on) an LNS window.
void set_lns (bool on)
 LNS windows are greedy (kept only if better), so they only pay off in the cold part of the schedule: the drivers switch them on for the last kLnsPhase of the budget.
bool lns_step ()
 Large-neighbourhood search: rip up a window of parts around a seed part and re-place them (exactly by branch and bound for small windows, else greedily); kept only if the cost strictly falls.
bool repair (std::vector< int > window)
WindowStats solve_window (std::vector< int > window, bool prune, long max_leaves=200 '000)
 Exact optimum of the window over its candidate set (branch and bound; prune = false enumerates every combination: the reference path).
std::vector< int > window_around (int seed, int k) const
void note_best ()
const Placement & best () const
const std::vector< Placement > & trace () const
const std::vector< double > & trace_t () const
std::int64_t best_cost () const
std::int64_t start_cost () const
std::uint64_t moves () const
std::uint64_t accepted () const
std::uint64_t illegal () const
std::uint64_t lns_tried () const
std::uint64_t lns_improved () const
bool time_limited () const
bool movable_empty () const
int movable_part (std::size_t i) const
std::size_t movable_size () const
double next ()
std::uint64_t next_u64 ()
std::int64_t evaluate (const Move &m)
 Move primitives (pl_ is modified by evaluate; follow with revert or commit).
bool legal (const Move &m) const
 n ≤ 2 only
void revert (const Move &m)
void commit (const Move &m)

Detailed Description

Definition at line 60 of file anneal_state.hpp.

Constructor & Destructor Documentation

◆ Annealer()

tmk::place::detail::Annealer::Annealer ( const Problem & p,
const std::vector< std::vector< int > > & pn,
const Placement & start,
const AnnealOptions & o,
int stream )

Member Function Documentation

◆ accepted()

std::uint64_t tmk::place::detail::Annealer::accepted ( ) const
inline

Definition at line 98 of file anneal_state.hpp.

◆ best()

const Placement & tmk::place::detail::Annealer::best ( ) const
inline

Definition at line 92 of file anneal_state.hpp.

◆ best_cost()

std::int64_t tmk::place::detail::Annealer::best_cost ( ) const
inline

Definition at line 95 of file anneal_state.hpp.

◆ commit()

void tmk::place::detail::Annealer::commit ( const Move & m)

◆ cost()

std::int64_t tmk::place::detail::Annealer::cost ( ) const
inline

Definition at line 64 of file anneal_state.hpp.

◆ crossings()

std::int64_t tmk::place::detail::Annealer::crossings ( ) const
inline

Definition at line 65 of file anneal_state.hpp.

◆ current()

const Placement & tmk::place::detail::Annealer::current ( ) const
inline

Definition at line 67 of file anneal_state.hpp.

◆ estimate_t0()

double tmk::place::detail::Annealer::estimate_t0 ( double p0)

Initial temperature: mean uphill delta of random shift moves, accepted with probability p0.

◆ evaluate()

std::int64_t tmk::place::detail::Annealer::evaluate ( const Move & m)

Move primitives (pl_ is modified by evaluate; follow with revert or commit).

◆ illegal()

std::uint64_t tmk::place::detail::Annealer::illegal ( ) const
inline

Definition at line 99 of file anneal_state.hpp.

◆ legal()

bool tmk::place::detail::Annealer::legal ( const Move & m) const

n ≤ 2 only

◆ lns_improved()

std::uint64_t tmk::place::detail::Annealer::lns_improved ( ) const
inline

Definition at line 101 of file anneal_state.hpp.

◆ lns_step()

bool tmk::place::detail::Annealer::lns_step ( )

Large-neighbourhood search: rip up a window of parts around a seed part and re-place them (exactly by branch and bound for small windows, else greedily); kept only if the cost strictly falls.

◆ lns_tried()

std::uint64_t tmk::place::detail::Annealer::lns_tried ( ) const
inline

Definition at line 100 of file anneal_state.hpp.

◆ movable_empty()

bool tmk::place::detail::Annealer::movable_empty ( ) const
inline

Definition at line 103 of file anneal_state.hpp.

◆ movable_part()

int tmk::place::detail::Annealer::movable_part ( std::size_t i) const
inline

Definition at line 104 of file anneal_state.hpp.

◆ movable_size()

std::size_t tmk::place::detail::Annealer::movable_size ( ) const
inline

Definition at line 105 of file anneal_state.hpp.

◆ moves()

std::uint64_t tmk::place::detail::Annealer::moves ( ) const
inline

Definition at line 97 of file anneal_state.hpp.

◆ next()

double tmk::place::detail::Annealer::next ( )
inline

Definition at line 106 of file anneal_state.hpp.

◆ next_u64()

std::uint64_t tmk::place::detail::Annealer::next_u64 ( )
inline

Definition at line 107 of file anneal_state.hpp.

◆ note_best()

void tmk::place::detail::Annealer::note_best ( )

◆ overflow()

std::int64_t tmk::place::detail::Annealer::overflow ( ) const
inline

Definition at line 66 of file anneal_state.hpp.

◆ r0()

Coord tmk::place::detail::Annealer::r0 ( ) const
inline

Definition at line 71 of file anneal_state.hpp.

◆ repair()

bool tmk::place::detail::Annealer::repair ( std::vector< int > window)

◆ revert()

void tmk::place::detail::Annealer::revert ( const Move & m)

◆ run()

void tmk::place::detail::Annealer::run ( std::uint64_t moves,
std::chrono::steady_clock::time_point deadline,
bool has_deadline )

Simulated annealing with a geometric schedule over moves steps (independent-runs mode).

◆ set_lns()

void tmk::place::detail::Annealer::set_lns ( bool on)
inline

LNS windows are greedy (kept only if better), so they only pay off in the cold part of the schedule: the drivers switch them on for the last kLnsPhase of the budget.

Definition at line 80 of file anneal_state.hpp.

◆ solve_window()

WindowStats tmk::place::detail::Annealer::solve_window ( std::vector< int > window,
bool prune,
long max_leaves = 200 '000 )

Exact optimum of the window over its candidate set (branch and bound; prune = false enumerates every combination: the reference path).

Applied only if strictly better.

◆ start_cost()

std::int64_t tmk::place::detail::Annealer::start_cost ( ) const
inline

Definition at line 96 of file anneal_state.hpp.

◆ step()

void tmk::place::detail::Annealer::step ( Slot & s)

One step: an ordinary move at temperature t, or (with probability lns_rate, while LNS is on) an LNS window.

◆ sweep()

void tmk::place::detail::Annealer::sweep ( Slot & s,
std::uint64_t n )

n steps at the slot's fixed temperature (parallel tempering).

◆ time_limited()

bool tmk::place::detail::Annealer::time_limited ( ) const
inline

Definition at line 102 of file anneal_state.hpp.

◆ trace()

const std::vector< Placement > & tmk::place::detail::Annealer::trace ( ) const
inline

Definition at line 93 of file anneal_state.hpp.

◆ trace_t()

const std::vector< double > & tmk::place::detail::Annealer::trace_t ( ) const
inline

Definition at line 94 of file anneal_state.hpp.

◆ window_around()

std::vector< int > tmk::place::detail::Annealer::window_around ( int seed,
int k ) const

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