List Info

Thread: Re: Requesting help regarding running LPSOLVE-MATLAB on windows xp64




Re: Requesting help regarding running LPSOLVE-MATLAB on windows xp64
country flaguser name
United States
2008-06-11 16:21:04

Thanks again Peter.

I made your suggested changes and as a result compilation ended
successfully, however I am getting linking errors now all on
";unresolved external symbol" as follows (truncated so save email space):

----------------------------------------------------------
Compiling in progress. Please wait...
compiling...
linking...
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

lpsolve.obj matlab.obj hash.obj lp_explicit.lib
Creating library
C:DOCUME~1ADMINI~1LOCALS~1Tempmex_VeYBtMtemplib.x and object
C:DOCUME~1ADMINI~1LOCALS~1Tempmex_VeYBtMtemplib.exp
lpsolve.obj : error LNK2019: unresolved external symbol putabortfunc
referenced in function create_handle
lpsolve.obj : error LNK2019: unresolved external symbol
__set_outputfile referenced in function create_handle
lpsolve.obj : error LNK2019: unresolved external symbol putlogfunc
referenced in function create_handle

-
-
- (I truncated similar errors)
-
-

lpsolve.obj : error LNK2019: unresolved external symbol
init_lpsolve_lib referenced in function mainloop
lpsolve.obj : error LNK2019: unresolved external symbol __set_obj
referenced in function impl_set_obj
mxlpsolve.mexw64 : fatal error LNK1120: 204 unresolved externals

C:PROGRA~1MATLABR2008ABINMEX.PL: Error: Link of
'mxlpsolve.mexw64' failed.

??? Error using ==> mex at 207
Unable to complete successfully.

