[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Transport model by code
From: |
glpk xypron |
Subject: |
Re: [Help-glpk] Transport model by code |
Date: |
Fri, 01 Aug 2008 07:00:38 +0200 |
Hello Jose,
to find out if the problem is with the model and data files, please, run
glpsol -m your_problem.mod -d your_data.dat --check --wtxt output.out
and have a look at created file output.out.
(Glpsol is the stand alone solver provided with GLPK.)
A minimum working example file showing
- reading a problem
- writing with lpx_print_prob
- solving the problem
is
#include "glpapi.h"
int main()
{
LPX *lp = NULL;
lp = lpx_read_model("examples/sudoku.mod", "examples/sudoku.dat", NULL);
lpx_print_prob(lp, "sudoku.out");
lpx_std_basis(lp);
lpx_simplex(lp);
lpx_delete_prob(lp);
}
The example sudoku problem is provided in the source distribution
ftp://ftp.gnu.org/gnu/glpk/glpk-4.29.tar.gz
If You need further assistance, please, send a link to the relevant files or
add them as attachment.
Best regards
Xypron
-------- Original Message --------
> Hey everyone, I've been playing with GLPK this few days.
> Im trying to pass data to glpk but not from a file, I've been using de
> Reference Manual 4.10 to guide me.
> The problem is that I need to model a transport problem, what I did was to
> create 3 arrays like the manual says.
>
> What I did was to make a program that would read the model and data from
> files, and after resolving the problem, I used lpx_print_prob() so I would
> compare the problem with the one passed by parameters and not reading any
> file.
>
> I succed in part of it. The parameter I goes from 1 to 4, J goes from 1 to
> 32, d is a matrix of 4 x 32 ints.
> When the program its executed and lpx_print_prob executed, I only get part
> of the file like the one it was supposed to be.
> Instead of arrays of 128 ints, it seems i need them of 384 ints, but I do
> not know with what data fill the rest.
>
> I made an experiment adding a coordinate that wasnt in the matrix a[1,33]
> and give him the value of 1.0
> and I got that another parameter was printed in the file, so that gives me
> the idea that I need to keep filling the array with data
> but I dont know where to get more data.
>
> I do not if you guys understan my problem?
>
> Thank you,
>
> --
> José I. Monreal Bailey
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/address@hidden
- Re: [Help-glpk] Transport model by code,
glpk xypron <=