Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 54cac1c2268db633d66eeff1b4faa585 > files > 565

frepple-doc-0.8.1-3.fc15.noarch.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>C++ API frePPLe: solverbuffer.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="../styles.css" rel="stylesheet"  type="text/css">
</head>
<body>
<div id="container">

<div id="menubar"> 
<div id="logo" align="center">
<br/><img src='../frepple.bmp' alt="frepple" /><br/>
<a href='http://www.frepple.com/'>
<strong>a Free<br/>Production Planning<br/>Library</strong>
</a>
</div>
<div id="menu">
<br/>
<h3><a href='../Main/HomePage.html'>Main</a></h3>
<h3><a href='../UI/Main.html'>User Manual</a></h3>
<h3><a href='../Tutorial/Main.html'>Tutorial</a></h3>
<h3><a href='../Frepple/Main.html'>Reference Manual</a></h3>
<h3><a href='../Main/FAQ.html'>FAQ</a></h3>
<h3><a href='index.html'>C++ API</a></h3>
<br/>
</div>  
</div>

<div id="content">
<br/>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</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 class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_88117dff2735251a69c8eb9084477714.html">src</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_f53ab566a495928d11ba5681eabceaaf.html">solver</a>
  </div>
</div>
<div class="contents">
<h1>solverbuffer.cpp</h1><a href="a00240.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">  file : $URL: https://frepple.svn.sourceforge.net/svnroot/frepple/trunk/src/solver/solverbuffer.cpp $</span>
<a name="l00003"></a>00003 <span class="comment">  version : $LastChangedRevision: 1315 $  $LastChangedBy: jdetaeye $</span>
<a name="l00004"></a>00004 <span class="comment">  date : $LastChangedDate: 2010-07-17 18:08:53 +0200 (Sat, 17 Jul 2010) $</span>
<a name="l00005"></a>00005 <span class="comment"> ***************************************************************************/</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="comment">/***************************************************************************</span>
<a name="l00008"></a>00008 <span class="comment"> *                                                                         *</span>
<a name="l00009"></a>00009 <span class="comment"> * Copyright (C) 2007-2010 by Johan De Taeye                               *</span>
<a name="l00010"></a>00010 <span class="comment"> *                                                                         *</span>
<a name="l00011"></a>00011 <span class="comment"> * This library is free software; you can redistribute it and/or modify it *</span>
<a name="l00012"></a>00012 <span class="comment"> * under the terms of the GNU Lesser General Public License as published   *</span>
<a name="l00013"></a>00013 <span class="comment"> * by the Free Software Foundation; either version 2.1 of the License, or  *</span>
<a name="l00014"></a>00014 <span class="comment"> * (at your option) any later version.                                     *</span>
<a name="l00015"></a>00015 <span class="comment"> *                                                                         *</span>
<a name="l00016"></a>00016 <span class="comment"> * This library is distributed in the hope that it will be useful,         *</span>
<a name="l00017"></a>00017 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of          *</span>
<a name="l00018"></a>00018 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *</span>
<a name="l00019"></a>00019 <span class="comment"> * General Public License for more details.                                *</span>
<a name="l00020"></a>00020 <span class="comment"> *                                                                         *</span>
<a name="l00021"></a>00021 <span class="comment"> * You should have received a copy of the GNU Lesser General Public        *</span>
<a name="l00022"></a>00022 <span class="comment"> * License along with this library; if not, write to the Free Software     *</span>
<a name="l00023"></a>00023 <span class="comment"> * Foundation Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 *</span>
<a name="l00024"></a>00024 <span class="comment"> * USA                                                                     *</span>
<a name="l00025"></a>00025 <span class="comment"> *                                                                         *</span>
<a name="l00026"></a>00026 <span class="comment"> ***************************************************************************/</span>
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="a00240.html#a342983a479ae7a921be5face83fdb029">00028</a> <span class="preprocessor">#define FREPPLE_CORE</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="a00239.html">frepple/solver.h</a>&quot;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">namespace </span>frepple
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="comment"></span>
<a name="l00035"></a>00035 <span class="comment">/** @todo The flow quantity is handled at the wrong place. It needs to be</span>
<a name="l00036"></a>00036 <span class="comment">  * handled by the operation, since flows can exist on multiple suboperations</span>
<a name="l00037"></a>00037 <span class="comment">  * with different quantities. The buffer solve can&apos;t handle this, because</span>
<a name="l00038"></a>00038 <span class="comment">  * it only calls the solve() for the producing operation...</span>
<a name="l00039"></a>00039 <span class="comment">  * Are there some situations where the operation solver doesn&apos;t know enough</span>
<a name="l00040"></a>00040 <span class="comment">  * on the buffer behavior???</span>
<a name="l00041"></a>00041 <span class="comment">  */</span>
<a name="l00042"></a><a class="code" href="a00173.html#a36f15b9cf822b9977b1a5f855274b698">00042</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00173.html#aed1d08dd6ece530ed9229d463e31cca3">SolverMRP::solve</a>(<span class="keyword">const</span> <a class="code" href="a00008.html" title="A buffer represents a combination of a item and location.  It is the entity for keeping...">Buffer</a>* b, <span class="keywordtype">void</span>* v)
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   <a class="code" href="a00174.html" title="This class is a helper class of the SolverMRP class.">SolverMRPdata</a>* data = <span class="keyword">static_cast&lt;</span><a class="code" href="a00174.html" title="This class is a helper class of the SolverMRP class.">SolverMRPdata</a>*<span class="keyword">&gt;</span>(v);
<a name="l00045"></a>00045   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> requested_date(data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a658c5379af8ec535090a96dd969f1fc3">q_date</a>);
<a name="l00046"></a>00046   <span class="keywordtype">double</span> requested_qty(data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#adf7c858a404b725f2f2c67648300f89b">q_qty</a>);
<a name="l00047"></a>00047   <span class="keywordtype">bool</span> tried_requested_date(<span class="keyword">false</span>);
<a name="l00048"></a>00048 
<a name="l00049"></a>00049   <span class="comment">// Call the user exit</span>
<a name="l00050"></a>00050   <span class="keywordflow">if</span> (userexit_buffer) userexit_buffer.<a class="code" href="a00152.html#a7f199c39019f133986783dfc6017b640">call</a>(b, <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(data-&gt;constrainedPlanning));
<a name="l00051"></a>00051 
<a name="l00052"></a>00052   <span class="comment">// Message</span>
<a name="l00053"></a>00053   <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a1d6f62b1c53725b796ea1c4f8843b85d">getSolver</a>()-&gt;<a class="code" href="a00171.html#a7331226cd4ef515184dff2d118c43423">getLogLevel</a>()&gt;1)
<a name="l00054"></a>00054     <a class="code" href="a00257.html#a4af9f241e955122820c5e81ceb33edb5">logger</a> &lt;&lt; <a class="code" href="a00087.html">indent</a>(b-&gt;<a class="code" href="a00084.html#a44c879fcf3b6ae9193c393630e25fd13">getLevel</a>()) &lt;&lt; <span class="stringliteral">&quot;  Buffer &apos;&quot;</span> &lt;&lt; b-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>()
<a name="l00055"></a>00055       &lt;&lt; <span class="stringliteral">&quot;&apos; is asked: &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#adf7c858a404b725f2f2c67648300f89b">q_qty</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a658c5379af8ec535090a96dd969f1fc3">q_date</a> &lt;&lt; endl;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057   <span class="comment">// Store the last command in the list, in order to undo the following</span>
<a name="l00058"></a>00058   <span class="comment">// commands if required.</span>
<a name="l00059"></a>00059   <a class="code" href="a00025.html" title="Abstract base class for all commands.">Command</a>* topcommand = data-&gt;<a class="code" href="a00029.html#a392f247416814b845c086ff1f7196ad9">getLastCommand</a>();
<a name="l00060"></a>00060 
<a name="l00061"></a>00061   <span class="comment">// Make sure the new operationplans don&apos;t inherit an owner.</span>
<a name="l00062"></a>00062   <span class="comment">// When an operation calls the solve method of suboperations, this field is</span>
<a name="l00063"></a>00063   <span class="comment">// used to pass the information about the owner operationplan down. When</span>
<a name="l00064"></a>00064   <span class="comment">// solving for buffers we must make sure NOT to pass owner information.</span>
<a name="l00065"></a>00065   <span class="comment">// At the end of solving for a buffer we need to restore the original</span>
<a name="l00066"></a>00066   <span class="comment">// settings...</span>
<a name="l00067"></a>00067   <a class="code" href="a00125.html" title="An operationplan is the key dynamic element of a plan. It represents a certain quantity...">OperationPlan</a> *prev_owner_opplan = data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#abfd84159a05362d21fe7321c4caef08f">curOwnerOpplan</a>;
<a name="l00068"></a>00068   data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#abfd84159a05362d21fe7321c4caef08f">curOwnerOpplan</a> = NULL;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   <span class="comment">// Evaluate the buffer profile and solve shortages by asking more material.</span>
<a name="l00071"></a>00071   <span class="comment">// The loop goes from the requested date till the very end. Whenever the</span>
<a name="l00072"></a>00072   <span class="comment">// event date changes, we evaluate if a shortage exists.</span>
<a name="l00073"></a>00073   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> currentDate;
<a name="l00074"></a>00074   <span class="keyword">const</span> <a class="code" href="a00178.html" title="This class implements a &amp;quot;sorted list&amp;quot; data structure, sorting &amp;quot;events&amp;quot;...">TimeLine&lt;FlowPlan&gt;::Event</a> *prev = NULL;
<a name="l00075"></a>00075   <span class="keywordtype">double</span> shortage(0.0);
<a name="l00076"></a>00076   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> extraSupplyDate(Date::infiniteFuture);
<a name="l00077"></a>00077   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> extraInventoryDate(Date::infiniteFuture);
<a name="l00078"></a>00078   <span class="keywordtype">double</span> cumproduced = b-&gt;<a class="code" href="a00008.html#ad8189150ceacd114c8cd91346323fa03">getFlowPlans</a>().rbegin()-&gt;getCumulativeProduced();
<a name="l00079"></a>00079   <span class="keywordtype">double</span> current_minimum(0.0);
<a name="l00080"></a>00080   <span class="keywordtype">double</span> unconfirmed_supply(0.0);
<a name="l00081"></a>00081   <span class="keywordflow">for</span> (Buffer::flowplanlist::const_iterator cur=b-&gt;<a class="code" href="a00008.html#ad8189150ceacd114c8cd91346323fa03">getFlowPlans</a>().begin();
<a name="l00082"></a>00082       ; ++cur)
<a name="l00083"></a>00083   {
<a name="l00084"></a>00084     <span class="keyword">const</span> <a class="code" href="a00068.html" title="A flowplan represents a planned material flow in or out of a buffer.">FlowPlan</a>* fplan = <span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="a00068.html" title="A flowplan represents a planned material flow in or out of a buffer.">FlowPlan</a>*<span class="keyword">&gt;</span>(&amp;*cur);
<a name="l00085"></a>00085     <span class="keywordflow">if</span> (fplan &amp;&amp; !fplan-&gt;<a class="code" href="a00068.html#afe1300d2e208fb1420a32caa3568e13d">getOperationPlan</a>()-&gt;<a class="code" href="a00125.html#a2fc22f86c78b34f91bf535c742e2e740">getIdentifier</a>() 
<a name="l00086"></a>00086       &amp;&amp; fplan-&gt;<a class="code" href="a00059.html#a665af7bb916d05a8c9a06f1a8170090f">getQuantity</a>()&gt;0 
<a name="l00087"></a>00087       &amp;&amp; fplan-&gt;<a class="code" href="a00068.html#afe1300d2e208fb1420a32caa3568e13d">getOperationPlan</a>()-&gt;<a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>() != b-&gt;<a class="code" href="a00008.html#aa694888268875ab6711e5b97fc4c66c2">getProducingOperation</a>())
<a name="l00088"></a>00088       unconfirmed_supply += fplan-&gt;<a class="code" href="a00059.html#a665af7bb916d05a8c9a06f1a8170090f">getQuantity</a>();
<a name="l00089"></a>00089 
<a name="l00090"></a>00090     <span class="comment">// Iterator has now changed to a new date or we have arrived at the end.</span>
<a name="l00091"></a>00091     <span class="comment">// If multiple flows are at the same moment in time, we are not interested</span>
<a name="l00092"></a>00092     <span class="comment">// in the inventory changes. It gets interesting only when a certain</span>
<a name="l00093"></a>00093     <span class="comment">// inventory level remains unchanged for a certain time.</span>
<a name="l00094"></a>00094     <span class="keywordflow">if</span> ((cur == b-&gt;<a class="code" href="a00008.html#ad8189150ceacd114c8cd91346323fa03">getFlowPlans</a>().end() || cur-&gt;getDate()&gt;currentDate) &amp;&amp; prev)
<a name="l00095"></a>00095     {
<a name="l00096"></a>00096       <span class="comment">// Some variables</span>
<a name="l00097"></a>00097       <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> theDate = prev-&gt;getDate();
<a name="l00098"></a>00098       <span class="keywordtype">double</span> theOnHand = prev-&gt;getOnhand();
<a name="l00099"></a>00099       <span class="keywordtype">double</span> theDelta = theOnHand - current_minimum + shortage;
<a name="l00100"></a>00100 
<a name="l00101"></a>00101       <span class="comment">// Evaluate the situation at the last flowplan before the date change.</span>
<a name="l00102"></a>00102       <span class="comment">// Is there a shortage at that date?</span>
<a name="l00103"></a>00103       <span class="keywordflow">if</span> (theDelta &lt; -<a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00104"></a>00104       {
<a name="l00105"></a>00105         <span class="comment">// Can we get extra supply to solve the problem, or part of it?</span>
<a name="l00106"></a>00106         <span class="comment">// If the shortage already starts before the requested date, it</span>
<a name="l00107"></a>00107         <span class="comment">// was not created by the newly added flowplan, but existed before.</span>
<a name="l00108"></a>00108         <span class="comment">// We don&apos;t consider this as a shortage for the current flowplan,</span>
<a name="l00109"></a>00109         <span class="comment">// and we want our flowplan to try to repair the previous problems</span>
<a name="l00110"></a>00110         <span class="comment">// if it can...</span>
<a name="l00111"></a>00111         <span class="keywordtype">bool</span> loop = <span class="keyword">true</span>;
<a name="l00112"></a>00112         <span class="keywordflow">while</span> (b-&gt;<a class="code" href="a00008.html#aa694888268875ab6711e5b97fc4c66c2">getProducingOperation</a>() &amp;&amp; theDate &gt;= requested_date &amp;&amp; loop)
<a name="l00113"></a>00113         {
<a name="l00114"></a>00114           <span class="comment">// Create supply</span>
<a name="l00115"></a>00115           data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a2f03f32d577521909343d06b884d7081">curBuffer</a> = <span class="keyword">const_cast&lt;</span><a class="code" href="a00008.html" title="A buffer represents a combination of a item and location.  It is the entity for keeping...">Buffer</a>*<span class="keyword">&gt;</span>(b);
<a name="l00116"></a>00116           data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#adf7c858a404b725f2f2c67648300f89b">q_qty</a> = -theDelta;
<a name="l00117"></a>00117           data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a658c5379af8ec535090a96dd969f1fc3">q_date</a> = prev-&gt;getDate();
<a name="l00118"></a>00118 
<a name="l00119"></a>00119           <span class="comment">// Check whether this date doesn&apos;t match with the requested date.</span>
<a name="l00120"></a>00120           <span class="comment">// See a bit further why this is required.</span>
<a name="l00121"></a>00121           <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a658c5379af8ec535090a96dd969f1fc3">q_date</a> == requested_date) tried_requested_date = <span class="keyword">true</span>;
<a name="l00122"></a>00122 
<a name="l00123"></a>00123           <span class="comment">// Note that the supply created with the next line changes the</span>
<a name="l00124"></a>00124           <span class="comment">// onhand value at all later dates!</span>
<a name="l00125"></a>00125           b-&gt;<a class="code" href="a00008.html#aa694888268875ab6711e5b97fc4c66c2">getProducingOperation</a>()-&gt;<a class="code" href="a00121.html#a15b6686fb03126fea6d5151a79aa5a91">solve</a>(*<span class="keyword">this</span>,v);
<a name="l00126"></a>00126 
<a name="l00127"></a>00127           <span class="comment">// Evaluate the reply date. The variable extraSupplyDate will store</span>
<a name="l00128"></a>00128           <span class="comment">// the date when the producing operation tells us it can get extra</span>
<a name="l00129"></a>00129           <span class="comment">// supply.</span>
<a name="l00130"></a>00130           <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> &lt; extraSupplyDate
<a name="l00131"></a>00131             &amp;&amp; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> &gt; requested_date)
<a name="l00132"></a>00132             extraSupplyDate = data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a>;
<a name="l00133"></a>00133 
<a name="l00134"></a>00134           <span class="comment">// If we got some extra supply, we retry to get some more supply.</span>
<a name="l00135"></a>00135           <span class="comment">// Only when no extra material is obtained, we give up.</span>
<a name="l00136"></a>00136           <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &gt; <a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>
<a name="l00137"></a>00137             &amp;&amp; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &lt; -theDelta - <a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00138"></a>00138             theDelta += data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a>;
<a name="l00139"></a>00139           <span class="keywordflow">else</span>
<a name="l00140"></a>00140             loop = <span class="keyword">false</span>;
<a name="l00141"></a>00141         }
<a name="l00142"></a>00142 
<a name="l00143"></a>00143         <span class="comment">// Not enough supply was received to repair the complete problem</span>
<a name="l00144"></a>00144         <span class="keywordflow">if</span> (prev-&gt;getOnhand() + shortage &lt; -<a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00145"></a>00145         {
<a name="l00146"></a>00146           <span class="comment">// Keep track of the shorted quantity.</span>
<a name="l00147"></a>00147           <span class="comment">// Only consider shortages later than the requested date.</span>
<a name="l00148"></a>00148           <span class="keywordflow">if</span> (theDate &gt;= requested_date)
<a name="l00149"></a>00149             shortage = -prev-&gt;getOnhand();
<a name="l00150"></a>00150 
<a name="l00151"></a>00151           <span class="comment">// Reset the date from which excess material is in the buffer. This</span>
<a name="l00152"></a>00152           <span class="comment">// excess material can be used to compute the date when the buffer</span>
<a name="l00153"></a>00153           <span class="comment">// can be asked again for additional supply.</span>
<a name="l00154"></a>00154           extraInventoryDate = Date::infiniteFuture;
<a name="l00155"></a>00155         }
<a name="l00156"></a>00156       }
<a name="l00157"></a>00157       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (theDelta &gt; unconfirmed_supply + <a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00158"></a>00158         <span class="comment">// There is excess material at this date (coming from planned/frozen</span>
<a name="l00159"></a>00159         <span class="comment">// material arrivals, surplus material created by lotsized operations,</span>
<a name="l00160"></a>00160         <span class="comment">// etc...)</span>
<a name="l00161"></a>00161         <span class="comment">// The unconfirmed_supply element is required to exclude any of the</span>
<a name="l00162"></a>00162         <span class="comment">// excess inventory we may have caused ourselves. Such situations are </span>
<a name="l00163"></a>00163         <span class="comment">// possible when there are loops in the supply chain.</span>
<a name="l00164"></a>00164         <span class="keywordflow">if</span> (theDate &gt; requested_date
<a name="l00165"></a>00165             &amp;&amp; extraInventoryDate == Date::infiniteFuture)
<a name="l00166"></a>00166           extraInventoryDate = theDate;
<a name="l00167"></a>00167     }
<a name="l00168"></a>00168 
<a name="l00169"></a>00169     <span class="comment">// We have reached the end of the flowplans. Breaking out of the loop</span>
<a name="l00170"></a>00170     <span class="comment">// needs to be done here because in the next statements we are accessing</span>
<a name="l00171"></a>00171     <span class="comment">// *cur, which isn&apos;t valid at the end of the list</span>
<a name="l00172"></a>00172     <span class="keywordflow">if</span> (cur == b-&gt;<a class="code" href="a00008.html#ad8189150ceacd114c8cd91346323fa03">getFlowPlans</a>().end()) <span class="keywordflow">break</span>;
<a name="l00173"></a>00173 
<a name="l00174"></a>00174     <span class="comment">// The minimum or the maximum have changed</span>
<a name="l00175"></a>00175     <span class="comment">// Note that these limits can be updated only after the processing of the</span>
<a name="l00176"></a>00176     <span class="comment">// date change in the statement above. Otherwise the code above would</span>
<a name="l00177"></a>00177     <span class="comment">// already use the new value before the intended date.</span>
<a name="l00178"></a>00178     <span class="keywordflow">if</span> (cur-&gt;getType() == 3) current_minimum = cur-&gt;getMin();
<a name="l00179"></a>00179 
<a name="l00180"></a>00180     <span class="comment">// Update the pointer to the previous flowplan.</span>
<a name="l00181"></a>00181     prev = &amp;*cur;
<a name="l00182"></a>00182     currentDate = cur-&gt;getDate();
<a name="l00183"></a>00183   }
<a name="l00184"></a>00184 
<a name="l00185"></a>00185   <span class="comment">// Note: the variable extraInventoryDate now stores the date from which</span>
<a name="l00186"></a>00186   <span class="comment">// excess material is available in the buffer. The excess</span>
<a name="l00187"></a>00187   <span class="comment">// We don&apos;t need to care how much material is lying there.</span>
<a name="l00188"></a>00188 
<a name="l00189"></a>00189   <span class="comment">// Check for supply at the requested date</span>
<a name="l00190"></a>00190   <span class="comment">// Isn&apos;t this included in the normal loop? In some cases it is indeed, but</span>
<a name="l00191"></a>00191   <span class="comment">// sometimes it isn&apos;t because in the normal loop there may still have been</span>
<a name="l00192"></a>00192   <span class="comment">// onhand available and the shortage only shows at a later date than the</span>
<a name="l00193"></a>00193   <span class="comment">// requested date.</span>
<a name="l00194"></a>00194   <span class="comment">// E.g. Initial situation:              After extra consumer at time y:</span>
<a name="l00195"></a>00195   <span class="comment">//      -------+                                --+</span>
<a name="l00196"></a>00196   <span class="comment">//             |                                  |</span>
<a name="l00197"></a>00197   <span class="comment">//             +------                            +---+</span>
<a name="l00198"></a>00198   <span class="comment">//                                                    |</span>
<a name="l00199"></a>00199   <span class="comment">//    0 -------y------                        0 --y---x-----</span>
<a name="l00200"></a>00200   <span class="comment">//                                                    |</span>
<a name="l00201"></a>00201   <span class="comment">//                                                    +-----</span>
<a name="l00202"></a>00202   <span class="comment">// The first loop only checks for supply at times x and later. If it is not</span>
<a name="l00203"></a>00203   <span class="comment">// feasible, we now check for supply at time y. It will create some extra</span>
<a name="l00204"></a>00204   <span class="comment">// inventory, but at least the demand is met.</span>
<a name="l00205"></a>00205   <span class="comment">// @todo The buffer solver could move backward in time from x till time y,</span>
<a name="l00206"></a>00206   <span class="comment">// and try multiple dates. This would minimize the excess inventory created.</span>
<a name="l00207"></a>00207   <span class="keywordflow">while</span> (shortage &gt; <a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>
<a name="l00208"></a>00208       &amp;&amp; b-&gt;<a class="code" href="a00008.html#aa694888268875ab6711e5b97fc4c66c2">getProducingOperation</a>() &amp;&amp; !tried_requested_date)
<a name="l00209"></a>00209   {
<a name="l00210"></a>00210     <span class="comment">// Create supply at the requested date</span>
<a name="l00211"></a>00211     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a2f03f32d577521909343d06b884d7081">curBuffer</a> = <span class="keyword">const_cast&lt;</span><a class="code" href="a00008.html" title="A buffer represents a combination of a item and location.  It is the entity for keeping...">Buffer</a>*<span class="keyword">&gt;</span>(b);
<a name="l00212"></a>00212     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#adf7c858a404b725f2f2c67648300f89b">q_qty</a> = shortage;
<a name="l00213"></a>00213     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a658c5379af8ec535090a96dd969f1fc3">q_date</a> = requested_date;
<a name="l00214"></a>00214     <span class="comment">// Note that the supply created with the next line changes the onhand value</span>
<a name="l00215"></a>00215     <span class="comment">// at all later dates!</span>
<a name="l00216"></a>00216     <span class="comment">// Note that asking at the requested date doesn&apos;t keep the material on</span>
<a name="l00217"></a>00217     <span class="comment">// stock to a minimum.</span>
<a name="l00218"></a>00218     b-&gt;<a class="code" href="a00008.html#aa694888268875ab6711e5b97fc4c66c2">getProducingOperation</a>()-&gt;<a class="code" href="a00121.html#a15b6686fb03126fea6d5151a79aa5a91">solve</a>(*<span class="keyword">this</span>,v);
<a name="l00219"></a>00219     <span class="comment">// Evaluate the reply</span>
<a name="l00220"></a>00220     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> &lt; extraSupplyDate
<a name="l00221"></a>00221       &amp;&amp; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> &gt; requested_date)
<a name="l00222"></a>00222       extraSupplyDate = data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a>;
<a name="l00223"></a>00223     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &gt; <a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00224"></a>00224       shortage -= data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a>;
<a name="l00225"></a>00225     <span class="keywordflow">else</span>
<a name="l00226"></a>00226       tried_requested_date = <span class="keyword">true</span>;
<a name="l00227"></a>00227   }
<a name="l00228"></a>00228 
<a name="l00229"></a>00229   <span class="comment">// Final evaluation of the replenishment</span>
<a name="l00230"></a>00230   <span class="keywordflow">if</span> (data-&gt;constrainedPlanning &amp;&amp; data-&gt;<a class="code" href="a00174.html#a1d6f62b1c53725b796ea1c4f8843b85d">getSolver</a>()-&gt;<a class="code" href="a00173.html#a4bc4f05f9f0d4e153dde779a8fd4154f">isConstrained</a>())
<a name="l00231"></a>00231   {
<a name="l00232"></a>00232     <span class="comment">// Use the constrained planning result</span>
<a name="l00233"></a>00233     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> = requested_qty - shortage;
<a name="l00234"></a>00234     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &lt; <a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00235"></a>00235     {
<a name="l00236"></a>00236       data-&gt;<a class="code" href="a00029.html#a6f38f9a190b88a29f63b58a478cbe982">undo</a>(topcommand);
<a name="l00237"></a>00237       data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> = 0.0;
<a name="l00238"></a>00238     }
<a name="l00239"></a>00239     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> = (extraInventoryDate &lt; extraSupplyDate) ?
<a name="l00240"></a>00240         extraInventoryDate :
<a name="l00241"></a>00241         extraSupplyDate;
<a name="l00242"></a>00242     <span class="comment">// Monitor as a constraint if there is no producing operation.</span>
<a name="l00243"></a>00243     <span class="comment">// Note that if there is a producing operation the constraint is flagged </span>
<a name="l00244"></a>00244     <span class="comment">// on the operation instead of on this buffer.</span>
<a name="l00245"></a>00245     <span class="keywordflow">if</span> (!b-&gt;<a class="code" href="a00008.html#aa694888268875ab6711e5b97fc4c66c2">getProducingOperation</a>() &amp;&amp; data-&gt;logConstraints &amp;&amp; shortage &gt; <a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00246"></a>00246       data-&gt;planningDemand-&gt;<a class="code" href="a00051.html#acd06be46dd32eb121e408c5b9e035965">getConstraints</a>().<a class="code" href="a00100.html#add9d396135451bf2efef6527cea7839a">push</a>(<a class="code" href="a00146.html#aabbcfbf928d9353d5be6097a1d05942c">ProblemMaterialShortage::metadata</a>,
<a name="l00247"></a>00247           b, requested_date, Date::infiniteFuture, shortage);
<a name="l00248"></a>00248   }
<a name="l00249"></a>00249   <span class="keywordflow">else</span>
<a name="l00250"></a>00250   {
<a name="l00251"></a>00251     <span class="comment">// Enough inventory or supply available, or not material constrained.</span>
<a name="l00252"></a>00252     <span class="comment">// In case of a plan that is not material constrained, the buffer tries to</span>
<a name="l00253"></a>00253     <span class="comment">// solve for shortages as good as possible. Only in the end we &apos;lie&apos; about</span>
<a name="l00254"></a>00254     <span class="comment">// the result to the calling function. Material shortages will then remain</span>
<a name="l00255"></a>00255     <span class="comment">// in the buffer.</span>
<a name="l00256"></a>00256     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> = requested_qty;
<a name="l00257"></a>00257     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> = Date::infiniteFuture;
<a name="l00258"></a>00258   }
<a name="l00259"></a>00259 
<a name="l00260"></a>00260   <span class="comment">// Restore the owning operationplan.</span>
<a name="l00261"></a>00261   data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#abfd84159a05362d21fe7321c4caef08f">curOwnerOpplan</a> = prev_owner_opplan;
<a name="l00262"></a>00262 
<a name="l00263"></a>00263   <span class="comment">// Reply quantity must be greater than 0</span>
<a name="l00264"></a>00264   assert( data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &gt;= 0 );
<a name="l00265"></a>00265 
<a name="l00266"></a>00266   <span class="comment">// Increment the cost</span>
<a name="l00267"></a>00267   <span class="comment">// Only the quantity consumed directly from the buffer is counted.</span>
<a name="l00268"></a>00268   <span class="comment">// The cost of the material supply taken from producing operations is</span>
<a name="l00269"></a>00269   <span class="comment">// computed seperately and not considered here.</span>
<a name="l00270"></a>00270   <span class="keywordflow">if</span> (b-&gt;<a class="code" href="a00008.html#ad4c18a30b6a1d8f04cad0435b78bef1c">getItem</a>() &amp;&amp; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &gt; 0)
<a name="l00271"></a>00271   {
<a name="l00272"></a>00272     cumproduced = b-&gt;<a class="code" href="a00008.html#ad8189150ceacd114c8cd91346323fa03">getFlowPlans</a>().rbegin()-&gt;getCumulativeProduced() - cumproduced;
<a name="l00273"></a>00273     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &gt; cumproduced)
<a name="l00274"></a>00274       data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#aa2e444a8091c86f71bbcd6d076c6c574">a_cost</a> += (data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> - cumproduced) * b-&gt;<a class="code" href="a00008.html#ad4c18a30b6a1d8f04cad0435b78bef1c">getItem</a>()-&gt;<a class="code" href="a00088.html#a20303c6b16c479cf55a353b18886d756">getPrice</a>();
<a name="l00275"></a>00275   }
<a name="l00276"></a>00276 
<a name="l00277"></a>00277   <span class="comment">// Message</span>
<a name="l00278"></a>00278   <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a1d6f62b1c53725b796ea1c4f8843b85d">getSolver</a>()-&gt;<a class="code" href="a00171.html#a7331226cd4ef515184dff2d118c43423">getLogLevel</a>()&gt;1)
<a name="l00279"></a>00279     <a class="code" href="a00257.html#a4af9f241e955122820c5e81ceb33edb5">logger</a> &lt;&lt; <a class="code" href="a00087.html">indent</a>(b-&gt;<a class="code" href="a00084.html#a44c879fcf3b6ae9193c393630e25fd13">getLevel</a>()) &lt;&lt; <span class="stringliteral">&quot;  Buffer &apos;&quot;</span> &lt;&lt; b-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>()
<a name="l00280"></a>00280     &lt;&lt; <span class="stringliteral">&quot;&apos; answers: &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span>
<a name="l00281"></a>00281     &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#aa2e444a8091c86f71bbcd6d076c6c574">a_cost</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ae007a7c0a1074c1fc1dfe9c5eeedcc0e">a_penalty</a> &lt;&lt; endl;
<a name="l00282"></a>00282 }
<a name="l00283"></a>00283 
<a name="l00284"></a>00284 
<a name="l00285"></a><a class="code" href="a00173.html#aa96ce440189661df023927d5b8f6cb6c">00285</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00173.html#aed1d08dd6ece530ed9229d463e31cca3">SolverMRP::solve</a>(<span class="keyword">const</span> <a class="code" href="a00010.html" title="This class represents a material buffer with an infinite supply of extra material...">BufferInfinite</a>* b, <span class="keywordtype">void</span>* v)
<a name="l00286"></a>00286 {
<a name="l00287"></a>00287   <a class="code" href="a00174.html" title="This class is a helper class of the SolverMRP class.">SolverMRPdata</a>* data = <span class="keyword">static_cast&lt;</span><a class="code" href="a00174.html" title="This class is a helper class of the SolverMRP class.">SolverMRPdata</a>*<span class="keyword">&gt;</span>(v);
<a name="l00288"></a>00288 
<a name="l00289"></a>00289   <span class="comment">// Call the user exit</span>
<a name="l00290"></a>00290   <span class="keywordflow">if</span> (userexit_buffer) userexit_buffer.<a class="code" href="a00152.html#a7f199c39019f133986783dfc6017b640">call</a>(b, <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(data-&gt;constrainedPlanning));
<a name="l00291"></a>00291 
<a name="l00292"></a>00292   <span class="comment">// Message</span>
<a name="l00293"></a>00293   <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a1d6f62b1c53725b796ea1c4f8843b85d">getSolver</a>()-&gt;<a class="code" href="a00171.html#a7331226cd4ef515184dff2d118c43423">getLogLevel</a>()&gt;1)
<a name="l00294"></a>00294     <a class="code" href="a00257.html#a4af9f241e955122820c5e81ceb33edb5">logger</a> &lt;&lt; <a class="code" href="a00087.html">indent</a>(b-&gt;<a class="code" href="a00084.html#a44c879fcf3b6ae9193c393630e25fd13">getLevel</a>()) &lt;&lt; <span class="stringliteral">&quot;  Infinite buffer &apos;&quot;</span> &lt;&lt; b &lt;&lt; <span class="stringliteral">&quot;&apos; is asked: &quot;</span>
<a name="l00295"></a>00295     &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#adf7c858a404b725f2f2c67648300f89b">q_qty</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a658c5379af8ec535090a96dd969f1fc3">q_date</a> &lt;&lt; endl;
<a name="l00296"></a>00296 
<a name="l00297"></a>00297   <span class="comment">// Reply whatever is requested, regardless of date, quantity or supply.</span>
<a name="l00298"></a>00298   <span class="comment">// The demand is not propagated upstream either.</span>
<a name="l00299"></a>00299   data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> = data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#adf7c858a404b725f2f2c67648300f89b">q_qty</a>;
<a name="l00300"></a>00300   data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> = data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#a658c5379af8ec535090a96dd969f1fc3">q_date</a>;
<a name="l00301"></a>00301   if (b-&gt;<a class="code" href="a00008.html#ad4c18a30b6a1d8f04cad0435b78bef1c">getItem</a>())
<a name="l00302"></a>00302     data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#aa2e444a8091c86f71bbcd6d076c6c574">a_cost</a> += data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#adf7c858a404b725f2f2c67648300f89b">q_qty</a> * b-&gt;<a class="code" href="a00008.html#ad4c18a30b6a1d8f04cad0435b78bef1c">getItem</a>()-&gt;<a class="code" href="a00088.html#a20303c6b16c479cf55a353b18886d756">getPrice</a>();
<a name="l00303"></a>00303 
<a name="l00304"></a>00304   <span class="comment">// Message</span>
<a name="l00305"></a>00305   <span class="keywordflow">if</span> (data-&gt;<a class="code" href="a00174.html#a1d6f62b1c53725b796ea1c4f8843b85d">getSolver</a>()-&gt;<a class="code" href="a00171.html#a7331226cd4ef515184dff2d118c43423">getLogLevel</a>()&gt;1)
<a name="l00306"></a>00306     <a class="code" href="a00257.html#a4af9f241e955122820c5e81ceb33edb5">logger</a> &lt;&lt; <a class="code" href="a00087.html">indent</a>(b-&gt;<a class="code" href="a00084.html#a44c879fcf3b6ae9193c393630e25fd13">getLevel</a>()) &lt;&lt; <span class="stringliteral">&quot;  Infinite buffer &apos;&quot;</span> &lt;&lt; b &lt;&lt; <span class="stringliteral">&quot;&apos; answers: &quot;</span>
<a name="l00307"></a>00307     &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#af34ccc319ed0bd6bb387353e0968e622">a_qty</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ab56b3877ddc206e8817f04186c0e47a8">a_date</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span>
<a name="l00308"></a>00308     &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#aa2e444a8091c86f71bbcd6d076c6c574">a_cost</a> &lt;&lt; <span class="stringliteral">&quot;  &quot;</span> &lt;&lt; data-&gt;<a class="code" href="a00174.html#a592e60ca8e03a80e5460bfb1bf973b4e">state</a>-&gt;<a class="code" href="a00175.html#ae007a7c0a1074c1fc1dfe9c5eeedcc0e">a_penalty</a> &lt;&lt; endl;
<a name="l00309"></a>00309 }
<a name="l00310"></a>00310 
<a name="l00311"></a>00311 
<a name="l00312"></a>00312 }
</pre></div></div>
<hr size="1"/><address style="align: right;"><small>Documentation generated for frePPLe by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"/></a></small></address>
</div>
</div>
</body>
</html>