problem with parameter

View: New views
3 Messages — Rating Filter:   Alert me  

problem with parameter

by Daniele Micarelli :: Rate this Message:

| View Threaded | Show Only this Message

i have to write in file.DAT one parameter in two dimensions w[i,t]
when i the index of the activity and t is the index of the time interval

My problem is that the time interval is 0..600 and i don't know how to write it on file.DAT because it is too large

I know its not about GLPK but i hope it's already happened to someone

thank you very much

best

_______________________________________________
Help-glpk mailing list
Help-glpk@...
https://lists.gnu.org/mailman/listinfo/help-glpk

Re: problem with parameter

by xypron :: Rate this Message:

| View Threaded | Show Only this Message

Hello Daniele,

where is your problem in writing the data file?
A data file can have as many lines as you want.

set I:= {0..100};
set T:= {0..600};
param w{I,T};

data;
param w :=
  [  0,  0] 0.128312
  [  0,  1] 0.009597
...
  [  0,600] 0.029687
  [  1,  0] 0.553792
...
  [  1,600] 0.818264
...
  [100,600] 0.029687
...
  [100,600] 0.412226
end;

Just replace ... by the missing lines.

Best regards

Xypron

-------- Original-Nachricht --------
> Datum: Mon, 16 Jul 2012 18:42:59 +0200
> Betreff: [Help-glpk] problem with parameter

> i have to write in file.DAT one parameter in two dimensions *w[i,t]*
> when *i* the index of the activity and *t* is the index of the time
> interval
>
> My problem is that the time interval is 0..600 and i don't know how to
> write it on file.DAT because it is too large
>
> I know its not about GLPK but i hope it's already happened to someone
>
> thank you very much
>
> best

_______________________________________________
Help-glpk mailing list
Help-glpk@...
https://lists.gnu.org/mailman/listinfo/help-glpk

Parent Message unknown Re: problem with parameter

by Robbie Morrison :: Rate this Message:

| View Threaded | Show Only this Message


Hello Daniele

------------------------------------------------------------
To:           Daniele Micarelli <danielemicarelli@...>,
              help-glpk@...
Subject:      Re: [Help-glpk] problem with parameter
Message-ID:  <20120716205409.267620@...>
From:        "glpk xypron" <xypron.glpk@...>
Date:         Mon, 16 Jul 2012 22:54:09 +0200
------------------------------------------------------------

Just to add to what Xypron suggested.  If your original
data is table-oriented (also known as a flat file
database), then you will need to pre-process that to get
it into the required data format:

  http://en.wikipedia.org/wiki/Flat_file_database

There are many ways of doing this, depending on your
circumstances.  Any scripting language will do:

  http://en.wikipedia.org/wiki/Python_%28programming_language%29

Also, any problem-oriented environment:

  http://en.wikipedia.org/wiki/Matlab
  http://en.wikipedia.org/wiki/Octave

Or programming text editor:

  http://en.wikipedia.org/wiki/GNU_Emacs

Text files of hundreds of thousands of lines are not a
problem for modern operating systems -- although text
strings are very inefficient for storing numbers.
That said, hard drives are cheap nowadays.

You do realize too that you can read spreadsheet
data directly into GLPK using GMPL/MathProg:

  http://en.wikibooks.org/wiki/GLPK/ODBC

HTH, Robbie
---

> Hello Daniele,
>
> where is your problem in writing the data file?
> A data file can have as many lines as you want.
>
> set I:= {0..100};
> set T:= {0..600};
> param w{I,T};
>
> data;
> param w :=
>   [  0,  0] 0.128312
>   [  0,  1] 0.009597
> ...
>   [  0,600] 0.029687
>   [  1,  0] 0.553792
> ...
>   [  1,600] 0.818264
> ...
>   [100,600] 0.029687
> ...
>   [100,600] 0.412226
> end;
>
> Just replace ... by the missing lines.
>
> Best regards
>
> Xypron

---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : morrison@...
Webmail (preferred)           : robbie@...
[from Webmail client]



_______________________________________________
Help-glpk mailing list
Help-glpk@...
https://lists.gnu.org/mailman/listinfo/help-glpk