[algogeeks] Re: Inserting a box with lesser dimension into a box of bigger dimensions than that.

2010-09-22 Thread Yellow Sapphire
We can first sort the dimensions of each box.

For example if the dimensions of a box is L=10, B=12, W=6 then convert
it to L=12, B=10, W=6.

The above step is not needed if the problem states that LBH for all
boxes.

Then using a multi-key sorting we can sort all the boxes in ascending
order (or descending order).

If we sort it in ascending order:

This will give us a sorted list where in each box in the list is
smaller or equal to the next one in the list.

The boxes will fit inside the other one only if all the dimensions are
less than the other one.

Lets us have the boxes in list LIST in the sorted order (multi key)

//START

init_list (current)
init_list (discarded)

Start: // its a label.

for i = 0 to length_of_list; do //don't increment i here

T1=LIST[i]
T2=LIST[i+1]

if ( T1.L T2.L  T1.B  T2.B  T1.W  T2.W ) {

 add_to_tail (current, T1 , T2)
 i=i+2;

 } else {

   add_to_tail (discarded, T2)
   i++;
 }
done // for loop ends

print_list(current) // here is your one solution.

if ( elements in discarded list) {
LIST=discarded
goto Start // goto the label start
}

///END


On Sep 22, 12:11 am, Dave dave_and_da...@juno.com wrote:
 Certainly having a smaller volume is necessary for a box to fit in
 another box, but it is not sufficient. E.g., a box of size 1 x 1 x 1
 will not fit in a box of size 2 x 2 x 1/2.

 Dave

 On Sep 21, 1:16 pm, rajess rajeshrules...@yahoo.com wrote:

  find the volume of boxes as v=l*b*h
  sort boxes in volumes in descending order and this is the way to
  insert boxes one into another

  On Sep 21, 7:55 pm, Rashmi Shrivastava rash...@gmail.com wrote:

   If there are n number of boxes and each with different dimensions and your
   job is to insert one box having lesser dimension than that to another.
   Consider size of boxes as,
   b1-s1(h1,l1,w1)
   b2-s2(h2,l2,w2)
   .
   .
   .
   bn-sn(hn,ln,wn)- Hide quoted text -

  - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Inserting a box with lesser dimension into a box of bigger dimensions than that.

2010-09-22 Thread vikas kumar
you can search for box stacking problem in google. There is a DP
method.

On Sep 22, 12:11 am, Dave dave_and_da...@juno.com wrote:
 Certainly having a smaller volume is necessary for a box to fit in
 another box, but it is not sufficient. E.g., a box of size 1 x 1 x 1
 will not fit in a box of size 2 x 2 x 1/2.

 Dave

 On Sep 21, 1:16 pm, rajess rajeshrules...@yahoo.com wrote:



  find the volume of boxes as v=l*b*h
  sort boxes in volumes in descending order and this is the way to
  insert boxes one into another

  On Sep 21, 7:55 pm, Rashmi Shrivastava rash...@gmail.com wrote:

   If there are n number of boxes and each with different dimensions and your
   job is to insert one box having lesser dimension than that to another.
   Consider size of boxes as,
   b1-s1(h1,l1,w1)
   b2-s2(h2,l2,w2)
   .
   .
   .
   bn-sn(hn,ln,wn)- Hide quoted text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Inserting a box with lesser dimension into a box of bigger dimensions than that.

2010-09-22 Thread Chi
This is also called bin packing. This is a NP-(Hard) problem. There is
no good algorithm to find a solution. All the code you published here
a heuristics. Here is a good tutorial:

 http://www.developerfusion.com/article/5540/bin-packing/

On Sep 22, 9:12 am, vikas kumar vikas.kumar...@gmail.com wrote:
 you can search for box stacking problem in google. There is a DP
 method.

 On Sep 22, 12:11 am, Dave dave_and_da...@juno.com wrote:

  Certainly having a smaller volume is necessary for a box to fit in
  another box, but it is not sufficient. E.g., a box of size 1 x 1 x 1
  will not fit in a box of size 2 x 2 x 1/2.

  Dave

  On Sep 21, 1:16 pm, rajess rajeshrules...@yahoo.com wrote:

   find the volume of boxes as v=l*b*h
   sort boxes in volumes in descending order and this is the way to
   insert boxes one into another

   On Sep 21, 7:55 pm, Rashmi Shrivastava rash...@gmail.com wrote:

If there are n number of boxes and each with different dimensions and 
your
job is to insert one box having lesser dimension than that to another.
Consider size of boxes as,
b1-s1(h1,l1,w1)
b2-s2(h2,l2,w2)
.
.
.
bn-sn(hn,ln,wn)- Hide quoted text -

   - Show quoted text -- Hide quoted text -

  - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Inserting a box with lesser dimension into a box of bigger dimensions than that.

2010-09-22 Thread Mahendran MaheM
i dnt thnk it is gud to find the volume of the box,
becoz a best fit vol box may have higher length or hight or width,,,...
so LET  JUST TRY MY IDEA,.




step1:

first get that which box is taken to be first
insert that

step2:

then select all the boxes which having
  length length of the box jst insertd b4
  highthight jst  insertd b4
  widthwidth jst insertd b4 ..

step3:

and the rest unselectd box'z cn't be insert anymre...so remove that all...
coz some box'z may hv high length or hight or else width...

step4:

and than find the volume of all selectd box'z...
so that u can find which box having higher volume...

step5:

insert the higher volume box ..
this one will b the best fit...

step6:

goto the step 2..
til you dnt find  any more box'z to insert..
if thr is no box then end the process/...











On 9/22/10, Chi c...@linuxdna.com wrote:

 This is also called bin packing. This is a NP-(Hard) problem. There is
 no good algorithm to find a solution. All the code you published here
 a heuristics. Here is a good tutorial:

  http://www.developerfusion.com/article/5540/bin-packing/

 On Sep 22, 9:12 am, vikas kumar vikas.kumar...@gmail.com wrote:
  you can search for box stacking problem in google. There is a DP
  method.
 
  On Sep 22, 12:11 am, Dave dave_and_da...@juno.com wrote:
 
   Certainly having a smaller volume is necessary for a box to fit in
   another box, but it is not sufficient. E.g., a box of size 1 x 1 x 1
   will not fit in a box of size 2 x 2 x 1/2.
 
   Dave
 
   On Sep 21, 1:16 pm, rajess rajeshrules...@yahoo.com wrote:
 
find the volume of boxes as v=l*b*h
sort boxes in volumes in descending order and this is the way to
insert boxes one into another
 
On Sep 21, 7:55 pm, Rashmi Shrivastava rash...@gmail.com wrote:
 
 If there are n number of boxes and each with different dimensions
 and your
 job is to insert one box having lesser dimension than that to
 another.
 Consider size of boxes as,
 b1-s1(h1,l1,w1)
 b2-s2(h2,l2,w2)
 .
 .
 .
 bn-sn(hn,ln,wn)- Hide quoted text -
 
- Show quoted text -- Hide quoted text -
 
   - Show quoted text -

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
MAHEM

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Inserting a box with lesser dimension into a box of bigger dimensions than that.

2010-09-21 Thread rajess
find the volume of boxes as v=l*b*h
sort boxes in volumes in descending order and this is the way to
insert boxes one into another

On Sep 21, 7:55 pm, Rashmi Shrivastava rash...@gmail.com wrote:
 If there are n number of boxes and each with different dimensions and your
 job is to insert one box having lesser dimension than that to another.
 Consider size of boxes as,
 b1-s1(h1,l1,w1)
 b2-s2(h2,l2,w2)
 .
 .
 .
 bn-sn(hn,ln,wn)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Inserting a box with lesser dimension into a box of bigger dimensions than that.

2010-09-21 Thread Dave
Certainly having a smaller volume is necessary for a box to fit in
another box, but it is not sufficient. E.g., a box of size 1 x 1 x 1
will not fit in a box of size 2 x 2 x 1/2.

Dave

On Sep 21, 1:16 pm, rajess rajeshrules...@yahoo.com wrote:
 find the volume of boxes as v=l*b*h
 sort boxes in volumes in descending order and this is the way to
 insert boxes one into another

 On Sep 21, 7:55 pm, Rashmi Shrivastava rash...@gmail.com wrote:



  If there are n number of boxes and each with different dimensions and your
  job is to insert one box having lesser dimension than that to another.
  Consider size of boxes as,
  b1-s1(h1,l1,w1)
  b2-s2(h2,l2,w2)
  .
  .
  .
  bn-sn(hn,ln,wn)- Hide quoted text -

 - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.