Hello Nicolas,

to pass n values to a GLPK library function you will need to create
an array of size n+1 because index 0 is not used.

For details see glpk-4.45/doc/glpk.pdf of the source distribution.

I have started wrapping GLPK into easier to use classes. See example
at 
http://glpk.dyndns.org/svn/linopt/trunk/src/main/java/de/xypron/linopt/examples/CutSimple.java

You can check out the code with
svn co http://glpk.dyndns.org/svn/linopt/trunk/

I use Maven as a build system. After building GLPK for
Java you can go to directory glpk-java-1.0.16/swig and use
mvn install
for installation of GLPK for Java in the local Maven repository.


Please, replace 
        // System.out.print("Maximum constraint " +cst_i+ " : ");
        GLPK.glp_add_rows(lp, 1);
        GLPK.glp_set_row_name(lp, cst_i, "Sum_max");
        GLPK.glp_set_row_bnds(lp, cst_i, GLPKConstants.GLP_FX, 1, 1);
        ind = GLPK.new_intArray(Objectives.length);
        System.out.println("test1");
        val = GLPK.new_doubleArray(Objectives.length);

by

        // System.out.print("Maximum constraint " +cst_i+ " : ");
        GLPK.glp_add_rows(lp, 1);
        GLPK.glp_set_row_name(lp, cst_i, "Sum_max");
        GLPK.glp_set_row_bnds(lp, cst_i, GLPKConstants.GLP_FX, 1, 1);
        ind = GLPK.new_intArray(Objectives.length+1); //<==changed
        System.out.println("test1");
        val = GLPK.new_doubleArray(Objectives.length+1); //<==changed

in method compute_mrvf of your code.

Best regards

Xypron

> -------- Forwarded Message --------
> From: Albarello Nicolas
> To: [email protected]
> Subject: EXCEPTION_ACCESS_VIOLATION
> Date: Tue, 4 Jan 2011 10:28:15 +0100
> 
> Hi,
> 
>  
> 
> I developed a Java program using glpk. I saw that running the main
> method several times produces a JRE crash (every 31 launches).
> 
> I debugged the method and I saw that the crash is caused by the absence
> of pointers to a SWIGTYPE_p_int variable “ind”. The command “ind =
> GLPK.new_intArray(Objectives.length * 2 + 1); » seems to be not executed
> and thus the ind pointer is null. The val pointer is also null. I
> suppose it is a matter of id of the variable. 
> 
> Would you have an idea how to solve the problem? 
> 
> I enclose the java code and the bug report. The error is in the UTAgms
> class at line 171.
> 
>  
> 
> Regards,
> 
> Nicolas ALBARELLO
> 
>  
> 
> 

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

_______________________________________________
Bug-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-glpk

Reply via email to