[Cmpl] Question about readcsv and multi-dimension arrays

Michael Bond mbond at videologygroup.com
Thu Sep 12 14:22:44 EDT 2013


I'm just getting started with CMPL and have what seems like a rather basic question. Given the following CMPL model how what should the csv for r be formatted:

    parameters:
        plants := "seattle", "san_diego"
        markets := "new_york", "chicago", "topeka"
        r[plants, markets] := readcsv("r.csv");

Using the following in r.csv:

2.5,1.7,1.8
2.5,1.8,1.4

I get the following errors:

error (interpreter): file transport.cmpl line 9: Count of elements for the 1. index of 'r' is wrong
error (interpreter): file transport.cmpl line 9: Count of elements for the 2. index of 'r' is wrong

Using the following in r.csv:

new_york,chicago,topeka
seattle,2.5,1.7,1.8
san_diego,2.5,1.8,1.4

I get the following errors:

error (interpreter): file transport.cmpl line 9: Count of elements for the 1. index of 'r' is wrong
error (interpreter): file transport.cmpl line 9: Count of elements for the 2. index of 'r' is wrong
error (interpreter): file transport.cmpl line 9: Count of elements for the 2. index of 'r' is wrong
error (interpreter): file transport.cmpl line 9: Count of elements for the 2. index of 'r' is wrong

I've tried a number of other variations with no success. I've seen the readcsv examples that use an unbounded array (r[,]) but for would prefer to use bounded arrays. Any help would be welcome.
This email is intended only for the use of the individual(s) to whom it is addressed. If you have received this communication in error, please immediately notify the sender and delete the original email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cmpl/attachments/20130912/454f1967/attachment.html>


More information about the Cmpl mailing list