+ Reply to Thread
Results 1 to 10 of 10

Making sure variable is an integer?

  1. #1
    Registered User
    Join Date
    02-02-2008
    Posts
    7

    Making sure variable is an integer?

    Hi,

    I am doing some linear programming, and I want to indicate to Excel that the X and Y variables are number of tables and number of chairs. Therefore cannot be negative and must be integer values.

    I wrote the following example and the x is B14 and y is B15 cells. How do I indicate that B14 and B15 cells are integers?

    Profit wood prod time Fitting box
    TABLES tables x 70 20 72 1
    CHAIRS chairs y 30 12.5 18 1


    Restrictions Limit
    20x + 12.5y <= 6000
    x + y <= 400
    72x + 18y <= 18000
    X>0 Y>0

    Objective
    =sumproduct(B14:B15,D14:D15)

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Are you using Solver? There is an integer constraint for cells.

    Can you post a workbook?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    If I did it right, I get 215 tables and 136 chairs:

    Please Login or Register  to view this content.
    Last edited by shg; 02-03-2008 at 03:50 PM.

  4. #4
    Registered User
    Join Date
    02-02-2008
    Posts
    7
    I got 216 and 133.
    It doesn't let me upload the xls file..

  5. #5
    Registered User
    Join Date
    02-02-2008
    Posts
    7

    Integer

    You mentioned that there is an integer constraint for cells. Where is it in Solver?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I got 216 and 133.
    That results in 5982.5 for SUMPRODUCT(B14:B15, D14:D15); 215 and 136 returns 6000.
    You mentioned that there is an integer constraint for cells. Where is it in Solver?
    It's one of the selections in the operator dropdown in the Add Constraint dialog.

  7. #7
    Registered User
    Join Date
    02-02-2008
    Posts
    7

    Thank you found it

    Hi,

    I found how to add integer constraints.
    For some reason I get 217 and 132....

    I appreciate your help,
    Tlalit

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    See attached. Set x and y initially to 1.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-02-2008
    Posts
    7

    make sure thablat round down?

    Thank you.
    I have added the ing constraint to Solver.
    Is there a way to make sure that solver rounds the variables down?
    I am thinking that if we are talking about a factory that makes tables for example, the rounding should always be round-down type, because rounding up might mean that we are using materials or time that the factory doesn't have.
    Does it make sence?

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Does it make sence?
    Not to me, no.

    Solver operates according to its specified constraints, which include the time, materials, and any other resources within which the solution must fit, and constraints on the solution (integer values in this case). It optimizes the evaluation function subject to those constraints.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1