Quantcast

Parsing data file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Parsing data file

Michael Poss
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.

--
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 [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Parsing data file

Miles Lubin
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

On Friday, December 2, 2016 at 5:28:09 AM UTC-5, Michael Poss wrote:
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.

--
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 [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Parsing data file

Changhyun Kwon
Here is one such example:

https://github.com/chkwon/jpor_codes/blob/master/chap6/transportation1.jl




where the data file is in CSV format.


On Dec 2, 2016, at 2:31 PM, Miles Lubin <[hidden email]> wrote:

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

On Friday, December 2, 2016 at 5:28:09 AM UTC-5, Michael Poss wrote:
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.

--
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 [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.

--



--
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 [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Parsing data file

Michael Poss
In reply to this post by Michael Poss
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.

Le vendredi 2 décembre 2016 11:28:09 UTC+1, Michael Poss a écrit :
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.

--
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 [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Loading...