<divclass="line"><aname="l00002"></a><spanclass="lineno"> 2</span> <spanclass="comment"> * Copyright (c) Facebook, Inc. and its affiliates.</span></div>
<divclass="line"><aname="l00004"></a><spanclass="lineno"> 4</span> <spanclass="comment"> * This source code is licensed under the MIT license found in the</span></div>
<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment">/// parameters used for the simulated annealing method</span></div>
<divclass="line"><aname="l00024"></a><spanclass="lineno"> 24</span> <spanclass="keywordtype">double</span> init_temperature; <spanclass="comment">// init probaility of accepting a bad swap</span></div>
<divclass="line"><aname="l00025"></a><spanclass="lineno"> 25</span> <spanclass="keywordtype">double</span> temperature_decay; <spanclass="comment">// at each iteration the temp is multiplied by this</span></div>
<divclass="line"><aname="l00026"></a><spanclass="lineno"> 26</span> <spanclass="keywordtype">int</span> n_iter; <spanclass="comment">// nb of iterations</span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass="keywordtype">int</span> n_redo; <spanclass="comment">// nb of runs of the simulation</span></div>
<divclass="line"><aname="l00028"></a><spanclass="lineno"> 28</span> <spanclass="keywordtype">int</span> seed; <spanclass="comment">// random seed</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="keywordtype">bool</span> only_bit_flips; <spanclass="comment">// restrict permutation changes to bit flips</span></div>
<divclass="line"><aname="l00031"></a><spanclass="lineno"> 31</span> <spanclass="keywordtype">bool</span> init_random; <spanclass="comment">// intialize with a random permutation (not identity)</span></div>
<divclass="line"><aname="l00046"></a><spanclass="lineno"> 46</span> <spanclass="comment">// what would the cost update be if iw and jw were swapped?</span></div>
<divclass="line"><aname="l00047"></a><spanclass="lineno"> 47</span> <spanclass="comment">// default implementation just computes both and computes the difference</span></div>
<divclass="line"><aname="l00060"></a><spanclass="lineno"> 60</span> <spanclass="comment">// weihgting of distances: it is more important to reproduce small</span></div>
<divclass="line"><aname="l00066"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ReproduceDistancesObjective.html#a982332b44ff32b9ae9694e374acd0aff"> 66</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="l00070"></a><spanclass="lineno"> 70</span> <spanclass="comment">// cost = quadratic difference between actual distance and Hamming distance</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> <spanclass="comment">// what would the cost update be if iw and jw were swapped?</span></div>
<divclass="line"><aname="l00074"></a><spanclass="lineno"> 74</span> <spanclass="comment">// computed in O(n) instead of O(n^2) for the full re-computation</span></div>
<divclass="line"><aname="l00097"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1SimulatedAnnealingOptimizer.html#a90edfc401372aa1a2a832b403e26bfd1"> 97</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="l00098"></a><spanclass="lineno"> 98</span> <spanclass="comment"></span> FILE *logfile; <spanclass="comment">/// logs values of the cost function</span></div>
<divclass="line"><aname="l00111"></a><spanclass="lineno"> 111</span> <spanclass="comment">// run the optimization and return the best result in best_perm</span></div>
<divclass="line"><aname="l00120"></a><spanclass="lineno"> 120</span> <spanclass="comment">/// optimizes the order of indices in a ProductQuantizer</span></div>
<divclass="line"><aname="l00126"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1PolysemousTraining.html#aeb5a523056697934972f95fd428f61efa514d33b85a240091cdd7b8efaf66a0b5"> 126</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="l00130"></a><spanclass="lineno"> 130</span> <spanclass="comment">// use 1/4 of the training points for the optimization, with</span></div>
<divclass="line"><aname="l00131"></a><spanclass="lineno"> 131</span> <spanclass="comment">// max. ntrain_permutation. If ntrain_permutation == 0: train on</span></div>
<divclass="line"><aname="l00136"></a><spanclass="lineno"> 136</span> <spanclass="comment">// filename pattern for the logging of iterations</span></div>
<divclass="line"><aname="l00142"></a><spanclass="lineno"> 142</span> <spanclass="comment"> /// reorder the centroids so that the Hamming distace becomes a</span></div>
<divclass="line"><aname="l00143"></a><spanclass="lineno"> 143</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#l00047">utils.h:47</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#l00126">PolysemousTraining.h:126</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#l00097">PolysemousTraining.h:97</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#l00105">PolysemousTraining.h:105</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#l00827">PolysemousTraining.cpp:827</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#l00121">PolysemousTraining.h:121</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#l00066">PolysemousTraining.h:66</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#l00021">PolysemousTraining.h:21</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#l00040">PolysemousTraining.h:40</a></div></div>