Al tratar de ejecutar el programa desde eclipse cdt muestra el mensaje:
Error on translating model
Reading model section from sudoku.mod...
(unknown):0: unable to open sudoku.mod - No such file or directory
Los datos sudoku.mod y sudoku.dat fueron copiados a la carpeta que contiene el programa compilado.
Código C:
Ver original#include <stdlib.h>
#include <stdio.h>
#include <glpk.h>
int main()
{
glp_prob *mip;
glp_tran *tran;
int ret;
mip = glp_create_prob();
tran = glp_mpl_alloc_wksp();
ret = glp_mpl_read_model(tran, "sudoku.mod", 1);
if(ret != 0)
{
fprintf(stderr
, "Error on translating model\n"); goto skip;
}
ret = glp_mpl_read_data(tran, "sudoku.dat");
if(ret != 0)
{
fprintf(stderr
, "Error on translating data\n"); goto skip;
}
ret = glp_mpl_generate(tran, NULL);
if(ret != 0)
{
fprintf(stderr
, "Error on generating model\n"); goto skip;
}
glp_mpl_build_prob(tran, mip);
glp_simplex(mip, NULL);
glp_intopt(mip, NULL);
ret = glp_mpl_postsolve(tran, mip, GLP_MIP);
if(ret != 0)
{
fprintf(stderr
, "Error on postsolving model\n"); }
skip: glp_mpl_free_wksp(tran);
glp_delete_prob(mip);
return 0;
}