Parsing data file

50 views
Skip to first unread message

Michael Poss

unread,
Dec 2, 2016, 5:28:09 AM12/2/16
to julia-opt
Hi everybody

Modeling languages (e.g. Mosel) feature simple ways to initialize parameters from data files. In Mosel for instance, if SET has been declared as a set using

SET : set of string,

then its content can be read easily using

initializations from "sets.dat"
SET
end-initializations

The same can be done for arrays and even user-defined types. I believe this spares a lot of time for beginners, who may have a hard time implementing a parser. Do you know if something like that exists in Julia ?

Michael.

Miles Lubin

unread,
Dec 2, 2016, 2:31:11 PM12/2/16
to julia-opt
Hi Michael,

Since Julia is a regular programming language that is perfectly capable of reading in data in various forms (CSV, SQL, JSON, etc.), either via built-in commands like readcsv or via external packages, we leave this task for the user. JuMP is much more similar to the solver API interfaces than to Mosel, AMPL, etc. in this regard.

Miles

Changhyun Kwon

unread,
Dec 2, 2016, 3:25:04 PM12/2/16
to juli...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to julia-opt+...@googlegroups.com.
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.

--



Michael Poss

unread,
Dec 3, 2016, 3:35:07 PM12/3/16
to julia-opt
Hell

Thank you both for your answers. It is true that readcsv is quite direct. Yet I was thinking about something even more beginner-friendly, e.g.

parameter = readfile("data.dat", "parameter"),

where data.dat would contain
parameter = [1 0 1 1]

Possibly I'll do it ...

Best,

Michael.
Reply all
Reply to author
Forward
0 new messages