<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Project schedule via LP with Proc Optmodel in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698384#M3223</link>
    <description>&lt;P&gt;I have several suggestions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. You can use the IIS= option in the SOLVE WITH LP statement to identify an irreducible infeasible set.&amp;nbsp; For your problem, this will likely return a cycle, as you suspected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You can use the CYCLE= option in the SOLVE WITH NETWORK statement to find a cycle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For suggestions 1 and 2, you can report the source of infeasibility to the data preparer to correct.&amp;nbsp; But even after correction, there might be another cycle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. You can use the CYCLE= option in the SOLVE WITH NETWORK statement to find &lt;EM&gt;all&lt;/EM&gt; cycles (MAXCYCLES=ALL).&amp;nbsp; Then report them all to the data preparer to correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. You can use the MILP solver to find a minimum set of arcs whose removal will eliminate all cycles.&amp;nbsp; To do this, you could introduce a binary variable IsRemoved[i,j] for each arc &amp;lt;i,j&amp;gt;, do step 3 to find all cycles, impose a "cover" constraint sum {&amp;lt;i,j&amp;gt; in ARCS_cycle[c]} IsRemoved[i,j] &amp;gt;= 1 that forces at least one arc to be removed from each cycle, and minimize sum {&amp;lt;i,j&amp;gt; in prec} IsRemoved[i,j].&amp;nbsp; Then remove the arcs for which IsRemoved[i,j] &amp;gt; 0.5 (a safe comparison for = 1) and proceed with the LP solve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. You can introduce a slack variable to measure constraint violation, minimize the sum of slacks, impose an objective cut, and solve again with the original objective:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var slack{prec} &amp;gt;= 0;
   min infeasibility = sum {&amp;lt;i,j&amp;gt; in prec} slack[i,j];
   con ptime{&amp;lt;i,j&amp;gt; in prec}:
      s[i] + duration[i] &amp;lt;= s[j] + slack[i,j];

   solve;

   num mininfeasibility;
   mininfeasibility = infeasibility.sol;
   con objectivecut:
      infeasibility &amp;lt;= mininfeasibility;

   solve obj objective;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, a cycle for which all durations are 0 is fine.&amp;nbsp; It just means that those activities must all happen at the same time.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Nov 2020 14:02:27 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2020-11-12T14:02:27Z</dc:date>
    <item>
      <title>Project schedule via LP with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698176#M3218</link>
      <description>&lt;P&gt;Hi :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because I need to add further constraints using Proc CPM&amp;nbsp; was not deemed appropriate.&lt;/P&gt;
&lt;P&gt;Here&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;A href="https://neos-guide.org/content/project-scheduling-critical-path-method" target="_blank"&gt;https://neos-guide.org/content/project-scheduling-critical-path-method&lt;/A&gt; &amp;nbsp; I found an example with&amp;nbsp; GAMS.&lt;/P&gt;
&lt;P&gt;Being not literate in GAMS I would want to try with Optmodel.&lt;/P&gt;
&lt;P&gt;The GAMS attempt uses precedence constraints where I don't know the equivalents in Optmodel.&lt;/P&gt;
&lt;P&gt;I'm looking for a decent model in Optmodel since I need a model roughly&amp;nbsp; 10-20 times larger than the easy example.&lt;/P&gt;
&lt;P&gt;Here is some part of the link copied in :&amp;nbsp;&amp;nbsp; Did not work !! Please look up the link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think one would map the&amp;nbsp; nodes&amp;nbsp; A&amp;nbsp; to&amp;nbsp; H&amp;nbsp; onto the numbers&amp;nbsp; 1&amp;nbsp; to 8&amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Who has good ideas ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&amp;nbsp; Odenwald.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 15:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698176#M3218</guid>
      <dc:creator>ODENWALD</dc:creator>
      <dc:date>2020-11-11T15:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Project schedule via LP with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698207#M3219</link>
      <description>&lt;P&gt;Here is a translation to OPTMODEL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   set activity = /A B C D E F G/;

   set prec = (/A/ cross /B C/) union (/B E/ cross /F/) union {&amp;lt;'C','D'&amp;gt;,&amp;lt;'D','E'&amp;gt;,&amp;lt;'F','G'&amp;gt;};

   num duration{activity} = [2 3 3 4 8 6 2];

   var time;

   var s{activity} &amp;gt;= 0;

   min objective = time;

   con ctime{i in activity}:
      time &amp;gt;= s[i] + duration[i];

   con ptime{&amp;lt;i,j&amp;gt; in prec}:
      s[i] + duration[i] &amp;lt;= s[j];

   solve;

   print time s;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Optmodel: PrintTable" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;time&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;25&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;&lt;A name="IDX295" target="_blank"&gt;&lt;/A&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Optmodel: PrintTable" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;[1]&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;s&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;A&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;B&lt;/TH&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;C&lt;/TH&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;D&lt;/TH&gt;
