Thread: Truck loading algorithm

  1. #1
    Registered User
    Join Date
    Oct 2019

    Truck loading algorithm

    Hi everybody,

    I would like to code an algorithm to optimize truck loading (minimizing loading meter).

    I read many articles about it, thesis, pseudo codes... It's about the well known bin packing problem :
    Bin packing problem - Wikipedia

    Since I don't want to reinvent the wheel, I searched for an existing code and found the one enclosed : "container.c" written 20 years ago.

    Here is the link to its creator David Pisinger codes page :
    (Many thanks to him for permitting me to discuss about it on forums)

    I download and tested it, it works great. I used the enclosed file "loading.c" (I only added main function) to run on Online C Compiler - online editor

    But I would like to implement 3 constraints :
    • A box can not be placed over a smaller one
    • Boxes can only be rotaded along a vertical axis, meaning I can only swap width and depth, not height
    • Some boxes may not be stackable

    I am convinced this is not a big deal, but I am a complete noob in C... So any help would be gratefully appreciated !

    Hope somebody will have time to help me ; thanks for reading.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Oct 2019

    I found a solution.
    How can I close / mark as solved this thread ?


  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You just did.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 04-11-2017, 03:10 PM
  2. My program "truck"
    By ahmedcrow in forum C Programming
    Replies: 6
    Last Post: 02-28-2017, 12:39 PM
  3. Trying to make a truck drive accross the screen...
    By corey.heffernan in forum C Programming
    Replies: 1
    Last Post: 11-24-2011, 09:06 PM
  4. The ice cream truck song!
    By Leeman_s in forum A Brief History of
    Replies: 1
    Last Post: 08-31-2003, 09:31 PM

Tags for this Thread