MCPcopy Create free account
hub / github.com/avaneev/biteopt / optimize

Method optimize

biteopt.h:1775–1820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1773 */
1774
1775 int optimize( CBiteRnd& rnd )
1776 {
1777 if( OptCount == 1 )
1778 {
1779 StallCount = Opts[ 0 ] -> optimize( rnd );
1780
1781 return( StallCount );
1782 }
1783
1784 const int sc = CurOpt -> optimize( rnd, PushOpt );
1785 LastOpt = CurOpt;
1786
1787 if( CurOpt -> getBestCost() <= BestOpt -> getBestCost() )
1788 {
1789 BestOpt = CurOpt;
1790 }
1791
1792 if( sc == 0 )
1793 {
1794 StallCount = 0;
1795 }
1796 else
1797 {
1798 StallCount++;
1799 CurOpt = PushOpt;
1800
1801 if( OptCount == 2 )
1802 {
1803 PushOpt = Opts[ CurOpt == Opts[ 0 ]];
1804 }
1805 else
1806 {
1807 while( true )
1808 {
1809 PushOpt = Opts[ rnd.getInt( OptCount )];
1810
1811 if( PushOpt != CurOpt )
1812 {
1813 break;
1814 }
1815 }
1816 }
1817 }
1818
1819 return( StallCount );
1820 }
1821
1822protected:
1823 int ParamCount; ///< The total number of internal parameter values in use.

Callers

nothing calls this directly

Calls 3

getIntMethod · 0.80
optimizeMethod · 0.45
getBestCostMethod · 0.45

Tested by

no test coverage detected