<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * This source code is licensed under the BSD+Patents license found in the</span></div>
<divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00009"></a><spanclass="lineno"> 9</span> <spanclass="comment">// Copyright 2004-present Facebook. All Rights Reserved.</span></div>
<divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment">// -*- c++ -*-</span></div>
<divclass="line"><aname="l00024"></a><spanclass="lineno"> 24</span> <spanclass="comment">/// parameters used for the simulated annealing method</span></div>
<divclass="line"><aname="l00028"></a><spanclass="lineno"> 28</span> <spanclass="keywordtype">double</span> init_temperature; <spanclass="comment">// init probaility of accepting a bad swap</span></div>
<divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="keywordtype">double</span> temperature_decay; <spanclass="comment">// at each iteration the temp is multiplied by this</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="keywordtype">int</span> n_iter; <spanclass="comment">// nb of iterations</span></div>
<divclass="line"><aname="l00031"></a><spanclass="lineno"> 31</span> <spanclass="keywordtype">int</span> n_redo; <spanclass="comment">// nb of runs of the simulation</span></div>
<divclass="line"><aname="l00032"></a><spanclass="lineno"> 32</span> <spanclass="keywordtype">int</span> seed; <spanclass="comment">// random seed</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span> <spanclass="keywordtype">bool</span> only_bit_flips; <spanclass="comment">// restrict permutation changes to bit flips</span></div>
<divclass="line"><aname="l00035"></a><spanclass="lineno"> 35</span> <spanclass="keywordtype">bool</span> init_random; <spanclass="comment">// intialize with a random permutation (not identity)</span></div>
<divclass="line"><aname="l00050"></a><spanclass="lineno"> 50</span> <spanclass="comment">// what would the cost update be if iw and jw were swapped?</span></div>
<divclass="line"><aname="l00051"></a><spanclass="lineno"> 51</span> <spanclass="comment">// default implementation just computes both and computes the difference</span></div>
<divclass="line"><aname="l00064"></a><spanclass="lineno"> 64</span> <spanclass="comment">// weihgting of distances: it is more important to reproduce small</span></div>
<divclass="line"><aname="l00070"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ReproduceDistancesObjective.html#a982332b44ff32b9ae9694e374acd0aff"> 70</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="l00074"></a><spanclass="lineno"> 74</span> <spanclass="comment">// cost = quadratic difference between actual distance and Hamming distance</span></div>
<divclass="line"><aname="l00077"></a><spanclass="lineno"> 77</span> <spanclass="comment">// what would the cost update be if iw and jw were swapped?</span></div>
<divclass="line"><aname="l00078"></a><spanclass="lineno"> 78</span> <spanclass="comment">// computed in O(n) instead of O(n^2) for the full re-computation</span></div>
<divclass="line"><aname="l00101"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1SimulatedAnnealingOptimizer.html#a90edfc401372aa1a2a832b403e26bfd1"> 101</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="l00102"></a><spanclass="lineno"> 102</span> <spanclass="comment"></span> FILE *logfile; <spanclass="comment">/// logs values of the cost function</span></div>
<divclass="line"><aname="l00115"></a><spanclass="lineno"> 115</span> <spanclass="comment">// run the optimization and return the best result in best_perm</span></div>
<divclass="line"><aname="l00124"></a><spanclass="lineno"> 124</span> <spanclass="comment">/// optimizes the order of indices in a ProductQuantizer</span></div>
<divclass="line"><aname="l00130"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1PolysemousTraining.html#aeb5a523056697934972f95fd428f61efa514d33b85a240091cdd7b8efaf66a0b5"> 130</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="l00134"></a><spanclass="lineno"> 134</span> <spanclass="comment">// use 1/4 of the training points for the optimization, with</span></div>
<divclass="line"><aname="l00135"></a><spanclass="lineno"> 135</span> <spanclass="comment">// max. ntrain_permutation. If ntrain_permutation == 0: train on</span></div>
<divclass="line"><aname="l00140"></a><spanclass="lineno"> 140</span> <spanclass="comment">// filename pattern for the logging of iterations</span></div>
<divclass="line"><aname="l00146"></a><spanclass="lineno"> 146</span> <spanclass="comment"> /// reorder the centroids so that the Hamming distace becomes a</span></div>
<divclass="line"><aname="l00147"></a><spanclass="lineno"> 147</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#l00048">utils.h:48</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#l00130">PolysemousTraining.h:130</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#l00067">PolysemousTraining.cpp:67</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#l00101">PolysemousTraining.h:101</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#l00109">PolysemousTraining.h:109</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#l00826">PolysemousTraining.cpp:826</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#l00125">PolysemousTraining.h:125</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#l00070">PolysemousTraining.h:70</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#l00025">PolysemousTraining.h:25</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#l00044">PolysemousTraining.h:44</a></div></div>