Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > df736a3bc446df5b16150bebb7296274 > files > 122

DSDP-devel-5.8-2.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>DSDP: src/solver/dsdpprintout.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">DSDP</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_23046874d7fed141927c769a66d8e3a5.html">src</a>      </li>
      <li class="navelem"><a class="el" href="dir_03c647d51c93e018646ff83aa2eeb169.html">solver</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dsdpprintout.c</div>  </div>
</div>
<div class="contents">
<a href="dsdpprintout_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &quot;<a class="code" href="dsdp5_8h.html" title="The API to DSDP for those applications using DSDP as a subroutine library.">dsdp5.h</a>&quot;</span>
<a name="l00007"></a>00007 <span class="keyword">static</span> <span class="keywordtype">int</span> dsdpprintlevel=0;
<a name="l00008"></a>00008 <span class="keyword">static</span> <span class="keywordtype">int</span> dsdpprintlevel2=0;
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#undef __FUNCT__  </span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPPrintStats&quot;</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPPrintStatsFile(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">void</span> *dummy){
<a name="l00013"></a>00013   
<a name="l00014"></a>00014   <span class="keywordtype">double</span> ppobj,ddobj,pstp,dstp,mu,res,pinfeas,pnorm;
<a name="l00015"></a>00015   <span class="keywordtype">int</span> iter,info;
<a name="l00016"></a>00016   <span class="keywordtype">int</span> printlevel=dsdpprintlevel2;
<a name="l00017"></a>00017   <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3a" title="There are many reasons to terminate the solver.">DSDPTerminationReason</a> reason;
<a name="l00018"></a>00018 
<a name="l00019"></a>00019   <span class="keywordflow">if</span>(printlevel&lt;=0) <span class="keywordflow">return</span>(0);
<a name="l00020"></a>00020   <span class="keywordflow">if</span>(!dsdpoutputfile) <span class="keywordflow">return</span>(0);
<a name="l00021"></a>00021   
<a name="l00022"></a>00022   info = <a class="code" href="group__DSDPConverge.html#ga637bf541e030c5aef4d436a9792714a2" title="Copy the reason why the solver terminated.">DSDPStopReason</a>(dsdp,&amp;reason);DSDPCHKERR(info);
<a name="l00023"></a>00023   info = <a class="code" href="group__DSDPConverge.html#gaaeaa2ec0c50c43f4499aaffea692ede8" title="Copy the current iteration number.">DSDPGetIts</a>(dsdp,&amp;iter);DSDPCHKERR(info);
<a name="l00024"></a>00024   
<a name="l00025"></a>00025   <span class="keywordflow">if</span>( (reason!=<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa1eff5fd2a15ae3ba9ba57eb0db8db618">CONTINUE_ITERATING</a>) || ((iter % printlevel)==0)){
<a name="l00026"></a>00026     info = <a class="code" href="group__DSDPSolution.html#gadb9e055ef8b2194ae67ed14ca06f1d01" title="Copy the objective value (DD).">DSDPGetDDObjective</a>(dsdp,&amp;ddobj); DSDPCHKERR(info);
<a name="l00027"></a>00027     info = <a class="code" href="group__DSDPSolution.html#gad603533b7e28587f5b2ee824eee58eb3" title="Copy the objective value (PP).">DSDPGetPPObjective</a>(dsdp,&amp;ppobj); DSDPCHKERR(info);
<a name="l00028"></a>00028     info = <a class="code" href="group__DSDPSolution.html#gacfa8e29ecd7eaaeb6a4e31eb07961de3" title="Copy the infeasibility in (D), or the variable r in (DD).">DSDPGetR</a>(dsdp,&amp;res); DSDPCHKERR(info);
<a name="l00029"></a>00029     info = <a class="code" href="group__DSDPConverge.html#ga88aa3c65b2eb3699f6c2d203c3f11963" title="Copy the infeasibility in (P).">DSDPGetPInfeasibility</a>(dsdp,&amp;pinfeas); DSDPCHKERR(info);
<a name="l00030"></a>00030     info = <a class="code" href="group__DSDPSolution.html#gadf4655c90ede45912f2e4ce7f4475cad" title="Copy the step sizes in the current iteration.">DSDPGetStepLengths</a>(dsdp,&amp;pstp,&amp;dstp); DSDPCHKERR(info);
<a name="l00031"></a>00031     info = <a class="code" href="group__DSDPSolver.html#ga05f1269e817495e448ffa8ae3a4012cf" title="Copy the current barrier parameter.">DSDPGetBarrierParameter</a>(dsdp,&amp;mu); DSDPCHKERR(info);
<a name="l00032"></a>00032     info = <a class="code" href="group__DSDPSolution.html#gaaa2bb03bf7a025936b1d2cd619327a49" title="Copy the proximity of the solution to the central path.">DSDPGetPnorm</a>(dsdp,&amp;pnorm); DSDPCHKERR(info);
<a name="l00033"></a>00033     <span class="keywordflow">if</span> (reason==<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa1eff5fd2a15ae3ba9ba57eb0db8db618">CONTINUE_ITERATING</a> &amp;&amp; iter&gt;100 &amp;&amp; iter%10!=0) <span class="keywordflow">return</span> 0;
<a name="l00034"></a>00034 
<a name="l00035"></a>00035     <span class="keywordflow">if</span> (iter==0){
<a name="l00036"></a>00036       fprintf(dsdpoutputfile,<span class="stringliteral">&quot;Iter   PP Objective      DD Objective    PInfeas  DInfeas     Mu     StepLength   Pnrm\n&quot;</span>);
<a name="l00037"></a>00037       fprintf(dsdpoutputfile,<span class="stringliteral">&quot;--------------------------------------------------------------------------------------\n&quot;</span>);
<a name="l00038"></a>00038     }
<a name="l00039"></a>00039     fprintf(dsdpoutputfile,<span class="stringliteral">&quot;%-3d %16.8e  %16.8e %9.1e %9.1e %9.1e&quot;</span>,iter,ppobj,ddobj,pinfeas,res,mu);
<a name="l00040"></a>00040     fprintf(dsdpoutputfile,<span class="stringliteral">&quot;  %4.2f  %4.2f&quot;</span>,pstp,dstp);
<a name="l00041"></a>00041     <span class="keywordflow">if</span> (pnorm&gt;1.0e3){
<a name="l00042"></a>00042       fprintf(dsdpoutputfile,<span class="stringliteral">&quot;  %1.0e \n&quot;</span>,pnorm);
<a name="l00043"></a>00043     } <span class="keywordflow">else</span> {
<a name="l00044"></a>00044       fprintf(dsdpoutputfile,<span class="stringliteral">&quot;  %5.2f \n&quot;</span>,pnorm);
<a name="l00045"></a>00045     }
<a name="l00046"></a>00046     
<a name="l00047"></a>00047   }
<a name="l00048"></a>00048   <span class="keywordflow">return</span> 0;
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="preprocessor">#undef __FUNCT__  </span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPSetStandardMonitor&quot;</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="keywordtype">int</span> DSDPSetFileMonitor(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">int</span> printlevel){
<a name="l00054"></a>00054   <span class="keywordtype">int</span> info;
<a name="l00055"></a>00055   dsdpprintlevel2=printlevel;
<a name="l00056"></a>00056   info=<a class="code" href="group__DSDPSolver.html#ga888dd07a4f1c8def3f1708582baa07a4" title="Monitor each iteration of the solver.">DSDPSetMonitor</a>(dsdp,DSDPPrintStatsFile,0); DSDPCHKERR(info);
<a name="l00057"></a>00057   <span class="keywordflow">return</span> (0);
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 
<a name="l00069"></a>00069 <span class="preprocessor">#undef __FUNCT__  </span>
<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPPrintStats&quot;</span>
<a name="l00071"></a><a class="code" href="group__DSDPSolver.html#gafff1eae59a82f7d94915e6388a1c5fa9">00071</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="group__DSDPSolver.html#gafff1eae59a82f7d94915e6388a1c5fa9" title="Print statistics about the current solution to standard output.">DSDPPrintStats</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">void</span> *dummy){
<a name="l00072"></a>00072   
<a name="l00073"></a>00073   <span class="keywordtype">double</span> ppobj,ddobj,pstp,dstp,mu,res,pinfeas,pnorm;
<a name="l00074"></a>00074   <span class="keywordtype">int</span> iter,info;
<a name="l00075"></a>00075   <span class="keywordtype">int</span> printlevel=dsdpprintlevel;
<a name="l00076"></a>00076   <a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3a" title="There are many reasons to terminate the solver.">DSDPTerminationReason</a> reason;
<a name="l00077"></a>00077 
<a name="l00078"></a>00078   <span class="keywordflow">if</span>(printlevel&lt;=0) <span class="keywordflow">return</span>(0);
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   info = <a class="code" href="group__DSDPConverge.html#ga637bf541e030c5aef4d436a9792714a2" title="Copy the reason why the solver terminated.">DSDPStopReason</a>(dsdp,&amp;reason);DSDPCHKERR(info);
<a name="l00081"></a>00081   info = <a class="code" href="group__DSDPConverge.html#gaaeaa2ec0c50c43f4499aaffea692ede8" title="Copy the current iteration number.">DSDPGetIts</a>(dsdp,&amp;iter);DSDPCHKERR(info);
<a name="l00082"></a>00082 
<a name="l00083"></a>00083   <span class="keywordflow">if</span>( (reason!=<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa1eff5fd2a15ae3ba9ba57eb0db8db618">CONTINUE_ITERATING</a>) || ((iter % printlevel)==0)){
<a name="l00084"></a>00084     info = <a class="code" href="group__DSDPSolution.html#gadb9e055ef8b2194ae67ed14ca06f1d01" title="Copy the objective value (DD).">DSDPGetDDObjective</a>(dsdp,&amp;ddobj); DSDPCHKERR(info);
<a name="l00085"></a>00085     info = <a class="code" href="group__DSDPSolution.html#gad603533b7e28587f5b2ee824eee58eb3" title="Copy the objective value (PP).">DSDPGetPPObjective</a>(dsdp,&amp;ppobj); DSDPCHKERR(info);
<a name="l00086"></a>00086     info = <a class="code" href="group__DSDPSolution.html#gacfa8e29ecd7eaaeb6a4e31eb07961de3" title="Copy the infeasibility in (D), or the variable r in (DD).">DSDPGetR</a>(dsdp,&amp;res); DSDPCHKERR(info);
<a name="l00087"></a>00087     info = <a class="code" href="group__DSDPConverge.html#ga88aa3c65b2eb3699f6c2d203c3f11963" title="Copy the infeasibility in (P).">DSDPGetPInfeasibility</a>(dsdp,&amp;pinfeas); DSDPCHKERR(info);
<a name="l00088"></a>00088     info = <a class="code" href="group__DSDPSolution.html#gadf4655c90ede45912f2e4ce7f4475cad" title="Copy the step sizes in the current iteration.">DSDPGetStepLengths</a>(dsdp,&amp;pstp,&amp;dstp); DSDPCHKERR(info);
<a name="l00089"></a>00089     info = <a class="code" href="group__DSDPSolver.html#ga05f1269e817495e448ffa8ae3a4012cf" title="Copy the current barrier parameter.">DSDPGetBarrierParameter</a>(dsdp,&amp;mu); DSDPCHKERR(info);
<a name="l00090"></a>00090     info = <a class="code" href="group__DSDPSolution.html#gaaa2bb03bf7a025936b1d2cd619327a49" title="Copy the proximity of the solution to the central path.">DSDPGetPnorm</a>(dsdp,&amp;pnorm); DSDPCHKERR(info);
<a name="l00091"></a>00091     <span class="keywordflow">if</span> (0 &amp;&amp; reason==<a class="code" href="dsdpbasictypes_8h.html#a2a68c4cccb1289043bf9b59a58f55b3aa1eff5fd2a15ae3ba9ba57eb0db8db618">CONTINUE_ITERATING</a> &amp;&amp; iter&gt;100 &amp;&amp; iter%10!=0) <span class="keywordflow">return</span> 0;
<a name="l00092"></a>00092 
<a name="l00093"></a>00093     <span class="keywordflow">if</span> (iter==0){
<a name="l00094"></a>00094       printf(<span class="stringliteral">&quot;Iter   PP Objective      DD Objective    PInfeas   DInfeas     Nu     StepLength   Pnrm\n&quot;</span>)
<a name="l00095"></a>00095         ;
<a name="l00096"></a>00096       printf(<span class="stringliteral">&quot;---------------------------------------------------------------------------------------\n&quot;</span>)
<a name="l00097"></a>00097         ;
<a name="l00098"></a>00098     }
<a name="l00099"></a>00099     printf(<span class="stringliteral">&quot;%-3d %16.8e  %16.8e %9.1e %9.1e %9.1e&quot;</span>,iter,ppobj,ddobj,pinfeas,res,mu);
<a name="l00100"></a>00100     printf(<span class="stringliteral">&quot;  %4.2f  %4.2f&quot;</span>,pstp,dstp);
<a name="l00101"></a>00101     <span class="keywordflow">if</span> (pnorm&gt;1.0e3){
<a name="l00102"></a>00102       printf(<span class="stringliteral">&quot;  %1.0e \n&quot;</span>,pnorm);
<a name="l00103"></a>00103     } <span class="keywordflow">else</span> {
<a name="l00104"></a>00104       printf(<span class="stringliteral">&quot;  %5.2f \n&quot;</span>,pnorm);
<a name="l00105"></a>00105     }
<a name="l00106"></a>00106     fflush(NULL);
<a name="l00107"></a>00107   }
<a name="l00108"></a>00108   <span class="keywordflow">return</span> 0;
<a name="l00109"></a>00109 }
<a name="l00110"></a>00110 
<a name="l00151"></a>00151 <span class="preprocessor">#undef __FUNCT__  </span>
<a name="l00152"></a>00152 <span class="preprocessor"></span><span class="preprocessor">#define __FUNCT__ &quot;DSDPSetStandardMonitor&quot;</span>
<a name="l00153"></a><a class="code" href="group__DSDPBasic.html#ga945023e6d663d0897d3d04a7d738608d">00153</a> <span class="preprocessor"></span><span class="keywordtype">int</span> <a class="code" href="group__DSDPBasic.html#ga945023e6d663d0897d3d04a7d738608d" title="Print at every kth iteration.">DSDPSetStandardMonitor</a>(<a class="code" href="structDSDP__C.html" title="Internal structures for the DSDP solver.">DSDP</a> dsdp, <span class="keywordtype">int</span> k){
<a name="l00154"></a>00154   <span class="keywordtype">int</span> info;
<a name="l00155"></a>00155   info=<a class="code" href="group__DSDPSolver.html#ga888dd07a4f1c8def3f1708582baa07a4" title="Monitor each iteration of the solver.">DSDPSetMonitor</a>(dsdp,<a class="code" href="group__DSDPSolver.html#gafff1eae59a82f7d94915e6388a1c5fa9" title="Print statistics about the current solution to standard output.">DSDPPrintStats</a>,0); DSDPCHKERR(info);
<a name="l00156"></a>00156   dsdpprintlevel=k;
<a name="l00157"></a>00157   <span class="keywordflow">return</span> (0);
<a name="l00158"></a>00158 }
<a name="l00159"></a>00159 
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Jun 8 2011 for DSDP by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>