+ Reply to Thread
Results 1 to 10 of 10

Making sure variable is an integer?

Hybrid View

  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
    2010, 2019
    Posts
    40,689
    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
    2010, 2019
    Posts
    40,689
    If I did it right, I get 215 tables and 136 chairs:

           --A--- -B-- -C-- -D-- ---E--- -F- -------------G-------------- --H-- ----I-----
      13   Profit wood prod time Fitting box           Formula            Value Constraint
      14   tables 215   70   20    72     1              =20*x + 12.5 * y  6000 <= 6000   
      15   chairs 136   30  12.5   18     1                        =x + y   351 <= 400    
      16          > 0  > 0                               =72 * x + 18 * y 17928 <= 18000  
      17                                     =SUMPRODUCT(B14:B15,D14:D15)  6000 maximize
    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
    2010, 2019
    Posts
    40,689
    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.

+ 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