[Cmpl] Piece-Wise Linearization Syntax Question

Ogden, Bhrett A. ogdenba at cdmsmith.com
Wed Nov 15 14:52:58 EST 2017


Thank you for your prompt answer to my last question.

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.

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?

transport_cost$1$ {
e in export_ports,
i in import_ports,
s in seasons,
g in grains,
r in route_type:
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];
}

Would you also be able to explain why I get a syntax error if I divide in the following situation?:

tonnage_intervals$1$ {
s in seasons,
g in grains,
i in approximation_intervals:
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.
}

Thank you for your assistance.

Best,
Bhrett Ogden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cmpl/attachments/20171115/c10d96b8/attachment.html>


More information about the Cmpl mailing list