这是我的模特:
next
使用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;
求解模型时出现以下错误:
glpsol
你能帮帮我吗?我找不到这段代码的错误。
答案 0 :(得分:0)
出现此问题的原因是您向解算器提供了一个模型文件也作为数据文件,即您使用以下命令行调用了glpsol
:
glpsol -m Arquivo1.txt -d Arquivo1.txt
为了解决语法错误,您需要提供一个数据文件,例如: Arquivo1.dat
,与您的模型不同的选项-d
。在数据文件中,您必须为集colunas
和linhas
以及参数a
,b
和c
提供具体数据。获得数据文件后,即可运行:
glpsol -m Arquivo1.txt -d Arquivo1.dat -o solution.sol
最后但同样重要的是,享受solution.sol
中提供的解决方案。