<divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * This source code is licensed under the CC-by-NC license found in the</span></div>
<divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment">// Copyright 2004-present Facebook. All Rights Reserved.</span></div>
<divclass="line"><aname="l00011"></a><spanclass="lineno"> 11</span> <spanclass="comment">// -*- c++ -*-</span></div>
<divclass="line"><aname="l00025"></a><spanclass="lineno"> 25</span> <spanclass="comment">/// parameters used for the simulated annealing method</span></div>
<divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="keywordtype">double</span> init_temperature; <spanclass="comment">// init probaility of accepting a bad swap</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="keywordtype">double</span> temperature_decay; <spanclass="comment">// at each iteration the temp is multiplied by this</span></div>
<divclass="line"><aname="l00031"></a><spanclass="lineno"> 31</span> <spanclass="keywordtype">int</span> n_iter; <spanclass="comment">// nb of iterations</span></div>
<divclass="line"><aname="l00032"></a><spanclass="lineno"> 32</span> <spanclass="keywordtype">int</span> n_redo; <spanclass="comment">// nb of runs of the simulation</span></div>
<divclass="line"><aname="l00033"></a><spanclass="lineno"> 33</span> <spanclass="keywordtype">int</span> seed; <spanclass="comment">// random seed</span></div>
<divclass="line"><aname="l00035"></a><spanclass="lineno"> 35</span> <spanclass="keywordtype">bool</span> only_bit_flips; <spanclass="comment">// restrict permutation changes to bit flips</span></div>
<divclass="line"><aname="l00036"></a><spanclass="lineno"> 36</span> <spanclass="keywordtype">bool</span> init_random; <spanclass="comment">// intialize with a random permutation (not identity)</span></div>
<divclass="line"><aname="l00051"></a><spanclass="lineno"> 51</span> <spanclass="comment">// what would the cost update be if iw and jw were swapped?</span></div>
<divclass="line"><aname="l00052"></a><spanclass="lineno"> 52</span> <spanclass="comment">// default implementation just computes both and computes the difference</span></div>
<divclass="line"><aname="l00065"></a><spanclass="lineno"> 65</span> <spanclass="comment">// weihgting of distances: it is more important to reproduce small</span></div>
<divclass="line"><aname="l00071"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ReproduceDistancesObjective.html#a982332b44ff32b9ae9694e374acd0aff"> 71</a></span> <spanclass="comment"></span> std::vector<double><aclass="code"href="structfaiss_1_1ReproduceDistancesObjective.html#a982332b44ff32b9ae9694e374acd0aff">weights</a>; <spanclass="comment">///< weights for each distance (size n^2)</span></div>
<divclass="line"><aname="l00075"></a><spanclass="lineno"> 75</span> <spanclass="comment">// cost = quadratic difference between actual distance and Hamming distance</span></div>
<divclass="line"><aname="l00078"></a><spanclass="lineno"> 78</span> <spanclass="comment">// what would the cost update be if iw and jw were swapped?</span></div>
<divclass="line"><aname="l00079"></a><spanclass="lineno"> 79</span> <spanclass="comment">// computed in O(n) instead of O(n^2) for the full re-computation</span></div>
<divclass="line"><aname="l00103"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1SimulatedAnnealingOptimizer.html#a90edfc401372aa1a2a832b403e26bfd1"> 103</a></span> <spanclass="keywordtype">int</span><aclass="code"href="structfaiss_1_1SimulatedAnnealingOptimizer.html#a90edfc401372aa1a2a832b403e26bfd1">n</a>; <spanclass="comment">///< size of the permutation</span></div>
<divclass="line"><aname="l00104"></a><spanclass="lineno"> 104</span> <spanclass="comment"></span> FILE *logfile; <spanclass="comment">/// logs values of the cost function</span></div>
<divclass="line"><aname="l00117"></a><spanclass="lineno"> 117</span> <spanclass="comment">// run the optimization and return the best result in best_perm</span></div>
<divclass="line"><aname="l00126"></a><spanclass="lineno"> 126</span> <spanclass="comment">/// optimizes the order of indices in a ProductQuantizer</span></div>
<divclass="line"><aname="l00132"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1PolysemousTraining.html#aeb5a523056697934972f95fd428f61efa514d33b85a240091cdd7b8efaf66a0b5"> 132</a></span> <spanclass="comment"></span><aclass="code"href="structfaiss_1_1PolysemousTraining.html#aeb5a523056697934972f95fd428f61efa514d33b85a240091cdd7b8efaf66a0b5">OT_Ranking_weighted_diff</a><spanclass="comment">/// same as _2, but use rank of y+ - rank of y-</span></div>
<divclass="line"><aname="l00136"></a><spanclass="lineno"> 136</span> <spanclass="comment">// use 1/4 of the training points for the optimization, with</span></div>
<divclass="line"><aname="l00137"></a><spanclass="lineno"> 137</span> <spanclass="comment">// max. ntrain_permutation. If ntrain_permutation == 0: train on</span></div>
<divclass="line"><aname="l00142"></a><spanclass="lineno"> 142</span> <spanclass="comment">// filename pattern for the logging of iterations</span></div>
<divclass="line"><aname="l00148"></a><spanclass="lineno"> 148</span> <spanclass="comment"> /// reorder the centroids so that the Hamming distace becomes a</span></div>
<divclass="line"><aname="l00149"></a><spanclass="lineno"> 149</span> <spanclass="comment"> /// good approximation of the SDC distance (called by train)</span></div>
<divclass="ttc"id="structfaiss_1_1RandomGenerator_html"><divclass="ttname"><ahref="structfaiss_1_1RandomGenerator.html">faiss::RandomGenerator</a></div><divclass="ttdoc">random generator that can be used in multithreaded contexts </div><divclass="ttdef"><b>Definition:</b><ahref="utils_8h_source.html#l00049">utils.h:49</a></div></div>
<divclass="ttc"id="structfaiss_1_1PolysemousTraining_html_aeb5a523056697934972f95fd428f61efa514d33b85a240091cdd7b8efaf66a0b5"><divclass="ttname"><ahref="structfaiss_1_1PolysemousTraining.html#aeb5a523056697934972f95fd428f61efa514d33b85a240091cdd7b8efaf66a0b5">faiss::PolysemousTraining::OT_Ranking_weighted_diff</a></div><divclass="ttdoc">same as _2, but use rank of y+ - rank of y- </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8h_source.html#l00132">PolysemousTraining.h:132</a></div></div>
<divclass="ttc"id="structfaiss_1_1SimulatedAnnealingOptimizer_html_ab258eaf892742e37dd2c3bfd3b1c39e1"><divclass="ttname"><ahref="structfaiss_1_1SimulatedAnnealingOptimizer.html#ab258eaf892742e37dd2c3bfd3b1c39e1">faiss::SimulatedAnnealingOptimizer::SimulatedAnnealingOptimizer</a></div><divclass="ttdeci">SimulatedAnnealingOptimizer(PermutationObjective *obj, const SimulatedAnnealingParameters &p)</div><divclass="ttdoc">logs values of the cost function </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8cpp_source.html#l00068">PolysemousTraining.cpp:68</a></div></div>
<divclass="ttc"id="structfaiss_1_1SimulatedAnnealingOptimizer_html_a90edfc401372aa1a2a832b403e26bfd1"><divclass="ttname"><ahref="structfaiss_1_1SimulatedAnnealingOptimizer.html#a90edfc401372aa1a2a832b403e26bfd1">faiss::SimulatedAnnealingOptimizer::n</a></div><divclass="ttdeci">int n</div><divclass="ttdoc">size of the permutation </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8h_source.html#l00103">PolysemousTraining.h:103</a></div></div>
<divclass="ttc"id="structfaiss_1_1SimulatedAnnealingOptimizer_html_aa8ff19f97482c6213b2a8ff3b190412b"><divclass="ttname"><ahref="structfaiss_1_1SimulatedAnnealingOptimizer.html#aa8ff19f97482c6213b2a8ff3b190412b">faiss::SimulatedAnnealingOptimizer::init_cost</a></div><divclass="ttdeci">double init_cost</div><divclass="ttdoc">remember intial cost of optimization </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8h_source.html#l00111">PolysemousTraining.h:111</a></div></div>
<divclass="ttc"id="structfaiss_1_1PolysemousTraining_html_a0ac61389b6fcc7f98e998d9d0cc2664a"><divclass="ttname"><ahref="structfaiss_1_1PolysemousTraining.html#a0ac61389b6fcc7f98e998d9d0cc2664a">faiss::PolysemousTraining::optimize_ranking</a></div><divclass="ttdeci">void optimize_ranking(ProductQuantizer &pq, size_t n, const float *x) const </div><divclass="ttdoc">called by optimize_pq_for_hamming </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8cpp_source.html#l00839">PolysemousTraining.cpp:839</a></div></div>
<divclass="ttc"id="structfaiss_1_1PolysemousTraining_html"><divclass="ttname"><ahref="structfaiss_1_1PolysemousTraining.html">faiss::PolysemousTraining</a></div><divclass="ttdoc">optimizes the order of indices in a ProductQuantizer </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8h_source.html#l00127">PolysemousTraining.h:127</a></div></div>
<divclass="ttc"id="structfaiss_1_1ReproduceDistancesObjective_html_a982332b44ff32b9ae9694e374acd0aff"><divclass="ttname"><ahref="structfaiss_1_1ReproduceDistancesObjective.html#a982332b44ff32b9ae9694e374acd0aff">faiss::ReproduceDistancesObjective::weights</a></div><divclass="ttdeci">std::vector< double > weights</div><divclass="ttdoc">weights for each distance (size n^2) </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8h_source.html#l00071">PolysemousTraining.h:71</a></div></div>
<divclass="ttc"id="structfaiss_1_1SimulatedAnnealingParameters_html"><divclass="ttname"><ahref="structfaiss_1_1SimulatedAnnealingParameters.html">faiss::SimulatedAnnealingParameters</a></div><divclass="ttdoc">parameters used for the simulated annealing method </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8h_source.html#l00026">PolysemousTraining.h:26</a></div></div>
<divclass="ttc"id="structfaiss_1_1PermutationObjective_html"><divclass="ttname"><ahref="structfaiss_1_1PermutationObjective.html">faiss::PermutationObjective</a></div><divclass="ttdoc">abstract class for the loss function </div><divclass="ttdef"><b>Definition:</b><ahref="PolysemousTraining_8h_source.html#l00045">PolysemousTraining.h:45</a></div></div>