Error in ==> Makefile64 at 66
eval(['mex ' '-largeArrayDims' ' lpsolve' objext ' matlab' objext '
hash' objext ' ' libs '
-output mxlpsolve']);
----------------------------------------------------------

Please help again.

Thanks and regards,
shaheen

--- In lp_solve%40yahoogroups.com">lp_solveyahoogroups.com, "Peter Notebaert&quot; <_peno_...> wrote:
&gt;
> Apparently your C compiler does not define WIN32. Because of that the
> sources act as if they are compiled for unix with those compilation
error.
> Try the following:
>
> Edit Makefile64 and locate the entry -D_WINDOWS
> Add there -DWIN32 with spaces before and after and then try again.
&gt;
> Peter
&gt;
> On Tue, Jun 10, 2008 at 2:22 AM, shaheenn <shaheenn...> wrote:
&gt;
> > Thanks, Peter! Sorry for the insufficient info. I am using 64 bit
> > Matlab(r2008a) and 64 bit C/C++ compiler on Athlon x2 6400+ machine. I
> > am getting compilation error as follows:
> >
>; > ----------------------------------------------------------
> > Compiling in progress. Please wait...
> > compiling...
> > lpsolve.c
> > c:sourcelp_lib.h(214) : fatal error C1083: Cannot open include file:
&gt; > 'dlfcn.h': No such file or directory
> >
>; > C:PROGRA~1MATLABR2008ABINMEX.PL: Error: Compile of 'lpsolve.c'
> > failed.
> >
>; > ??? Error using ==> mex at 207
> > Unable to complete successfully.
> >
>; > Error in ==> Makefile64 at 64
> > eval(['mex ' '-largeArrayDims' debug ' -D_WINDOWS -DMATLAB
> > -DINLINE=static -I' lpsolvepath ' '
> > lpsolvelibpath ' -c ' what]);
> >
>; > ------------------------------------------------
> >
>; > I would appreciate your kind help.
&gt; >
>; > Best regards,
> > shaheen
> >
>; > --- In lp_solve%40yahoogroups.com">lp_solveyahoogroups.com <lp_solve%40yahoogroups.com&gt;, "Peter
> > Notebaert&quot; <_peno_> wrote:
&gt; > >
>; > > It is not because your XP is 64-bit that the application is 64-bit.
> > Do you have a 64-bit MATLAB version? If not and this 32-bit then you
> > must use the 32-bit lpsolve also.
&gt; > > If it is 64-bit MATLAB version then you will need a 64 bit compiler.
> > Apparently you have but you don't specify what error you get. Do you
> > get a compilation/link error of some kind?
&gt; > >
>; > > Peter
&gt; > >
>; > >
>; > > Sent: Friday, June 06, 2008 03:52
&gt; > > To: lp_solve%40yahoogroups.com">lp_solveyahoogroups.com <lp_solve%40yahoogroups.com&gt;
> > > Subject: [lp_solve] Requesting help regarding running LPSOLVE-MATLAB
> > on windows xp64
>; > >
>; > >
>; > > Dear all,
>; > >
>; > > I have been trying to install LPSOLVE-MATLAB on XP64. I understand
> > that the 'mxlpsolve.dll' file that comes with
>; > 'lp_solve_5.5.0.12_MATLAB_exe.zip' is compiled for win32, and hence
&gt; > gives following error message.
> > >
>; > > -------------------------
&gt; > > mxlpsolve driver not found !!!
> > > Check if mxlpsolve.dll is on your system and in a directory known to
> > MATLAB.
> > > Press enter to see the paths where MATLAB looks for the driver.
> > > ------------------------
>; > >
>; > > I tried to compile driver from source files using
&gt; > Makefile.m/Makefile64.m and 64 bit C/C++ compiler, and could not make
>; > it so far.
>; > >
>; > > I would appreciate your help.
&gt; > >
>; > > Kind regards,
> > > Shaheen
> > >
>; >
>; >
> >
>;

__._,_.___
.

__,_._,___
Re: Re: Requesting help regarding running LPSOLVE-MATLAB on windows xp64
country flaguser name
Belgium
2008-06-11 16:27:35

Have you also created the lpsolve55.a and/or lpsolve55.so libraries?
Since you are on a 64 bit platform you must also compile the lpsolve libraries themselves and make sure they can be found to link with the mathlab wrapper.
 
Peter

Sent: Wednesday, June 11, 2008 23:21
Subject: [lp_solve] Re: Requesting help regarding running LPSOLVE-MATLAB on windows xp64

Thanks again Peter.

I made your suggested changes and as a result compilation ended
successfully, however I am getting linking errors now all on
"unresolved external symbol" as follows (truncated so save email space):

----------------------------------------------------------
Compiling in progress. Please wait...
compiling...
linking...
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

lpsolve.obj matlab.obj hash.obj lp_explicit.lib
Creating library
C:DOCUME~1ADMINI~1LOCALS~1Tempmex_VeYBtMtemplib.x and object
C:DOCUME~1ADMINI~1LOCALS~1Tempmex_VeYBtMtemplib.exp
lpsolve.obj : error LNK2019: unresolved external symbol putabortfunc
referenced in function create_handle
lpsolve.obj : error LNK2019: unresolved external symbol
__set_outputfile referenced in function create_handle
lpsolve.obj : error LNK2019: unresolved external symbol putlogfunc
referenced in function create_handle

-
-
- (I truncated similar errors)
-
-

lpsolve.obj : error LNK2019: unresolved external symbol
init_lpsolve_lib referenced in function mainloop
lpsolve.obj : error LNK2019: unresolved external symbol __set_obj
referenced in function impl_set_obj
mxlpsolve.mexw64 : fatal error LNK1120: 204 unresolved externals

C:PROGRA~1MATLABR2008ABINMEX.PL: Error: Link of
'mxlpsolve.mexw64' failed.

??? Error using ==> mex at 207
Unable to complete successfully.

Error in ==> Makefile64 at 66
eval(['mex ' '-largeArrayDims' ' lpsolve' objext ' matlab' objext '
hash' objext ' ' libs '
-output mxlpsolve']);
----------------------------------------------------------

Please help again.

Thanks and regards,
shaheen

--- In lp_solve%40yahoogroups.com">lp_solveyahoogroups.com, "Peter Notebaert" <_peno_...> wrote:
>;
> Apparently your C compiler does not define WIN32. Because of that the
> sources act as if they are compiled for unix with those compilation
error.
&gt; Try the following:
>
> Edit Makefile64 and locate the entry -D_WINDOWS
> Add there -DWIN32 with spaces before and after and then try again.
&gt;
> Peter
>
> On Tue, Jun 10, 2008 at 2:22 AM, shaheenn <shaheenn...> wrote:
>;
> > Thanks, Peter! Sorry for the insufficient info. I am using 64 bit
> > Matlab(r2008a) and 64 bit C/C++ compiler on Athlon x2 6400+ machine. I
> > am getting compilation error as follows:
&gt; >
> > ----------------------------------------------------------
> > Compiling in progress. Please wait...
&gt; > compiling...
> > lpsolve.c
> > c:sourcelp_lib.h(214) : fatal error C1083: Cannot open include file:
> > 'dlfcn.h': No such file or directory
> >
> > C:PROGRA~1MATLABR2008ABINMEX.PL: Error: Compile of 'lpsolve.c'
> > failed.
&gt; >
> > ??? Error using ==> mex at 207
> > Unable to complete successfully.
> >
>; > Error in ==> Makefile64 at 64
> > eval(['mex ' '-largeArrayDims' debug ' -D_WINDOWS -DMATLAB
&gt; > -DINLINE=static -I' lpsolvepath ' '
> > lpsolvelibpath ' -c ' what]);
&gt; >
> > ------------------------------------------------
> >
>; > I would appreciate your kind help.
> >
> > Best regards,
&gt; > shaheen
&gt; >
> > --- In lp_solve%40yahoogroups.com">lp_solveyahoogroups.com <lp_solve%40yahoogroups.com>, "Peter
>; > Notebaert" <_peno_> wrote:
>; > >
> > > It is not because your XP is 64-bit that the application is 64-bit.
&gt; > Do you have a 64-bit MATLAB version? If not and this 32-bit then you
> > must use the 32-bit lpsolve also.
> > > If it is 64-bit MATLAB version then you will need a 64 bit compiler.
> > Apparently you have but you don't specify what error you get. Do you
> > get a compilation/link error of some kind?
> > >
> > > Peter
> > >
>; > >
> > > Sent: Friday, June 06, 2008 03:52
&gt; > > To: lp_solve%40yahoogroups.com">lp_solveyahoogroups.com <lp_solve%40yahoogroups.com>
> > > Subject: [lp_solve] Requesting help regarding running LPSOLVE-MATLAB
> > on windows xp64
>; > >
> > >
> > > Dear all,
> > >
> > > I have been trying to install LPSOLVE-MATLAB on XP64. I understand
> > that the 'mxlpsolve.dll' file that comes with
>; > 'lp_solve_5.5.0.12_MATLAB_exe.zip' is compiled for win32, and hence
> > gives following error message.
&gt; > >
>; > > -------------------------
> > > mxlpsolve driver not found !!!
> > > Check if mxlpsolve.dll is on your system and in a directory known to
> > MATLAB.
&gt; > > Press enter to see the paths where MATLAB looks for the driver.
&gt; > > ------------------------
> > >
> > > I tried to compile driver from source files using
> > Makefile.m/Makefile64.m and 64 bit C/C++ compiler, and could not make
>; > it so far.
> > >
> > > I would appreciate your help.
> > >
> > > Kind regards,
&gt; > > Shaheen
&gt; > >
> >
> >
> >
>;

__._,_.___
.

__,_._,___
Strange behaviour in MIP Problem
country flaguser name
Brazil
2008-06-12 09:04:18

Dear all
 
I developed a model to solve a MIP problem envolving resource alocation for some demands. It's simple, but with a large number of variables. Well, analysing some results, i found a apparent problem with some binary variables used with real variables in certain constraints. It seems that in some cases the result don't "respect"&nbsp;constraints, but lp-solve shows "optimal solution" found. I reduce the model to show you the question:
 
###### (1) Original model:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
Explaining: I have two binary variables [B1,B2] but accept only one with value [1] as result. The other will set to zero [0]. The real variable [R1,R2] are associated with binary variables [B1,B2]. So, R1 can be non zero only in case B1 is non zero. On other way, R2 can be non zero only in case B2 is non zero. So i expected that if R1 is non zero, R2 is zero. Or if R2 is non zero, R1 must be zero. But when we process this model in lp-solve (using IDE, for example), we receive the result:
 
B1: 1
B2: 0
R1: 0.9510869...
R2: 0.0489130...  => Here is the problem !!! How can this occurs if [B2 = 0] AND [+1000000 B2 -R2 >= 0] ???
 
After that i made two simple changes in model, and receive&nbsp;"correct" results:
 
##### (2) Alternative model 1:
 
/* Objective function */
min: +8 R1 +16 R2; ; &nbsp;  /* HERE CHANGE TO INTEGER VALUES */
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
If we change original objective funtion to use integer constants, model runs "ok", givin:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
##### (3) Alternative model 1:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +100000 B1 -R1 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
RESOURCE_2: +100000 B2 -R2 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
In this case, if we change coeficients from [B1,B2] from 1,000,000 to 100,000, it gives correct result too:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
There is some instability in models that mix binary and real variables with large (?) coeficients ? If someone knows what is happened here, please tell me what to do. Maybe it's some parameter or limit to set.... but i don't see now how to understand the origin of the problem.
 
PS: I'm using lp-solve version 5.5.0.10.
 
Thanks a lot
 
Alexandre Fernandes de Alencar
Ribeirão Preto - Brazil
e-mail: alexandreilab.com.br">alexandreilab.com.br

__._,_.___
.

__,_._,___
Re: Strange behaviour in MIP Problem
country flaguser name
United States
2008-06-12 10:11:19

1000000 Is too big and gives instabilities. You must use more realistic values for you 'BigM&#39; values. Those big values can give rounding errors that result in a solution that can be numerical unstable and/or not within the set constraints.
For example in this case you know from the constraint +R1 + R2 <= 1 that R1 and R2 cannot be larger than 1, so the coefficients of B1 and B2 don't have to be larger than 1 also!
&nbsp;
As I already said in previous post, they should disallow to use the term BigM for those coefficients because people then tend to use too big variables.
 
Peter
On Thu, Jun 12, 2008 at 4:04 PM, Alexandre Fernandes de Alencar < alexandreilab.com.br">alexandreilab.com.br> wrote:

Dear all
 
I developed a model to solve a MIP problem envolving resource alocation for some demands. It's simple, but with a large number of variables. Well, analysing some results,&nbsp;i found a apparent problem with some binary variables used with real variables in certain constraints. It seems that in some cases the result don't "respect"&nbsp;constraints, but lp-solve shows "optimal solution&quot; found. I reduce the model to show you the question:
 
###### (1) Original model:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
Explaining: I have two binary variables [B1,B2] but accept only one with value [1] as result. The other will set to zero [0]. The real variable [R1,R2] are associated with binary variables [B1,B2]. So, R1 can be non zero only in case B1 is non zero. On other way, R2 can be non zero only in case B2 is non zero. So i expected that if R1 is non zero, R2 is zero. Or if R2 is non zero, R1 must be zero. But when we process this model in lp-solve (using IDE, for example), we receive the result:
 
B1: 1
B2: 0
R1: 0.9510869...
R2: 0.0489130...  => Here is the problem !!! How can this occurs if [B2 = 0] AND [+1000000 B2 -R2 >= 0] ???
 
After that i made two simple changes in model, and receive&nbsp;"correct" results:
 
##### (2) Alternative model 1:
 
/* Objective function */
min: +8 R1 +16 R2; &nbsp;   /* HERE CHANGE TO INTEGER VALUES */
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
If we change original objective funtion to use integer constants, model runs "ok&quot;, givin:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
##### (3) Alternative model 1:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +100000 B1 -R1 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
RESOURCE_2: +100000 B2 -R2 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
In this case, if we change coeficients from [B1,B2] from 1,000,000 to 100,000, it gives correct result too:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
There is some instability in models that mix binary and real variables with large (?) coeficients ? If someone knows what is happened here, please tell me what to do. Maybe it's some parameter or limit to set.... but i don't see now how to understand the origin of the problem.
 
PS: I'm using lp-solve version 5.5.0.10.
 
Thanks a lot
 
Alexandre Fernandes de Alencar
Ribeirão Preto - Brazil
e-mail: alexandreilab.com.br" target="_blank">alexandreilab.com.br


__._,_.___
.

__,_._,___
Re: Strange behaviour in MIP Problem
country flaguser name
Brazil
2008-06-13 10:35:56

Peter
 
Thanks for your explanation. In that case, i really reduce my "BigM' value to 1000 in order to solve my problem.
 
But, the sample i post is really a simplification for the question. In some cases, i must have a value for BigM greater than 100.000, in order to treat the real problem.
For example, if [Rn] represent possibles ensures for diferent investiments. In this case, possible values for any [Rn] can be bigger than 1.000.000 ($).
 
If we have this situation, what is a possible strategy to treat this question ? Maybe use a "alternative" scale for values, dividing every value ;by a common factor (p.e: /1000) ?
 
Thanks
 &nbsp; 
Alexandre Fernandes de Alencar
Ribeirão Preto - Brazil
e-mail: alexandreilab.com.br">alexandreilab.com.br
----- Original Message -----
Sent: Thursday, June 12, 2008 12:11 PM
Subject: Re: [lp_solve] Strange behaviour in MIP Problem

1000000 Is too big and gives instabilities. You must use more realistic values for you 'BigM' values. Those big values can give rounding errors that result in a solution that can be numerical unstable and/or not within the set constraints.
For example in this case you know from the constraint +R1 + R2 <= 1 that R1 and R2 cannot be larger than 1, so the coefficients of B1 and B2 don't have to be larger than 1 also!
&nbsp;
As I already said in previous post, they should disallow to use the term BigM for those coefficients because people then tend to use too big variables.
 ;
Peter
On Thu, Jun 12, 2008 at 4:04 PM, Alexandre Fernandes de Alencar < alexandreilab.com.br">alexandreilab.com.br> wrote:

Dear all
 
I developed a model to solve a MIP problem envolving resource alocation for some demands. It's simple, but with a large number of variables. Well, analysing some results,&nbsp;i found a apparent problem with some binary variables used with real variables in certain constraints. It seems that in some cases the result don't "respect"&nbsp;constraints, but lp-solve shows "optimal solution" found. I reduce the model to show you the question:
 
###### (1) Original model:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
Explaining: I have two binary variables [B1,B2] but accept only one with value [1] as result. The other will set to zero [0]. The real variable [R1,R2] are associated with binary variables [B1,B2]. So, R1 can be non zero only in case B1 is non zero. On other way, R2 can be non zero only in case B2 is non zero. So i expected that if R1 is non zero, R2 is zero. Or if R2 is non zero, R1 must be zero. But when we process this model in lp-solve (using IDE, for example), we receive the result:
 
B1: 1
B2: 0
R1: 0.9510869...
R2: 0.0489130...  => Here is the problem !!! How can this occurs if [B2 = 0] AND [+1000000 B2 -R2 >= 0] ???
 
After that i made two simple changes in model, and receive&nbsp;"correct" results:
 
##### (2) Alternative model 1:
 
/* Objective function */
min: +8 R1 +16 R2; &nbsp;   /* HERE CHANGE TO INTEGER VALUES */
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
If we change original objective funtion to use integer constants, model runs "ok", givin:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
##### (3) Alternative model 1:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +100000 B1 -R1 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
RESOURCE_2: +100000 B2 -R2 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
In this case, if we change coeficients from [B1,B2] from 1,000,000 to 100,000, it gives correct result too:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
There is some instability in models that mix binary and real variables with large (?) coeficients ? If someone knows what is happened here, please tell me what to do. Maybe it's some parameter or limit to set.... but i don't see now how to understand the origin of the problem.
 
PS: I'm using lp-solve version 5.5.0.10.
 
Thanks a lot
 
Alexandre Fernandes de Alencar
Ribeirão Preto - Brazil
e-mail: alexandreilab.com.br" target="_blank">alexandreilab.com.br


__._,_.___
.

__,_._,___
Re: Strange behaviour in MIP Problem
country flaguser name
Brazil
2008-06-13 13:31:52

Erwin
 
Yes, i undestand now. In futher models, when i need this kind of constraint, i'll attempt to use this conversion, in order to avoid this instability.
 
Thanks for your orientation.
 &nbsp; 
Alexandre Fernandes de Alencar
Ribeirão Preto - Brazil
e-mail: alexandreilab.com.br">alexandreilab.com.br
----- Original Message -----
Sent: Friday, June 13, 2008 12:41 PM
Subject: Re: [lp_solve] Strange behaviour in MIP Problem

&nbsp;
Sometimes you can reformulate porfolio models by investing fractions. I.e. instead
of havning a budget of $1000000 assume you have a budget of $1. That will
give you optimal fractions to invest. Just multiply by your actual budget and
you have the absolute numbers.
 
A solver like Cplex has socalled indicator constraints so you don't need to use
bigM constraints.
 ;
Erwin

On Fri, Jun 13, 2008 at 11:35 AM, Alexandre Fernandes de Alencar < alexandreilab.com.br">alexandreilab.com.br> wrote:

Peter
 
Thanks for your explanation. In that case, i really reduce my "BigM' value to 1000 in order to solve my problem.
 
But, the sample i post is really a simplification for the question. In some cases, i must have a value for BigM greater than 100.000, in order to treat the real problem.
For example, if [Rn] represent possibles ensures for diferent investiments. In this case, possible values for any [Rn] can be bigger than 1.000.000 ($).
 
If we have this situation, what is a possible strategy to treat this question ? Maybe use a "alternative" scale for values, dividing every value ;by a common factor (p.e: /1000) ?
 
Thanks
 &nbsp; 
Alexandre Fernandes de Alencar
Ribeirão Preto - Brazil
e-mail: alexandreilab.com.br" target="_blank">alexandreilab.com.br
----- Original Message -----
Sent: Thursday, June 12, 2008 12:11 PM
Subject: Re: [lp_solve] Strange behaviour in MIP Problem

1000000 Is too big and gives instabilities. You must use more realistic values for you 'BigM' values. Those big values can give rounding errors that result in a solution that can be numerical unstable and/or not within the set constraints.
For example in this case you know from the constraint +R1 + R2 <= 1 that R1 and R2 cannot be larger than 1, so the coefficients of B1 and B2 don't have to be larger than 1 also!
 
As I already said in previous post, they should disallow to use the term BigM for those coefficients because people then tend to use too big variables.
 
Peter
On Thu, Jun 12, 2008 at 4:04 PM, Alexandre Fernandes de Alencar < alexandreilab.com.br" target="_blank">alexandreilab.com.br> wrote:

Dear all
 
I developed a model to solve a MIP problem envolving resource alocation for some demands. It's simple, but with a large number of variables. Well, analysing some results,&nbsp;i found a apparent problem with some binary variables used with real variables in certain constraints. It seems that in some cases the result don't "respect"&nbsp;constraints, but lp-solve shows "optimal solution" found. I reduce the model to show you the question:
 
###### (1) Original model:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
Explaining: I have two binary variables [B1,B2] but accept only one with value [1] as result. The other will set to zero [0]. The real variable [R1,R2] are associated with binary variables [B1,B2]. So, R1 can be non zero only in case B1 is non zero. On other way, R2 can be non zero only in case B2 is non zero. So i expected that if R1 is non zero, R2 is zero. Or if R2 is non zero, R1 must be zero. But when we process this model in lp-solve (using IDE, for example), we receive the result:
 
B1: 1
B2: 0
R1: 0.9510869...
R2: 0.0489130...  => Here is the problem !!! How can this occurs if [B2 = 0] AND [+1000000 B2 -R2 >= 0] ???
 
After that i made two simple changes in model, and receive&nbsp;"correct" results:
 
##### (2) Alternative model 1:
 
/* Objective function */
min: +8 R1 +16 R2; &nbsp;   /* HERE CHANGE TO INTEGER VALUES */
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +1000000 B1 -R1 >= 0;
RESOURCE_2: +1000000 B2 -R2 >= 0;
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
If we change original objective funtion to use integer constants, model runs "ok", givin:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
##### (3) Alternative model 1:
 
/* Objective function */
min: +8.01 R1 +16.09 R2;
/* Constraints */
UNIQUE: +B1 +B2 = 1;
RESOURCE_1: +100000 B1 -R1 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
RESOURCE_2: +100000 B2 -R2 >= 0; &nbsp; /* HERE REDUCE CONSTANT FROM 1,000,000 to 100,000 */
DISPONIBILITY: +R1 +R2 <= 1;
DEMAND: +184 R1 +368 R2 >= 193;
/* Variable bounds */
B1 <= 1;
B2 <= 1;
/* Integer definitions */
int B1,B2;
 
In this case, if we change coeficients from [B1,B2] from 1,000,000 to 100,000, it gives correct result too:
 
B1: 0
B2: 1
R1: 0
R2: 0.5244565
 
There is some instability in models that mix binary and real variables with large (?) coeficients ? If someone knows what is happened here, please tell me what to do. Maybe it's some parameter or limit to set.... but i don't see now how to understand the origin of the problem.
 
PS: I'm using lp-solve version 5.5.0.10.
 
Thanks a lot
 
Alexandre Fernandes de Alencar
Ribeirão Preto - Brazil
e-mail: alexandreilab.com.br" target="_blank">alexandreilab.com.br





--
----------------------------------------------------------------
Erwin Kalvelagen
Amsterdam Optimization Modeling Group
erwin.kalvelagengmail.com">erwin.kalvelagengmail.com, http://www.gams.com/~erwin
http://amsterdamoptimization.com
----------------------------------------------------------------

__._,_.___
.

__,_._,___
[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )