[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Different results from gusek and glpk-java API using sam

From: xypron
Subject: Re: [Help-glpk] Different results from gusek and glpk-java API using same data
Date: Tue, 26 Jan 2010 22:50:26 -0800 (PST)

Hello Sana,

looking at doc/gmpl.pdf you will find that different API functions are used
for pure linear problems and mixed integer problems.

To solve a mip use glp_intopt(lp, iocp).
To retrieve a mip solution use glp_mip_col_val(lp, i).

Please, have a look at examples/java/, compare it to 

If you want to know how the standalone solver glpsol uses the API study
the code in src/glpapi20.c.

Best regards


Sana Jawad wrote:
> Hello,
> I am calling my model written in MathProg from java using glpk-java API.
> In
> my model I have a variable named "assign"
> var assign{w in Weekdays,s in Shifts,p in People,j in Skills},integer,>=
> 0,
> <= 1;   /*Indicates a shift assignment*/
> When I solve it through gusek I always get a binary solution. But When I
> call it from java and display the value using these statements:
> for(int i=1; i <= n; i++)
>             {
>              name = GLPK.glp_get_col_name(lp, i);
>              val=GLPK.glp_get_col_prim(lp, i);
>             System.out.print(name);
>             System.out.print(" = ");
>             System.out.println(val);
>             }
> I see a few non-binary values like :
> assign[Mon,1,Abe,cashier] = 4.440892098500571E-17
> assign[Mon,1,Charles,cashier] = -1.0362081563168091E-16
> Their value is "0" in gusek output
> These variables have an effect on the values of other variables as well.
> Although the value of object function remains unchanged.
> The strange thing is that I have display statement after solve statement
> in
> my model. Its output on my console does not have any non-binary value. But
> the result has non-binary values when I access the values using the code.
> Can any one please help me.
> Best Regards,
> Sana
> _______________________________________________
> Help-glpk mailing list
> address@hidden

View this message in context:
Sent from the Gnu - GLPK - Help mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]