Forum Discussion

FICO's avatar
FICO
Community Manager
12 years ago

Problems regarding one formula:

Hi Everybody!

I'm fairly new to Xpress and had to develop an ILP for my thesis and calculate it with Xpress.

Now I am stuck on a formula I don't know how to express within the Mosel language. Maybe you guys can help me.

It's about assigning referees to the right matches within a soccer season

the formula:

1/Tr (forall m in M) ∑ d(r,m) + x(r,m) - 1/T^r (forall m in M) ∑ d(^r,m) + x(^r,m) <= dmax        for all r, ^r in R

Tr is a target value and is given

d(r,m) is the distance between referee r and match m

dmax is the maximum difference each referee is allowed to have to each other

x(r,m) is the wanted variable if referee r is assigned to match m or not

M and R are just the sets - 180 Matches, 10 Referees (Austria, small country )

I don't know how to compare each referee with each other referee within the Mosel system...

any ideas?

3 Replies

  • FICO's avatar
    FICO
    Community Manager

    I count |R|^2 formulas (one for each r and r^). How are they connected? Or are you just missing the right hand side values (and the <,=,> symbols and you wanted to create |R|^2 constraints?

    You say that Tr is given. Is Tr one value or are you referring to one T for each r, hence T(r)? I assume one T per r and hence T^r would be defined. Can you confirm that?

  • FICO's avatar
    FICO
    Community Manager

    hi Oliver!

    Thanks a lot for ur reply. I messed up as I forgot the right side. Its no |R| stuff like that.

    Within the set of Referees R they are compared. Each referees average travel distance is compared to each others referees and the maximum difference between the highest referee and the lowest must not be above a certain limit. That's what the formula is about.

    Dunno though how to compare the referees as I only got that one set of R :/

    Tr is one value - the T^r is the same value - it's just written like that in the formula. its fixed. u could call it Targevalue.

  • FICO's avatar
    FICO
    Community Manager

    You would need a declaration like

    declarations

      Tr, Thatr, dmax: real

      M,R: set of string  

      x: array (R,M) of mpvar

      d: array (R,M) of real

      my_constraint: array(R,R) of linctr

    end-declarations

    Then you need to read/assign the data and your constraints would look like

    forall(r,hatr in R) do

      my_constraint(r,hatr):= 1/Tr * sum(m in M) d(r,m)*x(r,m)  - 1/Thatr * sum(m in M) d(hatr,m)*x(hatr,m)  <= dmax

    end-do

    I assume you would want * in between the d(r,m) and the x(r,m) instead of +