Re: [Help-glpk] expressing a constraint depending on a boolean variable

2015-11-04 Thread Michael Hennebry

On Wed, 4 Nov 2015, Heinrich Schuchardt wrote:


Hello Esma,
 
please, see
https://en.wikibooks.org/wiki/GLPK/Modeling_tips#Big_M


Be sure take the advice to use the smallest M that you know works.
Done right, you will get the convex hull of allowed solutions.

--
Michael   henne...@web.cs.ndsu.nodak.edu
"Sorry but your password must contain an uppercase letter, a number,
a haiku, a gang sign, a heiroglyph, and the blood of a virgin."
 --  someeecards___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] expressing a constraint depending on a boolean variable

2015-11-04 Thread Heinrich Schuchardt
Hello Esma,

 

please, see

https://en.wikibooks.org/wiki/GLPK/Modeling_tips#Big_M

 

Best regards

Heinrich Schuchardt

http://www.xypron.de

 
 

Gesendet: Mittwoch, 04. November 2015 um 09:44 Uhr
Von: "esma mehiaoui" 
An: "GLPK Help List" 
Betreff: [Help-glpk] expressing a constraint depending on a boolean variable



Hello everyone,

 

Please could you help me to express the following constraint if possible.

 

for i in {1..2} if V[i] =1 then 2<= sum {x in MySet} V2[x] <=3

                    else (V[i] =0) then sum {x in MySet} V2[x]  may have any value (i do not care about the value in this case)

 

 

with V and V2 are boolean variables

 

 

Thank you in advance

Esma

___ 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] Using GLPK on windows 8

2015-11-04 Thread Andrew Makhorin
On Wed, 2015-11-04 at 16:07 +0300, Andrew Makhorin wrote:
> >  I followed the instruction as you told,
> > But I still don't know how to execute " .mod" file using Visual
> > Studio,  the glpk.h was included.
> > 
> > (I want to apply glpk for my " .mod"  files from my Mac in Window )
> > 
> 
> If you has successfully built glpk, there must be glpsol.exe in
> subdirectory 'w32' or 'w64'. Just run it from the command line as
> follows:
> 
>glpsol -m foo.mod
> 
> For more details please see the glpk manual.
> 
> FYI: you can download precompiled glpk binaries (including the glpsol
> program) for MS Windows from http://winglpk.sourceforge.net/ .

Also look at http://gusek.sourceforge.net/gusek.html . Maybe it is just
you need.


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


Re: [Help-glpk] Using GLPK on windows 8

2015-11-04 Thread Andrew Makhorin

>  I followed the instruction as you told,
> But I still don't know how to execute " .mod" file using Visual
> Studio,  the glpk.h was included.
> 
> (I want to apply glpk for my " .mod"  files from my Mac in Window )
> 

If you has successfully built glpk, there must be glpsol.exe in
subdirectory 'w32' or 'w64'. Just run it from the command line as
follows:

   glpsol -m foo.mod

For more details please see the glpk manual.

FYI: you can download precompiled glpk binaries (including the glpsol
program) for MS Windows from http://winglpk.sourceforge.net/ .


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


Re: [Help-glpk] expressing a constraint depending on a boolean variable

2015-11-04 Thread Andrew Makhorin

> Please could you help me to express the following constraint if
> possible.
> 
> 
> for i in {1..2} if V[i] =1 then 2<= sum {x in MySet} V2[x] <=3
> else (V[i] =0) then sum {x in MySet} V2[x]  may
> have any value (i do not care about the value in this case)
> 
> 
> 
> 
> with V and V2 are boolean variables
> 

The disjunctive condition

   if z = 1 then   a <= x <= b
   if z = 0 then -M1 <= x <= +M2

where M1 and M2 are sufficiently big numbers, is equivalent to:

   a * z - M1 * (1 - z) <= x <= b * z + M2 * (1 - z)

from which it follows that:

   x >= (a + M1) * z - M1
   x <= (b - M2) * z + M2

Note that M1 = - inf x, and M2 = + sup x should be chosen as small as
possible.


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


[Help-glpk] expressing a constraint depending on a boolean variable

2015-11-04 Thread esma mehiaoui
Hello everyone,
Please could you help me to express the following constraint if possible.
for i in {1..2} if V[i] =1 then 2<= sum {x in MySet} V2[x] <=3                  
  else (V[i] =0) then sum {x in MySet} V2[x]  may have any value (i do not care 
about the value in this case)

with V and V2 are boolean variables

Thank you in advanceEsma___
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk