Calculation - Optimization


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Calculation - Optimization

  1. #1
    Join Date
    Sep 2005
    Posts
    1

    Calculation - Optimization

    Hi,
    I have some numbers in a ListBox:

    98,5
    75,5
    120,3
    100,2
    ....

    I want to make calculations, for example adding
    them, so i can get a result of no more than 600.

    Example: 98,5 + 120,3.. = 501.3
    98,5 + 120,3.. = 595,4
    The sum that is close to 600 i want to
    display it in a textbox
    (or additem in another list).

    Continue the calculations, without the
    numbers allready used..

    Find next value close to 600 ... etc

    Anybody can help???

  2. #2
    Join Date
    Sep 2005
    Posts
    2
    I'm not quite sure if I understand what you're driving at. If you are looking to, for example, add two numbers together and find the combination which comes closest to 600, you could order your list numerically in descending order. Move down the list until you reach a number <= 300. Add that number and the next one together and you'll have the result closest to 600.

  3. #3
    Join Date
    Sep 2005
    Posts
    2
    On further thought, that won't work. I don't see any way to avoid adding each combination. If I think of anything I'll let you know. Sorry.

Similar Threads

  1. Projector Size Calculation Help
    By leetcharmer in forum Java
    Replies: 2
    Last Post: 05-22-2005, 09:31 PM
  2. Optimization Problem with ADO.NET With VB.NET
    By meghalgandhi in forum .NET
    Replies: 2
    Last Post: 04-29-2005, 08:02 AM
  3. Javascript calculation query...
    By Scott D. in forum Architecture and Design
    Replies: 0
    Last Post: 05-23-2002, 02:04 PM
  4. Diameter calculation
    By Tom in forum Database
    Replies: 2
    Last Post: 11-28-2001, 11:44 AM
  5. Optimization Techniques
    By Robert in forum VB Classic
    Replies: 1
    Last Post: 07-30-2001, 09:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center