2

This is my model:

set linhas;
set colunas;
param c{j in colunas};
param A{i in linhas,j in colunas};
param b{i in linhas};

var x{j in colunas}>=0;

minimize FO:
   sum{j in colunas} c[j]*x[j];

s.t. R{i in linhas}:
   sum{j in colunas} A[i,j] = b[i];

end;

I got the following error when solving the model with glpsol:

Arquivo1.txt:3: syntax error in parameter data block
Context:  set linhas ; set colunas ; param c {
MathProg model processing error.

Can you help me? I could not find what's wrong with this code.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mar Oli
  • 67
  • 8

1 Answers1

0

This problem occurred because you provided to the solver a model file also as a data file, i.e., you invoked glpsol using the following command-line:

glpsol -m Arquivo1.txt -d Arquivo1.txt

In order to solve the syntax error you need to provide a data file, e.g. Arquivo1.dat, to the option -d that is different from your model . In the data file you must provide concrete data to your sets colunas and linhas, as well as to your parameters a, b, and c. Once you have a data file, you can run:

glpsol -m Arquivo1.txt -d Arquivo1.dat -o solution.sol

Last but not least, enjoy the solution provided in solution.sol.

Arton Dorneles
  • 1,629
  • 14
  • 18
  • Hi @MarOli if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – Arton Dorneles Sep 22 '16 at 00:05
  • Done. Thanks! @Arton Dorneles – Mar Oli Sep 30 '16 at 14:48