Download
language Essence 1.3
$ prob031.essence: Rack Configuration Problem
$ Problem details available at http://www.csplib.org/Problems/prob031/

$ n_models: the number of rack models
$ n_types: the number of card types
$ n_cards: the number of cards being plugged in
$ n_racks: the number of racks to use
given n_models, n_types, n_cards, n_racks : int(1..)

$ Model: a rack model is represented as an integer between 1 and n_models
$ Type: a card type is represented as an integer between 1 and n_types
$ Card: 
$ Rack: ...
letting Model be domain int(1..n_models),
        Type  be domain int(1..n_types),
        Card  be domain int(1..n_cards),
        Rack  be new type of size n_racks

$ max_power: the maximum power a rack model can supply
$ max_connects : the maximum number of connections a rack model can accomodate
$ price: the price of a rack model
$ req_power: the amount of power required by a particular card type
$ ctype: the type of a particular card
given max_power    : function (total) Model --> int(1..),
      max_connects : function (total) Model --> int(1..),
      price        : function (total) Model --> int(1..),
      req_power    : function (total) Type  --> int(1..),
      ctype        : function (total) Card  --> Type

$ model: the model of each rack
$ plugged: the set of cards plugged in to a particular rack
find model   : function Rack --> Model,
     plugged : function Rack --> set of Card

$ minimise the total rack price
minimising sum r in defined(model) . price(model(r))

$ every card is plugged in to at least one rack
such that
    forAll c : Card .
        exists r in defined(model) .
            c in plugged(r)

$ no card is plugged in to more than one rack
such that
    forAll r1, r2 in defined(model)
        , r1 != r2
        . |plugged(r1) intersect plugged(r2)| = 0

$ the power demand placed on a rack does not exceed the maximum it can supply
such that
    forAll r in defined(model) .
        (sum c in plugged(r) . (req_power(ctype(c))))
        <= max_power(model(r))

$ the number of cards plugged in to a rack does not exceed the number of slots available
such that
    forAll r in defined(model) .
        |plugged(r)| <= max_connects(model(r))