&lt;TD class="r data"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;E&lt;/TH&gt;
&lt;TD class="r data"&gt;9&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;F&lt;/TH&gt;
&lt;TD class="r data"&gt;17&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;G&lt;/TH&gt;
&lt;TD class="r data"&gt;23&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 Nov 2020 19:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698207#M3219</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2020-11-11T19:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Project schedule via LP with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698220#M3220</link>
      <description>&lt;P&gt;&amp;nbsp;Hi Rob : Thanks a lot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two questions :&lt;/P&gt;
&lt;P&gt;1. How can I print a set of Optmodel ?&lt;/P&gt;
&lt;P&gt;2. Are there alternatives to the cross and union sequences ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Could I somehow input a linear list of all pairs of type (predecessor , successor) of activity nodes ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Odenwald&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 20:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698220#M3220</guid>
      <dc:creator>ODENWALD</dc:creator>
      <dc:date>2020-11-11T20:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Project schedule via LP with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698222#M3221</link>
      <description>&lt;P&gt;You can use the PUT statement to output a set to the log.&amp;nbsp; Yes, you can define prec as a set of pairs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   set prec = {&amp;lt;'A','B'&amp;gt;,&amp;lt;'A','C'&amp;gt;,&amp;lt;'B','F'&amp;gt;,&amp;lt;'E','F'&amp;gt;,&amp;lt;'C','D'&amp;gt;,&amp;lt;'D','E'&amp;gt;,&amp;lt;'F','G'&amp;gt;};
   put prec=;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could also read these pairs from a SAS data set:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data indata;
   input i $ j $;
   datalines;
A B
A C
B F
E F
C D
D E
F G
;

proc optmodel;
   set &amp;lt;str,str&amp;gt; prec;
   read data indata into prec=[i j];
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Nov 2020 20:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698222#M3221</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2020-11-11T20:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Project schedule via LP with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698355#M3222</link>
      <description>&lt;P&gt;Hi Rob :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perfect. The question as posed is totally solved. Thank you again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately the real data which we are not allowed to share are such that you don't see much, but produce &amp;lt;infeasible&amp;gt;.&lt;/P&gt;
&lt;P&gt;As we could not find an error, I suspect that these data contain so called positive cycles. These are mentioned some times in the literature but mostly excluded from further discussion (these are the equivalents of negative cycles in shortest path problems).&lt;/P&gt;
&lt;P&gt;If such effects ever have crossed your path please feel encouraged to comment or recommend a paper.&lt;/P&gt;
&lt;P&gt;There have been suggested&amp;nbsp; different&amp;nbsp; LP models&amp;nbsp; for the task under consideration (Neos/GAMS ;&amp;nbsp; Hillier-Lieberman ;&amp;nbsp; Domschke (German) ; )&amp;nbsp; Possibly there could exist further ones that allow to handle that cycle problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Odenwald&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 11:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698355#M3222</guid>
      <dc:creator>ODENWALD</dc:creator>
      <dc:date>2020-11-12T11:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Project schedule via LP with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698384#M3223</link>
      <description>&lt;P&gt;I have several suggestions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. You can use the IIS= option in the SOLVE WITH LP statement to identify an irreducible infeasible set.&amp;nbsp; For your problem, this will likely return a cycle, as you suspected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You can use the CYCLE= option in the SOLVE WITH NETWORK statement to find a cycle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For suggestions 1 and 2, you can report the source of infeasibility to the data preparer to correct.&amp;nbsp; But even after correction, there might be another cycle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. You can use the CYCLE= option in the SOLVE WITH NETWORK statement to find &lt;EM&gt;all&lt;/EM&gt; cycles (MAXCYCLES=ALL).&amp;nbsp; Then report them all to the data preparer to correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. You can use the MILP solver to find a minimum set of arcs whose removal will eliminate all cycles.&amp;nbsp; To do this, you could introduce a binary variable IsRemoved[i,j] for each arc &amp;lt;i,j&amp;gt;, do step 3 to find all cycles, impose a "cover" constraint sum {&amp;lt;i,j&amp;gt; in ARCS_cycle[c]} IsRemoved[i,j] &amp;gt;= 1 that forces at least one arc to be removed from each cycle, and minimize sum {&amp;lt;i,j&amp;gt; in prec} IsRemoved[i,j].&amp;nbsp; Then remove the arcs for which IsRemoved[i,j] &amp;gt; 0.5 (a safe comparison for = 1) and proceed with the LP solve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5. You can introduce a slack variable to measure constraint violation, minimize the sum of slacks, impose an objective cut, and solve again with the original objective:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var slack{prec} &amp;gt;= 0;
   min infeasibility = sum {&amp;lt;i,j&amp;gt; in prec} slack[i,j];
   con ptime{&amp;lt;i,j&amp;gt; in prec}:
      s[i] + duration[i] &amp;lt;= s[j] + slack[i,j];

   solve;

   num mininfeasibility;
   mininfeasibility = infeasibility.sol;
   con objectivecut:
      infeasibility &amp;lt;= mininfeasibility;

   solve obj objective;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, a cycle for which all durations are 0 is fine.&amp;nbsp; It just means that those activities must all happen at the same time.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 14:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Project-schedule-via-LP-with-Proc-Optmodel/m-p/698384#M3223</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2020-11-12T14:02:27Z</dc:date>
    </item>
  </channel>
</rss>

