Hi,
I am trying to solve an optimization problem with Stata.
Here is a sample of the data have: Code:
Each pack ("pack") contains several items ("item" and their quantity "qty"). Each pack has a unique "pack_price" but the same "item" can be found in several packs, with different quantities ("qty"). I want to minimize the difference between the "pack_price" and the product of the "item_price" by the "qty" such that pack_price<sum(item_price*qty). We want to find the "item_price" for each "item". Finally, I want to add constraints such as "item_price"(i)> min_item_price_i.
In other words:
min (pack_price - sum(item_price*qty)
item_price
such that:
pack_price<sum(item_price*qty)
if item== xxx then item_price> min_item_i
I have tried to work with the following Stata command: optimize init() without much success. Here is the link:
http://www.stata.com/manuals13/m-5optimize.pdf
Can anyone help? Thanks a lot in advance!
I am trying to solve an optimization problem with Stata.
Here is a sample of the data have: Code:
pack | item | qty | pack_price |
SNESYSA02E | 1220-10 | 1 | 10 |
SNESYSA02E | 1220-11 | 1 | 10 |
SNESYSA02E | 220101091X | 0.0567 | 10 |
SNESYSA02E | 300204 | 1 | 10 |
SNESYSA02E | 302008 | 2 | 10 |
SNESYSA02E | 36004814 | 1 | 10 |
SNESYSA02E | 47394 | 2 | 10 |
SNESYSA02E | 48012 | 1 | 10 |
SNESYSA02E | 49279WH | 1 | 10 |
SNESYSA02E | 50346A | 4 | 10 |
SNESYSA02E | 8004000 | 1 | 10 |
SNESYSA02E | 8004002 | 1 | 10 |
SNESYSA02E | 8337A-BULK | 1 | 10 |
SNESYSA01I | 49279WH | 1 | 12 |
SNESYSA01I | 500.11.014 | 1 | 12 |
SNESYSA01I | 50346A | 2 | 12 |
SNESYSA01I | 53784 | 1 | 12 |
SNESYSA01I | 8004000 | 1 | 12 |
SNESYSA01I | 8004002 | 1 | 12 |
SNESYSA01I | 8337A-BULK | 1 | 12 |
SNESYSA01I | 8475-BULK | 2 | 12 |
SNESYSA01I | 8520ZD-BULK | 4 | 12 |
SNESYSA01I | 880901063 | 2 | 12 |
SNESYSA01I | 95157 | 1 | 12 |
SNESYSA01I | BTCL35-BULK | 1 | 12 |
SNESYSA01I | BTCM15-BULK | 1 | 12 |
SNESYSA01I | BVGP150 | 3 | 12 |
SNESYSA01I | BVKD700B | 3 | 12 |
SNESYSA01I | BVKD700Y | 2 | 12 |
SBASYSA08A | ALP/LSAS-61 | 1 | 9 |
SBASYSA08A | ALP/MIS-3B/C | 1 | 9 |
SBASYSA08A | BTCL35-BULK | 1 | 9 |
SBASYSA08A | BVGP150 | 2 | 9 |
SBASYSA08A | BVJ1400 | 1 | 9 |
SBASYSA08A | BVKD700B | 3 | 9 |
SBASYSA08A | BVKD700Y | 1 | 9 |
SBASYSA08A | BVPB2025 | 1 | 9 |
SBASYSA08A | BVQUIV | 1 | 9 |
SBASYSA08A | BVRG1010 | 5 | 9 |
SBASYSA08A | BVRG3030 | 5 | 9 |
SBASYSA08A | BVRP06L | 2 | 9 |
Each pack ("pack") contains several items ("item" and their quantity "qty"). Each pack has a unique "pack_price" but the same "item" can be found in several packs, with different quantities ("qty"). I want to minimize the difference between the "pack_price" and the product of the "item_price" by the "qty" such that pack_price<sum(item_price*qty). We want to find the "item_price" for each "item". Finally, I want to add constraints such as "item_price"(i)> min_item_price_i.
In other words:
min (pack_price - sum(item_price*qty)
item_price
such that:
pack_price<sum(item_price*qty)
if item== xxx then item_price> min_item_i
I have tried to work with the following Stata command: optimize init() without much success. Here is the link:
http://www.stata.com/manuals13/m-5optimize.pdf
Can anyone help? Thanks a lot in advance!
Comment