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

$ We are using the problem description from the following paper very closely here.
$ "Symmetry Breaking in a Rack Configuration Problem" Zeynep Kızıltan and Brahim Hnich



$ The rack configuration problem consists of plugging a set of electronic cards
$ into racks with electronic connectors.
given nbRacks : int(1..)
letting Rack be new type of size nbRacks

$ Each card belongs to a certain card type.
given nbTypes : int(1..)
letting Type be domain int(1..nbTypes)

$ A card type is characterised by the power it requires, ...
given requiredPower : function (total) Type --> int(1..)

$ ... and a demand, which designates how many cards of that type have to be plugged.
given demand : function (total) Type --> int(1..)


$ In order to plug a card into a rack, the rack needs to use a rack model.
given nbModels : int
letting Model be domain int(1..nbModels)

$ Each rack model is characterised by the maximal power it can supply, its number of connectors, and its price.
given maxPower      : function (total) Model --> int(1..)
given maxConnectors : function (total) Model --> int(1..)
given price         : function (total) Model --> int(1..)

$ A rack model can be used by any rack.
$ Each card plugged into a rack uses a connector.
$ The problem is to decide how many of the available racks are needed,
$ and which rack models the racks use in order to plug all the cards
$ such that the total price is minimised.

find configuration :
        function Rack -->
            $ the model for this rack
            ( Model
            $ for each type, the number of cards of that type
            , function (total) Type --> int(0..max(range(maxConnectors)))
            )


$ The constraints of the problem and the cost function can be summarised as the following:

$ The connector-capacity constraint:
$ the number of cards plugged into a rack r
$ must not exceed the number of connectors of the rack model used by r.
such that
    forAll (rack, (model, counts)) in configuration .
        sum([ num | (ty, num) <- counts ]) <= maxConnectors(model)

$ The power-capacity constraint:
$ the total power of the cards plugged into a rack r
$ must not exceed the power of the rack model used by r.
such that
    forAll (rack, (model, counts)) in configuration .
        sum([ requiredPower(ty) * num | (ty, num) <- counts ]) <= maxPower(model)

$ The demand constraint: all the cards have to be plugged into some rack.
such that
    forAll (ty, tyDemand) in demand .
        tyDemand <= sum([ num
                        | (rack, (model, counts)) <- configuration
                        , (ty2, num) <- counts
                        , ty = ty2
                        ])

$ The cost function is the sum of the prices of the rack models used by all the racks needed.
find totalCost : int(0.. |Rack| * |Model| * max(range(price)) )
such that totalCost = sum (rack, (model, counts)) in configuration . price(model)
minimising totalCost