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.

2
  • Can you post what you have in 'Arquivo1.txt' file? Commented Jan 28, 2016 at 17:34
  • are your rows/constraints missing x variables? Commented Mar 1, 2016 at 6:02

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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.
Done. Thanks! @Arton Dorneles

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.