Solving Integer programming example with LPSOLVE: How to add restritions?

Discussion in 'Other Advanced Math' started by djcoder, Jan 20, 2022.

  1. djcoder

    djcoder

    Joined:
    Jan 20, 2022
    Messages:
    2
    Likes Received:
    0
    Problem:


    A company is attempting to decide the mix of products which it should produce
    next week. It has seven products, each with a profit (£) per unit and a production
    time (man-hours) per unit as shown below:


    |Product |Profit (£ per unit) |Production time (man-hours per unit)|
    |:----------|:--------------------:|----------------------------------------------|
    |1---------| 10------------------| 1.0-----------------------------------------|
    |2 --------| 22------------------| 2.0-----------------------------------------|
    |3 --------| 35------------------| 3.7-----------------------------------------|
    |4 --------| 19------------------| 2.4-----------------------------------------|
    |5 --------| 55------------------| 4.5-----------------------------------------|
    |6---------| 10------------------| 0.7-----------------------------------------|
    |7---------| 115-----------------| 9.5-----------------------------------------|


    The company has 720 man-hours available next week.
    Incorporate the following additional restrictions into your integer program
    (retaining linear constraints and a linear objective):


    • If any of product 7 are produced an additional fixed cost of £2000 is incurred.
    • Each unit of product 2 that is produced over 100 units requires a production time of 3.0 man-hours instead of 2.0 man-hours (e.g. producing 101 units of product 2 requires 100(2.0) + 1(3.0) man-hours).
    • If both product 3 and product 4 are produced 75 man-hours are needed for production line setup and hence the (effective) number of man-hours available falls to 720 - 75 = 645.

    Formulate the problem of how many units (if any) of each product to produce next
    week as an integer program in which all the constraints are linear


    Variables

    • - xi (integer >=0) be the number of units of product i produced then the integer program is
    • - z7 = 1 if produce product 7 (x7 >= 1), 0 otherwise
    • - y2 = number of units of product 2 produced in excess of 100 units, y2 >= 0
    • - z3 = 1 if produce product 3, 0 otherwise
    • - z4 = 1 if produce product 4, 0 otherwise
    • - Z = 1 if produce both product 3 and product 4, otherwise

    Restrictions


    • 1.0x1 + 2.0x2 + 3.7x3 + 2.4x4 + 4.5x5 + 0.7x6 + 9.5x7 <= 720
    • x7 <= Mz7
    • x2 <= 100 (This will work because x2 and y2 have the same objective function coefficient but y2 requires longer to produce so will always get more flexibility by producing x2 first (up to the 100 limit) before producing y2.)
    • 1.0x1 + (2.0x2 + 3.0y2) + 3.7x3 + 2.4x4 + 4.5x5 + 0.7x6 + 9.5x7 <= 720 - 75Z
    • x3 <= Mz3 and x4 <= Mz4
    • Z = z3z4

    which we linearise by replacing the non-linear constraint by the two linear
    constraints

    • Z >= z3 + z4 - 1
    • Z <= (z3 + z4)/2

    Objective

    maximise W = 10x1 + 22(x2 + y2) + 35x3 + 19x4 + 55x5 + 10x6 + 115x7


    Question : How to add the restrictions to lpsolve to solve the problem?
    I'm using lpsolve LpSolve software to help me solve the problem, but i'm having some difficulties writing the restrictions.


    Code:
    * Objective function */
    max:10x1+22x2+35x3+19x5+10x6+115x7 ;
    
    /* Variable bounds */
    x1 >=0;
    x2 >=0;
    x3 >=0;
    x4 >=0;
    x5 >=0;
    x6 >=0;
    x7 >=0;
    
    1.0x1 + 2.0x2 + 3.7x3 + 2.4x4 + 4.5x5 + 0.7x6 + 9.5x7 <= 720;
     
    djcoder, Jan 20, 2022
    #1
  2. djcoder

    MathLover1

    Joined:
    Jun 27, 2021
    Messages:
    2,989
    Likes Received:
    2,884
    here:
    http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html

    last example, so scroll down and see solution for:

    Integer programming example 1987 UG exam

    A company is attempting to decide the mix of products which it should produce next week. It has seven products, each with a profit (£) per unit and a production time (man-hours) per unit as shown below:
     
    MathLover1, Jan 21, 2022
    #2
  3. djcoder

    djcoder

    Joined:
    Jan 20, 2022
    Messages:
    2
    Likes Received:
    0
    @
    Thank you, it's the solution, similar to the solution that I expose, but my problem, is that i need to calculate "
    how many units (if any) of each product to produce next week ", and for doing that, i my using Ipsolve software, but i'm having difficulty in writing the right formulas in the software.
     
    djcoder, Jan 21, 2022
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...