⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expspec_tab_cpp-source.html

📁 一个tabu search算法框架
💻 HTML
📖 第 1 页 / 共 5 页
字号:
00729         <font class="keywordflow">goto</font> yyerrlab;
00730       yyn = -yyn;
00731       <font class="keywordflow">goto</font> yyreduce;
00732     }
00733   <font class="keywordflow">else</font> <font class="keywordflow">if</font> (yyn == 0)
00734     <font class="keywordflow">goto</font> yyerrlab;
00735 
00736   <font class="keywordflow">if</font> (yyn == YYFINAL)
00737     YYACCEPT;
00738 
00739   <font class="comment">/* Shift the lookahead token.  */</font>
00740 
00741 <font class="preprocessor">#if YYDEBUG != 0</font>
00742 <font class="preprocessor"></font>  <font class="keywordflow">if</font> (yydebug)
00743     fprintf(stderr, <font class="stringliteral">"Shifting token %d (%s), "</font>, yychar, yytname[yychar1]);
00744 <font class="preprocessor">#endif</font>
00745 <font class="preprocessor"></font>
00746   <font class="comment">/* Discard the token being shifted unless it is eof.  */</font>
00747   <font class="keywordflow">if</font> (yychar != YYEOF)
00748     yychar = YYEMPTY;
00749 
00750   *++yyvsp = yylval;
00751 <font class="preprocessor">#ifdef YYLSP_NEEDED</font>
00752 <font class="preprocessor"></font>  *++yylsp = yylloc;
00753 <font class="preprocessor">#endif</font>
00754 <font class="preprocessor"></font>
00755   <font class="comment">/* count tokens shifted since error; after three, turn off error status.  */</font>
00756   <font class="keywordflow">if</font> (yyerrstatus) yyerrstatus--;
00757 
00758   yystate = yyn;
00759   <font class="keywordflow">goto</font> yynewstate;
00760 
00761 <font class="comment">/* Do the default action for the current state.  */</font>
00762 yydefault:
00763 
00764   yyn = yydefact[yystate];
00765   <font class="keywordflow">if</font> (yyn == 0)
00766     <font class="keywordflow">goto</font> yyerrlab;
00767 
00768 <font class="comment">/* Do a reduction.  yyn is the number of a rule to reduce with.  */</font>
00769 yyreduce:
00770   yylen = yyr2[yyn];
00771   <font class="keywordflow">if</font> (yylen &gt; 0)
00772     yyval = yyvsp[1-yylen]; <font class="comment">/* implement default value of the action */</font>
00773 
00774 <font class="preprocessor">#if YYDEBUG != 0</font>
00775 <font class="preprocessor"></font>  <font class="keywordflow">if</font> (yydebug)
00776     {
00777       <font class="keywordtype">int</font> i;
00778 
00779       fprintf (stderr, <font class="stringliteral">"Reducing via rule %d (line %d), "</font>,
00780                yyn, yyrline[yyn]);
00781 
00782       <font class="comment">/* Print the symbols being reduced, and their result.  */</font>
00783       <font class="keywordflow">for</font> (i = yyprhs[yyn]; yyrhs[i] &gt; 0; i++)
00784         fprintf (stderr, <font class="stringliteral">"%s "</font>, yytname[yyrhs[i]]);
00785       fprintf (stderr, <font class="stringliteral">" -&gt; %s\n"</font>, yytname[yyr1[yyn]]);
00786     }
00787 <font class="preprocessor">#endif</font>
00788 <font class="preprocessor"></font>
00789 
00790   <font class="keywordflow">switch</font> (yyn) {
00791 
00792 <font class="keywordflow">case</font> 3:
00793 <font class="preprocessor">#line 102 "ExpSpec.y"</font>
00794 <font class="preprocessor"></font>{ 
00795   <font class="comment">/* write on the output stream some header data */</font>
00796   <font class="comment">//  write_header($2);</font>
00797   <font class="comment">/* get the solver from the tester class */</font>
00798   main_tester-&gt;LoadInstance(*yyvsp[0].char_string);
00799 ;
00800     <font class="keywordflow">break</font>;}
00801 <font class="keywordflow">case</font> 5:
00802 <font class="preprocessor">#line 115 "ExpSpec.y"</font>
00803 <font class="preprocessor"></font>{
00804   main_tester-&gt;StartSolver();
00805 ;
00806     <font class="keywordflow">break</font>;}
00807 <font class="keywordflow">case</font> 12:
00808 <font class="preprocessor">#line 128 "ExpSpec.y"</font>
00809 <font class="preprocessor"></font>{
00810   main_tester-&gt;SetSolverTrials(1);
00811 ;
00812     <font class="keywordflow">break</font>;}
00813 <font class="keywordflow">case</font> 13:
00814 <font class="preprocessor">#line 132 "ExpSpec.y"</font>
00815 <font class="preprocessor"></font>{
00816   main_tester-&gt;SetSolverTrials(yyvsp[-1].natural);
00817 ;
00818     <font class="keywordflow">break</font>;}
00819 <font class="keywordflow">case</font> 14:
00820 <font class="preprocessor">#line 138 "ExpSpec.y"</font>
00821 <font class="preprocessor"></font>{;
00822     <font class="keywordflow">break</font>;}
00823 <font class="keywordflow">case</font> 15:
00824 <font class="preprocessor">#line 140 "ExpSpec.y"</font>
00825 <font class="preprocessor"></font>{
00826         main_tester-&gt;SetLogFile(*yyvsp[-1].char_string);
00827         <font class="keyword">delete</font> yyvsp[-1].char_string;
00828 ;
00829     <font class="keywordflow">break</font>;}
00830 <font class="keywordflow">case</font> 16:
00831 <font class="preprocessor">#line 146 "ExpSpec.y"</font>
00832 <font class="preprocessor"></font>{;
00833     <font class="keywordflow">break</font>;}
00834 <font class="keywordflow">case</font> 17:
00835 <font class="preprocessor">#line 148 "ExpSpec.y"</font>
00836 <font class="preprocessor"></font>{ 
00837   main_tester-&gt;SetOutputPrefix(*yyvsp[-1].char_string); 
00838   <font class="keyword">delete</font> yyvsp[-1].char_string;
00839 ;
00840     <font class="keywordflow">break</font>;}
00841 <font class="keywordflow">case</font> 18:
00842 <font class="preprocessor">#line 155 "ExpSpec.y"</font>
00843 <font class="preprocessor"></font>{;
00844     <font class="keywordflow">break</font>;}
00845 <font class="keywordflow">case</font> 19:
00846 <font class="preprocessor">#line 157 "ExpSpec.y"</font>
00847 <font class="preprocessor"></font>{ 
00848   main_tester-&gt;SetPlotPrefix(*yyvsp[-1].char_string); 
00849   <font class="keyword">delete</font> yyvsp[-1].char_string;
00850 ;
00851     <font class="keywordflow">break</font>;}
00852 <font class="keywordflow">case</font> 22:
00853 <font class="preprocessor">#line 169 "ExpSpec.y"</font>
00854 <font class="preprocessor"></font>{
00855   <font class="comment">// add runner of type hill climbing to the solver</font>
00856   <font class="keywordtype">int</font> status_value = main_tester-&gt;AddRunnerToSolver(*yyvsp[0].char_string, <font class="stringliteral">"Hill Climbing"</font>);
00857   <font class="keywordflow">if</font> (status_value  == RUNNER_NOT_FOUND)
00858     {
00859       std::string s(*yyvsp[0].char_string);
00860       s = <font class="stringliteral">"runner `"</font> + s + <font class="stringliteral">"' not found error"</font>;
00861       yyerror(s.c_str());
00862       YYABORT;
00863     }
00864   <font class="keywordflow">else</font> <font class="keywordflow">if</font> (status_value == RUNNER_TYPE_MISMATCH)
00865     {
00866       std::string s(*yyvsp[0].char_string);
00867       s = <font class="stringliteral">"runner `"</font> + s + <font class="stringliteral">"' type mismatch"</font>;
00868       yyerror(s.c_str());
00869       YYABORT;
00870     }
00871 ;
00872     <font class="keywordflow">break</font>;}
00873 <font class="keywordflow">case</font> 23:
00874 <font class="preprocessor">#line 189 "ExpSpec.y"</font>
00875 <font class="preprocessor"></font>{
00876   main_tester-&gt;SetRunningParameters(*yyvsp[-3].char_string, <font class="stringliteral">"Hill Climbing"</font>, *yyvsp[0].par_box);
00877 ;
00878     <font class="keywordflow">break</font>;}
00879 <font class="keywordflow">case</font> 25:
00880 <font class="preprocessor">#line 194 "ExpSpec.y"</font>
00881 <font class="preprocessor"></font>{
00882   <font class="comment">// add runner of type tabu search to the solver</font>
00883   <font class="keywordtype">int</font> status_value = main_tester-&gt;AddRunnerToSolver(*yyvsp[0].char_string, <font class="stringliteral">"Tabu Search"</font>);
00884   <font class="keywordflow">if</font> (status_value  == RUNNER_NOT_FOUND)
00885     {
00886       std::string s(*yyvsp[0].char_string);
00887       s = <font class="stringliteral">"runner `"</font> + s + <font class="stringliteral">"' not found error"</font>;
00888       yyerror(s.c_str());
00889       YYABORT;
00890     }
00891   <font class="keywordflow">else</font> <font class="keywordflow">if</font> (status_value == RUNNER_TYPE_MISMATCH)
00892     {
00893       std::string s(*yyvsp[0].char_string);
00894       s = <font class="stringliteral">"runner `"</font> + s + <font class="stringliteral">"' type mismatch"</font>;
00895       yyerror(s.c_str());
00896       YYABORT;
00897     }
00898 ;
00899     <font class="keywordflow">break</font>;}
00900 <font class="keywordflow">case</font> 26:
00901 <font class="preprocessor">#line 214 "ExpSpec.y"</font>
00902 <font class="preprocessor"></font>{
00903   main_tester-&gt;SetRunningParameters(*yyvsp[-3].char_string, <font class="stringliteral">"Tabu Search"</font>, *yyvsp[0].par_box);
00904 ;
00905     <font class="keywordflow">break</font>;}
00906 <font class="keywordflow">case</font> 28:
00907 <font class="preprocessor">#line 219 "ExpSpec.y"</font>
00908 <font class="preprocessor"></font>{
00909   <font class="comment">// add runner of type simulated annealing to the solver</font>
00910   <font class="keywordtype">int</font> status_value = main_tester-&gt;AddRunnerToSolver(*yyvsp[0].char_string, <font class="stringliteral">"Simulated Annealing"</font>);
00911   <font class="keywordflow">if</font> (status_value  == RUNNER_NOT_FOUND)
00912     {
00913       std::string s(*yyvsp[0].char_string);
00914       s = <font class="stringliteral">"runner `"</font> + s + <font class="stringliteral">"' not found error"</font>;
00915       yyerror(s.c_str());
00916       YYAB

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -