$title Linearni s omezenimi

$offsymxref


set B barvy /bar1*bar10/
    Vr1 vrcholy /V1*V22/

parameters o(Vr1) jedna barva /(V1*V22) 1/

binary variable X(B,Vr1)
                Y(Vr1,Vr1);
variable obj;



table sousednost(Vr1,Vr1) matice sousednosti
$include "C:\Users\Mountain Home BX\Desktop\mereni\soused17.txt"

table postihy(Vr1,Vr1) matice s penalizacemi
$include "C:\Users\Mountain Home BX\Desktop\mereni\postihy17.txt"

table soused2(Vr1,Vr1) pomocna matice
$include "C:\Users\Mountain Home BX\Desktop\mereni\pomoc17.txt"


alias (Vr1,vrch);

equations omezeni1(Vr1) jedna barva;
omezeni1(Vr1).. sum(B, X(B,Vr1)) =e= o(Vr1);

equations omezeni2(B,Vr1,vrch) aby soused nebyl stejne obarven ;
omezeni2(B,Vr1,vrch).. X(B,Vr1) + X(B,vrch) =l= sousednost(Vr1,vrch);

equations omezeni3(B,Vr1,vrch) pomocna promena;
omezeni3(B,Vr1,vrch).. X(B,Vr1) + X(B,vrch) =l= soused2(Vr1,vrch)+ Y(Vr1,vrch);



equations objectivef ucelova funkce;
objectivef.. obj =e= sum(Vr1,sum(vrch,Y(Vr1,vrch)*postihy(vrch,Vr1)));

model graf /all/;

OPTIONS optcr=0.000001
reslim = 900;

solve graf minimizing obj using MIP;

display obj.l;
