Set Covering Problem

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 3 years ago

Set Covering Problem

Post by Archiver » 6 years ago


Hello All,



I need help with the problem below, I think the problem is in the equation “AgebtoPtoEnc..”



I’ll be very gratefully if someone could help me.



Best Regards

Víctor Ortíz







* TITLE Set Covering;



Set i / i1*i6 / ;

Set k / k1*k6 / ;



Table d(i,k)



k1 k2 k3 k4 k5 k6

i1 1 1 0 1 0 0

i2 1 1 1 0 0 0

i3 0 1 1 0 0 1

i4 1 0 0 1 1 0

i5 0 0 0 1 1 1

i6 0 0 1 0 1 1 ;



Binary Variable Y(k);



Variables

z "Set Covering"



Equation AgebtoPtoEnc , Def_obj ;



AgebtoPtoEnc..



sum(k, Y(k)*d[i,k)) =g= 1 ;



Def_obj..



z =e= sum(k, Y(k));



Model setcovering / all / ;



Solve setcovering using mip minimizing z;



Display z.l, y.l ;

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Archiver
User
User
Posts: 7876
Joined: 3 years ago

Re: Set Covering Problem

Post by Archiver » 6 years ago


Dear Victor,

Your equation AgebtoPtoEnc is not unique and depends on the set i, so you need to declare and define the equation in the following way:

...
Equation AgebtoPtoEnc(i), Def_obj;

AgebtoPtoEnc(i).. sum(k, Y(k)*d(i,k)) =g= 1 ;
...


Cheers,
Pedro



On Sat, Feb 16, 2013 at 10:04 PM, Victor Ortiz wrote:

Hello All,



I need help with the problem below, I think the problem is in the equation “AgebtoPtoEnc..”



I’ll be very gratefully if someone could help me.



Best Regards

Víctor Ortíz







* TITLE Set Covering;



Set i / i1*i6 / ;

Set k / k1*k6 / ;



Table d(i,k)



k1 k2 k3 k4 k5 k6

i1 1 1 0 1 0 0

i2 1 1 1 0 0 0

i3 0 1 1 0 0 1

i4 1 0 0 1 1 0

i5 0 0 0 1 1 1

i6 0 0 1 0 1 1 ;



Binary Variable Y(k);



Variables

z "Set Covering"



Equation AgebtoPtoEnc , Def_obj ;



AgebtoPtoEnc..



sum(k, Y(k)*d[i,k)) =g= 1 ;



Def_obj..



z =e= sum(k, Y(k));



Model setcovering / all / ;



Solve setcovering using mip minimizing z;



Display z.l, y.l ;

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.






--
PEDRO JAVIER RAMÍREZ TORREALBA
Ingeniero Civil Eléctrico PUC
MSc en Ingeniería Eléctrica PUC
Londres, REINO UNIDO

Celular: +44-(0)75-8069-3119

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Archiver
User
User
Posts: 7876
Joined: 3 years ago

Re: Set Covering Problem

Post by Archiver » 6 years ago


The correct model is as following:

* TITLE Set Covering;
Set i / i1*i6 / ;
Set k / k1*k6 / ;
Table d(i,k)
k1 k2 k3 k4 k5 k6
i1 1 1 0 1 0 0
i2 1 1 1 0 0 0
i3 0 1 1 0 0 1
i4 1 0 0 1 1 0
i5 0 0 0 1 1 1
i6 0 0 1 0 1 1 ;
Binary Variable Y(k);
Variables
z "Set Covering"
Equation AgebtoPtoEnc(i) , Def_obj ;
AgebtoPtoEnc(i)..sum(k, Y(k)*d(i,k)) =g= 1 ;
Def_obj..z =e= sum(k, Y(k));
Model setcovering / all / ;
Solve setcovering using mip minimizing z;
Display z.l, y.l ;

On 2/17/13, Victor Ortiz wrote:
> > Hello All,
> >
> >
> >
> > I need help with the problem below, I think the problem is in the equation
> > “AgebtoPtoEnc..”
> >
> >
> >
> > I’ll be very gratefully if someone could help me.
> >
> >
> >
> > Best Regards
> >
> > Víctor Ortíz
> >
> >
> >
> >
> >
> >
> >
> > * TITLE Set Covering;
> >
> >
> >
> > Set i / i1*i6 / ;
> >
> > Set k / k1*k6 / ;
> >
> >
> >
> > Table d(i,k)
> >
> >
> >
> > k1 k2 k3 k4 k5 k6
> >
> > i1 1 1 0 1 0 0
> >
> > i2 1 1 1 0 0 0
> >
> > i3 0 1 1 0 0 1
> >
> > i4 1 0 0 1 1 0
> >
> > i5 0 0 0 1 1 1
> >
> > i6 0 0 1 0 1 1 ;
> >
> >
> >
> > Binary Variable Y(k);
> >
> >
> >
> > Variables
> >
> > z "Set Covering"
> >
> >
> >
> > Equation AgebtoPtoEnc , Def_obj ;
> >
> >
> >
> > AgebtoPtoEnc..
> >
> >
> >
> > sum(k, Y(k)*d[i,k)) =g= 1 ;
> >
> >
> >
> > Def_obj..
> >
> >
> >
> > z =e= sum(k, Y(k));
> >
> >
> >
> > Model setcovering / all / ;
> >
> >
> >
> > Solve setcovering using mip minimizing z;
> >
> >
> >
> > Display z.l, y.l ;
> >
> > --
> > "gamsworld" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to gamsworld+unsubscribe@googlegroups.com.
> > To post to this group, send email to gamsworld@googlegroups.com.
> > Visit this group at http://groups.google.com/group/gamsworld?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >



Archiver
User
User
Posts: 7876
Joined: 3 years ago

RE: Set Covering Problem

Post by Archiver » 6 years ago


Thank you Hossein Karim, Pedro Ramirez and Jose Quezada

The model is working correctly

Best regards
Víctor Ortíz

-----Mensaje original-----
De: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] En nombre
de hossein karimi
Enviado el: domingo, 17 de febrero de 2013 01:11 a.m.
Para: gamsworld@googlegroups.com
Asunto: Re: Set Covering Problem

The correct model is as following:

* TITLE Set Covering;
Set i / i1*i6 / ;
Set k / k1*k6 / ;
Table d(i,k)
k1 k2 k3 k4 k5 k6
i1 1 1 0 1 0 0
i2 1 1 1 0 0 0
i3 0 1 1 0 0 1
i4 1 0 0 1 1 0
i5 0 0 0 1 1 1
i6 0 0 1 0 1 1 ;
Binary Variable Y(k);
Variables
z "Set Covering"
Equation AgebtoPtoEnc(i) , Def_obj ;
AgebtoPtoEnc(i)..sum(k, Y(k)*d(i,k)) =g= 1 ; Def_obj..z =e= sum(k, Y(k));
Model setcovering / all / ; Solve setcovering using mip minimizing z;
Display z.l, y.l ;

On 2/17/13, Victor Ortiz wrote:
> > Hello All,
> >
> >
> >
> > I need help with the problem below, I think the problem is in the
> > equation “AgebtoPtoEnc..”
> >
> >
> >
> > I’ll be very gratefully if someone could help me.
> >
> >
> >
> > Best Regards
> >
> > Víctor Ortíz
> >
> >
> >
> >
> >
> >
> >
> > * TITLE Set Covering;
> >
> >
> >
> > Set i / i1*i6 / ;
> >
> > Set k / k1*k6 / ;
> >
> >
> >
> > Table d(i,k)
> >
> >
> >
> > k1 k2 k3 k4 k5 k6
> >
> > i1 1 1 0 1 0 0
> >
> > i2 1 1 1 0 0 0
> >
> > i3 0 1 1 0 0 1
> >
> > i4 1 0 0 1 1 0
> >
> > i5 0 0 0 1 1 1
> >
> > i6 0 0 1 0 1 1 ;
> >
> >
> >
> > Binary Variable Y(k);
> >
> >
> >
> > Variables
> >
> > z "Set Covering"
> >
> >
> >
> > Equation AgebtoPtoEnc , Def_obj ;
> >
> >
> >
> > AgebtoPtoEnc..
> >
> >
> >
> > sum(k, Y(k)*d[i,k)) =g= 1 ;
> >
> >
> >
> > Def_obj..
> >
> >
> >
> > z =e= sum(k, Y(k));
> >
> >
> >
> > Model setcovering / all / ;
> >
> >
> >
> > Solve setcovering using mip minimizing z;
> >
> >
> >
> > Display z.l, y.l ;
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "gamsworld" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to gamsworld+unsubscribe@googlegroups.com.
> > To post to this group, send email to gamsworld@googlegroups.com.
> > Visit this group at http://groups.google.com/group/gamsworld?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> >

--
"gamsworld" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.





kadirsahin
User
User
Posts: 1
Joined: 3 weeks ago

Re: Set Covering Problem

Post by kadirsahin » 3 weeks ago

Hello I am learning Gams and ı need help about this topic.
I dont know the "Equation AgebtoPtoEnc" code.
What is it used for?

Post Reply