<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Hi Bhrett,</div><div><br></div><div>Hmm I am actually scatty because I forgotten to answer your second question:</div><div><br></div><div>This expression works:</div><div><br></div><div><blockquote type="cite"><div class="WordSection1"><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">tonnage_intervals$1$ {<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">s in seasons,<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">g in grains,<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">i in approximation_intervals:<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">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></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">}</span></font></p></div></blockquote></div><div><br></div><div>if you imbed <span style="background-color: rgba(255, 255, 255, 0);">1/len(approximation_intervals in brackets:</span></div><div><blockquote type="cite"><div class="WordSection1"><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">tonnage_intervals$1$ {<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">s in seasons,<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">g in grains,<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">i in approximation_intervals:<o:p></o:p></span></font></p><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);">tonnage_intervals[i,s,g] = worldwide_demand[s,g] * i * (1/len(approximation_intervals));</span></font></p></div></blockquote><blockquote type="cite"><div class="WordSection1"><p class="MsoNormal"><span style="background-color: rgba(255, 255, 255, 0); font-family: UICTFontTextStyleTallBody;">}</span></p></div></blockquote><br></div><div>Mike</div><div><div class="WordSection1"><p class="MsoNormal"><font color="#000000" face="UICTFontTextStyleTallBody" size="3"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></font></p></div></div><div><br></div><div><br>Am 15.11.2017 um 20:52 schrieb Ogden, Bhrett A. <<a href="mailto:ogdenba@cdmsmith.com">ogdenba@cdmsmith.com</a>>:<br><br></div><blockquote type="cite"><div>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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;}
/* 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-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></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]-->
<div class="WordSection1">
<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>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Cmpl mailing list</span><br><span><a href="mailto:Cmpl@list.coin-or.org">Cmpl@list.coin-or.org</a></span><br><span><a href="https://list.coin-or.org/mailman/listinfo/cmpl">https://list.coin-or.org/mailman/listinfo/cmpl</a></span></div></blockquote></body></html>