Re: [Help-glpk] scaling in glpk_4_64.dll

2018-03-16 Thread Heinrich Schuchardt
Hello Jean-Christophe,

I have now installed a 64bit Excel 2010.

I observed the following:

I open a new Excel, import modules lp.bas and glpk.bas, and run routine
lp(). Excel crashes.

I open a new Excel, import modules lp.bas and glpk.bas, I comment the
lines setting the callbacks and run routine lp(). Excel successfully
runs the program.

I open a new Excel, import modules lp.bas and glpk.bas, I comment the
lines setting the callbacks, uncomment the lines and run routine lp().
Excel successfully runs the program.

I moved the callback routines from glpk.bas to lp.bas. I open a new
Excel, import the modified modules lp.bas and glpk.bas, and run routine
lp(). Excel successfully runs the program.

I currently have no clue why this inconsistent behavior occurs.

Best regards

Heinrich

On 03/16/2018 03:39 PM, Huber, Jean-Christophe wrote:
> Dear GLPK-team,
> 
>  
> 
> I’m using GLPK64 from VBA/Excel and wanted to define scaling options.
> 
> In the given example for VBA (file glpk.bas in the GLPK64 zip file from
> SourceForge), there is no declaration for the scaling function.
> 
>  
> 
> I tried adding manually as defined below:
> 
>  
> 
> /#if win64 then/
> 
> /Declare PtrSafe Sub glp_scale_prob Lib "C:\GLP_DLL\glpk_4_64.dll"
> (ByVal lp As LongPtr, ByVal flags As Long)/
> 
> /#else/
> 
> /Declare PtrSafe Sub glp_scale_prob Lib
> "C:\GLP_DLL\glpk_4_64_stdcall.dll" (ByVal lp As LongPtr, ByVal flags As
> Long)/
> 
> /#endif/
> 
>  
> 
> This works well in win32, using the stdcall compilation.
> 
> This does not work (VBA crashes at execution) when using the w64 build.
> Without scaling, there is no other issue with other functions.
> 
>  
> 
> By the way, there is also no declaration for « glp_print_sol » function
> of GLPK. I could ad dit but I’m wondering why the example in GLPK.bas do
> not include it. Any issue with it ?
> 
>  
> 
> Thansk for support / advice
> 
> Regards
> 
> 
> 
> ___
> Help-glpk mailing list
> Help-glpk@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-glpk
> 


___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] scaling in glpk_4_64.dll

2018-03-16 Thread Heinrich Schuchardt
On 03/16/2018 03:39 PM, Huber, Jean-Christophe wrote:
> Dear GLPK-team,
> 
>  
> 
> I’m using GLPK64 from VBA/Excel and wanted to define scaling options.
> 
> In the given example for VBA (file glpk.bas in the GLPK64 zip file from
> SourceForge), there is no declaration for the scaling function.
> 
>  
> 
> I tried adding manually as defined below:
> 
>  
> 
> /#if win64 then/
> 
> /Declare PtrSafe Sub glp_scale_prob Lib "C:\GLP_DLL\glpk_4_64.dll"
> (ByVal lp As LongPtr, ByVal flags As Long)/
> 
> /#else/
> 
> /Declare PtrSafe Sub glp_scale_prob Lib
> "C:\GLP_DLL\glpk_4_64_stdcall.dll" (ByVal lp As LongPtr, ByVal flags As
> Long)/

Your definition looks ok. Could you, please, send me a Basic module
(*.bas file) demonstrating the problem.

In the 4.65 release of GLPK for Windows I will add the missing scaling
function definitions for VBA.

' scaling options:
Public Const GLP_SF_GM = &H1 ' perform geometric mean scaling
Public Const GLP_SF_EQ = &H10' perform equilibration scaling
Public Const GLP_SF_2N = &H20' round scale factors to power of two
Public Const GLP_SF_SKIP = &H40  ' skip if problem is well scaled
Public Const GLP_SF_AUTO = &H80  ' choose scaling options automatically

' Problem scaling routines
' set (change) row scale factor
Declare PtrSafe Sub glp_set_rii(ByVal lp As LongPtr, ByVal i As Long,
ByVal rii As Double)
' set (change) column factor
Declare PtrSafe Sub glp_set_sjj(ByVal lp As LongPtr, ByVal j As Long,
ByVal sjj As Double)
' retrieve row scale factor
Declare PtrSafe Function glp_get_rii(ByVal lp As LongPtr, ByVal i As
Long) As Double
' retrieve column factor
Declare PtrSafe Function glp_get_sjj(ByVal lp As LongPtr, ByVal j As
Long) As Double
' scale problem data
Declare PtrSafe Sub glp_scale_prob(ByVal lp As LongPtr, ByVal flags As Long)
' unscale problem data
Declare PtrSafe Sub glp_unscale_prob(ByVal lp As LongPtr)

Best regards

Heinrich Schuchardt

___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] scaling in glpk_4_64.dll

2018-03-16 Thread Heinrich Schuchardt
Hello Jean-Christophe,

VBA is a 32bit stdcall application. You cannot call 64bit libraries.

Is your problem too big for 32bit?

Best regards

Heinrich Schuchardt

http://www.xypron.de

Am 16.03.18 um 15:39 schrieb Huber, Jean-Christophe

> Dear GLPK-team,
> 
> I'm using GLPK64 from VBA/Excel and wanted to define scaling options.
> In the given example for VBA (file glpk.bas in the GLPK64 zip file from 
> SourceForge), there is no declaration for the scaling function.
> 
> I tried adding manually as defined below:
> 
> #if win64 then
> Declare PtrSafe Sub glp_scale_prob Lib "C:\GLP_DLL\glpk_4_64.dll" (ByVal lp 
> As LongPtr, ByVal flags As Long)
> #else
> Declare PtrSafe Sub glp_scale_prob Lib "C:\GLP_DLL\glpk_4_64_stdcall.dll" 
> (ByVal lp As LongPtr, ByVal flags As Long)
> #endif
> 
> This works well in win32, using the stdcall compilation.
> This does not work (VBA crashes at execution) when using the w64 build. 
> Without scaling, there is no other issue with other functions.
> 
> By the way, there is also no declaration for < glp_print_sol > function of 
> GLPK. I could ad dit but I'm wondering why the example in GLPK.bas do not 
> include it. Any issue with it ?
> 
> Thansk for support / advice
> Regards
> ___
> Help-glpk mailing list
> Help-glpk@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-glpk

___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


[Help-glpk] scaling in glpk_4_64.dll

2018-03-16 Thread Huber, Jean-Christophe
Dear GLPK-team,

I'm using GLPK64 from VBA/Excel and wanted to define scaling options.
In the given example for VBA (file glpk.bas in the GLPK64 zip file from 
SourceForge), there is no declaration for the scaling function.

I tried adding manually as defined below:

#if win64 then
Declare PtrSafe Sub glp_scale_prob Lib "C:\GLP_DLL\glpk_4_64.dll" (ByVal lp As 
LongPtr, ByVal flags As Long)
#else
Declare PtrSafe Sub glp_scale_prob Lib "C:\GLP_DLL\glpk_4_64_stdcall.dll" 
(ByVal lp As LongPtr, ByVal flags As Long)
#endif

This works well in win32, using the stdcall compilation.
This does not work (VBA crashes at execution) when using the w64 build. Without 
scaling, there is no other issue with other functions.

By the way, there is also no declaration for < glp_print_sol > function of 
GLPK. I could ad dit but I'm wondering why the example in GLPK.bas do not 
include it. Any issue with it ?

Thansk for support / advice
Regards
___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk