User's Manual For CLP Spreadsheet Solver: University of Bath
User's Manual For CLP Spreadsheet Solver: University of Bath
DISCLAIMER: THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL DEVELOPER BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
i
TABLE OF CONTENTS
1. INTRODUCTION ......................................................................................................... 2
2. HOW TO SOLVE A CONTAINER LOADING PROBLEM .................................................... 2
3. SCOPE AND LIMITATIONS .......................................................................................... 3
4. STRUCTURE OF THE WORKSHEETS ............................................................................. 3
5. FUNCTIONS ............................................................................................................. 10
6. SOLUTION ALGORITHM............................................................................................ 11
7. MODIFYING THE INTERFACE..................................................................................... 11
8. CONCLUSION ........................................................................................................... 12
ii
1. INTRODUCTION
CLP Spreadsheet Solver is the fourth open-source spreadsheet solver I have developed using Excel
and VBA, after VRP Spreadsheet Solver (for vehicle routing problems), FLP Spreadsheet Solver (for
facility location problems), and CLP Spreadsheet Solver (for 1D and 2D bin packing problems). All
three solvers are available for download at no cost on my personal website.
CLP Spreadsheet Solver is, in broad terms, an extension of BPP Spreadsheet Solver to 3D. Is there
a need for it? Academically, yes, since visualizing 3D container loading plans requires a high degree
of effort. In practice, container loading planning is usually done using specialized software, and
Excel may not be appealing. I am hoping the it will be used for load planning of trucks. Time will
tell. Please send your bug reports, comments, and suggestions to [email protected].
CLP Spreadsheet Solver has been designed for simplicity above all. Using the customized ribbon
named “CLP Spreadsheet Solver” (in older versions of Mac Office, the commands may be displayed
in the “Tools” menu), you may issue the commands in their increasing numerical index, filling in
data to each worksheet as it is generated. A step by step guide is given below.
2
- Optionally (and I think you will), you may execute “4.1. Setup Visualization Worksheet”. The
items are semi-transparent, so that you can have a better ide of how to place the items.
- “5.1 Engage the CLP Spreadsheet Solver” and wait for the run to end. For best results, allow
the solver the time to perform a few thousand iterations at least. As a fair warning, l must state
that I have found that the Mac version of Excel is orders of magnitude slower than the Windows
version.
- Check the solution and modify it to suit your objectives. Optionally, you can execute “5.2
Optional – Feasibility Check” function to see if the modified solution is still feasible.
- Optionally (and I think you will), you may execute “4.2. Animate the loading plan”. This should
give you a good idea about how to actually load items into their locations.
- The “Send feedback / ask a question” command will start an e-mail addressed at me. All
(positive) feedback is welcome. Please provide details of your problem when you are asking a
question.
- The “Watch tutorial on YouTube” command will direct your web browser to the related video
on my YouTube channel. The comments section may contain answers to some of your
questions.
- The “About” command will display the current version of the workbook as well as my contact
information. Please cite the software and this manual in all projects they have been used.
Among many others, CLP Spreadsheet Solver operates on the following assumptions:
CLP Spreadsheet Solver adopts an incremental flow of information, with subsets of data being kept
in separate worksheets, as depicted in Figure 1. Initially, the workbook only contains the worksheet
named CLP Solver Console. The remaining worksheets should be generated in the sequence
denoted by their indices. The names of the worksheets are hardcoded within the code, so you are
advised against renaming them. All cell references are absolute, so you are advised against
inserting or deleting cells (or columns, or rows) in the worksheets. If a worksheet is modified then
the worksheets with a larger index will need to be generated again, and the previous information
will be permanently overwritten. If you would like to do a what-if analysis on the parameters, you
are strongly advised to make copies of the worksheets before doing so.
3
Figure 1: The flow of information between the worksheets. The optional worksheets are denoted
with a lighter colour.
The cells containing the data in the worksheets are colour-coded with the following scheme:
The cells with a black background are set by the worksheets and should not be modified.
The cells with a green background are parameters to be set by the user.
The cells with a yellow background are to be computed by the worksheets (but can be edited).
The cells with a blue background will be the result of the solver (but can be manually input).
The cells with an orange background signal a warning.
The cells with a red background signal an error.
Note that some of the colour-coding features are not available for Excel 2007.
This worksheet is central to the workbook, and it should not be deleted. If it is deleted, please run
the macro SetupConsoleWorksheet, or close and reopen the workbook to generate it again. The
parameters defined within the worksheet are described below.
Sequence: Instead of having a wizard interface, which is very easy to use but also very restrictive,
the workbook numbers the worksheets in the order of progress. The parameters related to each
worksheet are presented along with their sequence number. Please stick to the sequence unless
you know what you are doing.
Number of item types: Each item type has a width, height, length, associated profit, and the
number of items available. The allowed rotations for the item type, and if the item must be, may
be, or cannot be packed may be input later.
Number of types of containers: Each container type has a width, height, length, associated cost,
and the number of containers available. You may also input if the container type must be used or
cannot be used.
4
Front side support required?: Consider loading items onto a truck. If an item is not fully supported
on its side towards the front of the truck, then it may fall in case of hard braking. This option
instructs the solver to make sure every item is fully supported on its surface facing the front of the
container (the side that is further away in the visualisation).
Item labels: If set to “Yes”, writes the type of the item into the rectangle representing it in the
visualization worksheet.
Container labels: Similar to item labels, if set to “Yes”, writes the type of the container into the
rectangle representing it in the visualization worksheet.
Animation advances by: The options are “one-second intervals” and “message box between every
two items”, which are self-explanatory.
First Fit Decreasing based on: An algorithmic parameter defining the order of items being packed
within initial the constructive heuristic. Different settings may result in alternative solutions,
especially for low CPU time allowances. The default setting is Volume, which works quite well in
general. In some instances, Weight or Max{width, height, length} may result in a better solution.
Also optimize balance?: If set to “Yes”, the solver attempts to balance the weights on the left and
right of the container. This may not be necessary in all cases, so it can be turned off by setting the
option to “No”.
CPU time limit (seconds): The amount of time after which the algorithm will end. As a general
rule: the longer time you allow, the better the results will be. I recommend at least two seconds
per item. Approximately half this time will be spent to ensure that the organization of items within
each container is sensible. I recommend a much longer time for Mac Excel (more like a minute per
item), due to the mismatch between Microsoft and Apple products.
4.2 1.Items
Item Type ID: This column is automatically generated, and must not be deleted or altered.
Name: The entries in this column must be unique. Being specific at this stage will help you later.
Image file: If you place a .jpg file containing a picture of the item in the same directory as the
solver file and enter the name here, the visualisation will display the image on the item.
5
Height (y): How tall the item is.
Volume: This field is automatically calculated based on the width, height, and length.
Rotations: All items are allowed to be placed on their x/z surface. The other surfaces are also
allowed by default. Here is a figure that will hopefully make things clearer, which shows the default
placement on the x/z surface.
y
z
x
Heavy item? : Heavy items (marked with a “Yes” in this column) will only be placed on the floor,
since they may crush the items they are placed on. The default value is “No”. An item type can be
both heavy and fragile at the same time.
Fragile item? : No items will be placed on top of a fragile item (marked with a “Yes” in this column),
since they may be damaged by the weight of the item they carry. The default value is “No”. An
item type can be both heavy and fragile at the same time.
Must be packed? : The item types that “must be packed” will have absolute priority over the items
that “may be packed”. If an item type “may be packed”, make sure that it has a positive profit,
otherwise the solver will not attempt to pack it.
Profit: The benefit of packing one item of this type. The objective function is computed as the sum
of the profits of the items packed minus the sum of the costs of the containers used.
Number of items: How many items of this type must or may be packed. If you have a type of item
for which you have to pack a minimum amount and the rest is optional, I recommend that you
split it into two types: the first “must be packed”, the other “may be packed”.
4.3 2.Containers
Container Type ID: This column is automatically generated, and must not be deleted or altered.
Name: The entries in this column must be unique. Being specific at this stage will help you later.
6
Volume: This field is automatically calculated based on the width and the length.
May be used? : The option of “Do not use” is provided for the possibility of what-if analysis.
Cost: The cost of using one container of this type. The objective function is computed as the sum
of the profits of the items packed minus the sum of the costs of the containers used. You may
want to set the cost of the containers equal to their volume to ensure that empty space is
minimised.
4.4 3.Solution
For each container a set of columns detailing the items packed into it will be generated. You may
scroll right to see the items in the other containers. Column A also contains the List of detected
infeasibilities, below the items in the first container. The columns in this worksheet are explained
below.
Item type name: The name of type of the item. Can be chosen from the drop-down menu
populated with the names of the types of items.
Orientation: The orientation of the item, consisting of the surface it is standing and if it is rotated
on that surface. The first and the third letters show the surface the item is placed on, hence the
default orientation is xyz. Any other order refers to a rotation where the associated letters imply
the type of rotation, e.g. zyx refers to the case where the item is still resting on the x/z surface,
with the item is rotated so that the width became the length and vice versa. Examples of all
orientations for an item with width 1, height 2, and depth 4 is provided below.
7
Orientation zyx:
(x and z are swapped, meaning the width and depth are swapped)
Orientation xzy:
(y and z are swapped, meaning that height and depth are swapped)
Orientation yzx:
8
Orientation yxz:
Orientation zxy:
Total volume: The sum of the column Volume. In a feasible solution, Total Volume should be less
than or equal to the area of the container.
Net profit: The sum of the profits of the items in the container minus the cost of the container (if
there is at least one item in it).
4.5 4.Visualization
This worksheet is optional, and if generated, it contains rectangular cube shapes showing the
containers and the items in the containers. You can move the shapes around to see if you can
arrive at a better or better looking solution, but unfortunately the current design will not
automatically write your solution into the solution worksheet.
9
5. FUNCTIONS
This is a quick way of deleting the data worksheets and resetting the console worksheet. Be
careful, it is irreversible. Corresponds to the macro ResetWorkbook.
The drop-down menus of the solution worksheet are populated by the list of item types. To have
alphabetically ordered drop-down menus, you need to sort the item types. Corresponds to the
macro SortItemTypes.
Two item types are compatible if they can be packed into the same container. If you do not
generate this worksheet, the solver will assume that all item types are compatible with each other.
If you generate it, you may choose which item types are incompatible. Corresponds to the macro
SetupItemItemCompatibilityWorksheet.
The containers in the solution and the visualization worksheets will follow the order of the
container types in the containers worksheet. In general, it is a good idea to keep them in an
alphabetical order. If you have a certain order of containers in your mind, do not use this option.
Corresponds to the macro SortContainerTypes.
A container type is compatible with an item type if the item type can be packed into the container
type (e.g. frozen foods and refrigerated / non-refrigerated trucks). If you do not generate this
worksheet, the solver will assume that all item types are compatible with all container types. If
you generate it, you may choose which item types and container types are incompatible.
Corresponds to the macro SetupContainerItemCompatibilityWorksheet.
10
5.10 Engage CLP Spreadsheet Solver
This function is supplied for checking the feasibility of the data and the solution after manual
alterations. Corresponds to the macro FeasibilityCheckDataAndSolution.
6. SOLUTION ALGORITHM
The field of CLP research mostly focuses on heuristic algorithms. The details of the literature would
be beyond the scope of this document, and we do not claim that a single algorithm can successfully
solve all variants of the CLP. Let it suffice to state that a variant of the Large Neighbourhood Search
is implemented within the CLP Spreadsheet Solver. An outline of the algorithm is given below.
Step 1 (Initialization): Sort the items with respect to their priority, size, and profit. Sort containers
with respect to their size and cost.
Step 2 (Constructive step): Use the First-Fit-Decreasing heuristic to pack the items into the
containers.
Step 3 (Perturbation): Randomly remove items from containers, and randomly empty a number of
containers. Sort the containers in decreasing order of the volume packed into them.
Step 4 (Reoptimization): Use a constructive heuristic to repack the removed items into the
containers.
Step 5 (Solution update): If the new solution is better than the best-known solution, update the
best known solution. Otherwise, revert back to the best-known solution. If the time limit is not
exceeded, go to Step 3.
As of version 1.5, CLP Spreadsheet Solver supports the following languages in addition to English:
Deutsche (German), Espanola (Spanish), Française (French), Italiano (Italian), Português
(Portuguese), and ( عربArabic). I do not speak all these languages, so the translations are by Google
Translate. I expect that there are some horrible mistranslations, which I hope will be corrected by
the help of altruistic users. However, if you are in a hurry to correct your own copy or add a new
language, here is how to do it.
11
colour scheme of the solver. In short, the first columns of the former and the first column of the
latter must not be modified.
Simply changing the part of the interface in these worksheets will get you what you need. The
message boxes will respond immediately. For the menu items to respond, you will need to save,
close, and reopen the workbook. For the worksheets to respond, you will need to set them up
again. The modifications are best done when there is no data in the solver.
If you need to add a new language, you will need to replace one of the existing languages. Pick a
language that you will never use and modify the header of the column (in both worksheets) to the
name of the language. Then, modify the contents of the new language column as appropriate.
Google Translate can handle 100 to 150 entries at one time. Adding I suggest that you hide these
worksheets once you are done, by right clicking their name tabs and clicking “Hide”.
If you need to modify the English interface so that you can implement your own jargon, follow the
steps described in the previous paragraph. Modify the header of the column (in both worksheets)
to a meaningful name that is different than English, e.g. MyCompany. Then, modify the contents
of the MyCompany column (in both worksheets) to your heart’s desire.
8. CONCLUSION
Despite its shortcomings, I hope that the CLP Spreadsheet Solver will be used as a minor decision
support system for small and medium enterprises as well as for teaching and undergraduate and
postgraduate levels. I am almost sure that academics will disagree with some design choices, but
they can be corrected. I am also quite certain that practitioners will find features that do not
completely fit their needs, but it can provide you starting points that lead to an actual solution.
Please send bug reports, comments, and suggestions to [email protected].
12