Hello Martin, please, check that the CSV file is not opened by an other program.
Excel locks opened files. Same happens if Java opens a file for writing. The lock is kept until the file is closed. Best regards Heinrich Schuchardt http://www.xypron.de Am 06.01.15 um 11:53 schrieb Martin Albrecht > Dear all, > > > > I am running a GLPK model that is sequentially started from a frame > > program in Java. > > The frame program does the following: > > -It creates data files (.csv) that are read in by the GLPK model thereafter > > -The call of the GLPK model is according to the help documentation: > > > > /public void start() { > > > > glp_prob lp = null; > > glp_tran tran; > > glp_iocp iocp; > > > > int skip = 0; > > int ret; > > > > // GlpkCallback.addListener(this); > > > > lp = GLPK.glp_create_prob(); > > System.out.println("Problem created"); > > > > tran = GLPK.glp_mpl_alloc_wksp(); > > ret = GLPK.glp_mpl_read_model(tran, fname, skip); > > if (ret != 0) { > > GLPK.glp_mpl_free_wksp(tran); > > GLPK.glp_delete_prob(lp); > > throw new RuntimeException("Model file not found: " + > > fname); > > } > > > > // generate model > > GLPK.glp_mpl_generate(tran, null); > > // build model > > GLPK.glp_mpl_build_prob(tran, lp); > > // set solver parameters > > iocp = new glp_iocp(); > > GLPK.glp_init_iocp(iocp); > > iocp.setPresolve(GLPKConstants.GLP_ON); > > // solve model > > ret = GLPK.glp_intopt(lp, iocp); > > // postsolve model > > if (ret == 0) { > > GLPK.glp_mpl_postsolve(tran, lp, GLPKConstants.GLP_MIP); > > } > > // free memory > > GLPK.glp_mpl_free_wksp(tran); > > GLPK.glp_delete_prob(lp); > > > > } > > }/ > > > > The GKLP model writes some output tables (csv.), and the results are > > read in again by Java after terminating the optimization run, and so on. > > > > Unfortunately, I get sometime error when opening the .csv files. > > Here is an example: > > / > > csv_driver: unable to open BOM.csv - Permission denied > > allocation.mod:113: error on opening table tab_BOM > > glp_mpl_build_prob: invalid call sequence > > Error detected in file ..\src\glpapi14.c at line 93/ > > > > I do not get this error at each call of the Java model (one error after > > approx. 50 calls). Moreover, these errors do not occur in a > > deterministic manner, they cannot be reproduced. I each run of the Java > > program they occur at another place. > > > > Do you have any advice what I could do about that? > > > > Many thanks for your effort. > > > > Best regards > > Martin > > _______________________________________________ > > Help-glpk mailing list > > [email protected] > > https://lists.gnu.org/mailman/listinfo/help-glpk _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
