<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:UICTFontTextStyleTallBody;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle21
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1151369150;
mso-list-type:hybrid;
mso-list-template-ids:-65475930 216571112 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Times New Roman",serif;
mso-ascii-font-family:Calibri;
mso-hansi-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1
{mso-list-id:1696034503;
mso-list-type:hybrid;
mso-list-template-ids:-287410220 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi Mike,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks for your correction here. I have a few more syntax-related questions from the attached file.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:0in;margin-bottom:.0001pt">1. What does unexpected symbol var mean in the instance below? Normally I find that I’ve used an undefined variable, but I don’t see any issue with that here:<br>
<br>
<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0"># Force x_(i+1) = 0 whenever x_i < u_i (pg 574)<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt">special_condition$1${<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">e in export_ports,<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">i in import_ports,<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">r in route_types,<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">s in seasons,<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">g in grains,<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">n in approximation_intervals:
<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">{ n < len(approximation_intervals) && #Syntax error unexpected SYMBOL_VAR<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">x_val_interval[e,i,r,s,g,n] < tonnage_intervals[s,g,n]:
<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">x_val_interval[e,i,r,s,g,n+1] = 0;<o:p></o:p></p>
<p style="margin:0in;margin-bottom:.0001pt;-qt-block-indent:0;-qt-user-state:0">}<o:p></o:p></p>
<p class="MsoNormal" style="-qt-block-indent:0;-qt-user-state:0">}<br>
<br>
2. What does “product of variable has too much indexes” error message mean?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">transport_cost$1$ {<o:p></o:p></p>
<p class="MsoNormal">e in export_ports,<o:p></o:p></p>
<p class="MsoNormal">i in import_ports,<o:p></o:p></p>
<p class="MsoNormal">r in route_types,<o:p></o:p></p>
<p class="MsoNormal">s in seasons,<o:p></o:p></p>
<p class="MsoNormal">g in grains: <o:p></o:p></p>
<p class="MsoNormal">transport_cost[e,i,r,s,g] = sum{<o:p></o:p></p>
<p class="MsoNormal">n in approximation_intervals:<o:p></o:p></p>
<p class="MsoNormal">x_val_interval[e,i,r,s,g,n] * m[e,i,s,g,n] * route_nmiles[e,i,r] * transport_cost_per_mton_nmile #Syntax issue: Product of variable has too much indexes<o:p></o:p></p>
<p class="MsoNormal">};<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">3. How can I properly format this stamen involving a power? I’m not having any luck with this.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#Get cost for the tonnage intervals<o:p></o:p></p>
<p class="MsoNormal">solve_fx$1$ {<o:p></o:p></p>
<p class="MsoNormal">e in export_ports,<o:p></o:p></p>
<p class="MsoNormal">i in import_ports,<o:p></o:p></p>
<p class="MsoNormal">s in seasons,<o:p></o:p></p>
<p class="MsoNormal">g in grains,<o:p></o:p></p>
<p class="MsoNormal">n in approximation_intervals:<o:p></o:p></p>
<p class="MsoNormal">fx[e,i,s,g,n] = exp(a[e,i]) * (n*tonnage_intervals[s,g])^b[e,i]; # Syntax issue with power<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">4. What is proper format for this statement? I’m having an issue getting the operators and parenthesis in a format that CMPL accepts.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#Get slope for piece-wise approximation<o:p></o:p></p>
<p class="MsoNormal">solve_m$1$ {<o:p></o:p></p>
<p class="MsoNormal">e in export_ports,<o:p></o:p></p>
<p class="MsoNormal">i in import_ports,<o:p></o:p></p>
<p class="MsoNormal">s in seasons,<o:p></o:p></p>
<p class="MsoNormal">g in grains,<o:p></o:p></p>
<p class="MsoNormal">n in approximation_intervals: <o:p></o:p></p>
<p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal">n = 1: <o:p></o:p></p>
<p class="MsoNormal">m[e,i,s,g,n] = fx[e,i,s,g,n] * (1/tonnage_intervals[s,g]); # Arithmetic syntax issue<o:p></o:p></p>
<p class="MsoNormal">| n > 1: <o:p></o:p></p>
<p class="MsoNormal">m[e,i,s,g,n] = (fx[e,i,s,g,n] - fx[e,i,s,g,n-1])/(n*tonnage_intervals[s,g] - (n-1)*tonnage_intervals[s,g,]); # Arithmetic syntax issue<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you for any advice or clarification.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><b><span style="font-size:10.0pt">Bhrett Ogden</span></b><span style="font-size:10.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">Information Management Software Developer<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">CDM Smith<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">1050 N Reed Station Rd Suite D<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">Carbondale, IL 62902<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">T: 312.780.7869<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt"><a href="mailto:ogdenba@cdmsmith.com">ogdenba@cdmsmith.com</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt">cdmsmith.com<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Mike Steglich [mailto:mike.steglich@th-wildau.de]
<br>
<b>Sent:</b> Monday, November 20, 2017 6:24 AM<br>
<b>To:</b> Ogden, Bhrett A. <ogdenba@cdmsmith.com><br>
<b>Cc:</b> cmpl@list.coin-or.org<br>
<b>Subject:</b> Re: [Cmpl] Piece-Wise Linearization Syntax Question<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Bhrett,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Hmm I am actually scatty because I forgotten to answer your second question:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This expression works:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">tonnage_intervals$1$ {</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">s in seasons,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">g in grains,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">i in approximation_intervals:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">tonnage_intervals[i,s,g] = worldwide_demand[s,g] * i * 1/len(approximation_intervals); #
Division won't work. I'm having to hardcode 0.25 for now.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">}</span><o:p></o:p></p>
</div>
</blockquote>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">if you imbed 1/len(approximation_intervals in brackets:<o:p></o:p></p>
</div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">tonnage_intervals$1$ {</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">s in seasons,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">g in grains,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">i in approximation_intervals:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black">tonnage_intervals[i,s,g] = worldwide_demand[s,g] * i * (1/len(approximation_intervals));</span><o:p></o:p></p>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"UICTFontTextStyleTallBody",serif">}</span><o:p></o:p></p>
</div>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Mike<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:12.0pt;font-family:"UICTFontTextStyleTallBody",serif;color:black"><br>
<br>
</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
Am 15.11.2017 um 20:52 schrieb Ogden, Bhrett A. <<a href="mailto:ogdenba@cdmsmith.com">ogdenba@cdmsmith.com</a>>:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Thank you for your prompt answer to my last question. <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I have another question regarding syntax of CMPL. I have a power function that represents a route cost that I would like to linearize. I am using linear approximation to consider the range of options and break the non-linear equation into
a four-part piece-wise equation, f(x) ~= f(n) + f’(n)(x-n), where n is the mean route tonnage in the interval. The power function is C = e^a * x^b where a and b are constants that depend on the route origin/destination and x is the route tonnage. One element
that I am trying to minimize is the sum of the transport costs. <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I have approximated the cost to f(x) = e^a * n^b * (1 + b * n^-1 * x – b), where n is the mean route tonnage in the interval and a and b are constants with respect to the route. Assuming that all tonnages lie within the first interval for
now (to avoid complicating this question with piece-wise syntax), how can I represent this in CMPL? I was having issues with using parenthesis so I have done all of the distributions. Now I am receiving syntax errors about ^. What is the proper way to represent
this?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">transport_cost$1$ {<o:p></o:p></p>
<p class="MsoNormal">e in export_ports,<o:p></o:p></p>
<p class="MsoNormal">i in import_ports,<o:p></o:p></p>
<p class="MsoNormal">s in seasons,<o:p></o:p></p>
<p class="MsoNormal">g in grains,<o:p></o:p></p>
<p class="MsoNormal">r in route_type: <o:p></o:p></p>
<p class="MsoNormal">transport_cost[e,i,r,s,g] = exp(a[e,i]) * mean_tonnage_for_interval[1,s,g] ^ b[e,i] + b[e,i] * exp(a[e,i]) * route_tonnage[e,i,r,s,g] * mean_tonnage_for_interval[1,s,g] ^ b[e,i] * mean_tonnage_for_interval[1,s,g] ^ -1 - exp(a[e,i])* b *
mean_tonnage_for_interval[1,s,g] ^ b[e,i];<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Would you also be able to explain why I get a syntax error if I divide in the following situation?:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">tonnage_intervals$1$ {<o:p></o:p></p>
<p class="MsoNormal">s in seasons,<o:p></o:p></p>
<p class="MsoNormal">g in grains,<o:p></o:p></p>
<p class="MsoNormal">i in approximation_intervals:<o:p></o:p></p>
<p class="MsoNormal">tonnage_intervals[i,s,g] = worldwide_demand[s,g] * i * 1/len(approximation_intervals); # Division won't work. I'm having to hardcode 0.25 for now.<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thank you for your assistance.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Best,<o:p></o:p></p>
<p class="MsoNormal">Bhrett Ogden<o:p></o:p></p>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">_______________________________________________<br>
Cmpl mailing list<br>
<a href="mailto:Cmpl@list.coin-or.org">Cmpl@list.coin-or.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cmpl&d=DwMFaQ&c=NpiPIT1KNSO0vXgGk6ogJQ&r=lti1h6i9rU5mEC99NvhtD9QtmLoHcyEs5V5LTq78EsM&m=iakxlbWQOSKuVBjy57i_AAXrPmasU7QkeNtxBBAYFNY&s=Xzgr46f-5U3RODSHpP9XNrS1zNErazUh_atWM2K16HM&e=">https://list.coin-or.org/mailman/listinfo/cmpl</a><o:p></o:p></p>
</div>
</blockquote>
</div>
</body>
</html>