Weighted goal programming with Lingo

550 Views Asked by At

I have an optimization problem which is about assignment problem. I wrote it with a weighted goal programming algorithm (I introduce some deviations, etc.).I try to solve this algorithm with Lingo. Unfortunately each time I try to solve it, Lingo return some error code like Improper use of attribute name. It's strange because I struggle to define all parameters used in the algorithm. My lingo file cmmunicate with a spreadsheet. This spreadsheet is used as a database.

Lingo code :

Blockquote

SETS:
PLAGESHORAIRES:;
PATIENTS:zp;
AFFECTATION(PATIENTS,PLAGESHORAIRES):Yph,dph,qph,Aph;
DEVIATION_SET / 1 / : G;
ENDSETS

DATA:
PLAGESHORAIRES=@OLE();
PATIENTS=@OLE();
dph=@OLE();
qph=@OLE();
dmax=@OLE();
dmin=@OLE();
nb=@OLE();
wa=@OLE();
wb=@OLE();

@OLE()=Yph;
@OLE()=G;
@OLE()=Aph;
ENDDATA 

!OBJECTIF FUNCTION;
[OBJECTIF] MIN = wa*(1/6)*G + wb*(1/12)*@SUM(AFFECTATION(p,h):Aph(p,h));

!SUBJECT TO;

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!AFFECTATION;
!HARD CONSTRAINTS;

@FOR(PLAGESHORAIRES(h):
    @SUM(PATIENTS(p):Yph(p,h))<=1
);

@FOR(PATIENTS(p):
    @SUM(PLAGESHORAIRES(h):Yph(p,h))<=1
);

!SOFT CONSTRAINTS;

@SUM(AFFECTATION(p,h):Yph(p,h))-G = nb; 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!DISTANCES ;
!HARD CONSTRAINTS;

@FOR(PATIENTS(p):
    @FOR(PLAGESHORAIRES(h):
        dph(p,h)*Yph(p,h)<=dmax
    )
);

!SOFT CONSTRAINTS;

@FOR(PATIENTS(p):
    @FOR(PLAGESHORAIRES(h):
        dph(p,h)*Yph(p,h)-Aph(p,h)=dmin
    )
);

@FOR(PATIENTS(p):
    @FOR(PLAGESHORAIRES(h):
        @BIN(Yph(p,h))
    )
);

@FOR(PATIENTS(p):
    @FOR(PLAGESHORAIRES(h):
        @BIN(qph(p,h))
    )
);

@FOR(PATIENTS(p):
    @FOR(PLAGESHORAIRES(h):
        @GIN(Aph(p,h))
    )
);

!RENVOI DANS EXCEL;
DATA :
@OLE()=OBJECTIF;
ENDDATA

Thank's a lot for you help. Vincent

1

There are 1 best solutions below

0
On

The variable G has been declared as an attribute of a set, i.e., G is a subscripted variable, however, in

[OBJECTIF] MIN = wa*(1/6)*G + ...

it does not have a subscript, so you have to do something like:

[OBJECTIF] MIN = wa*(1/6)*G(1) + ...

For further help, contact the vendor, www.lindo.com