|
|
 | | From: | JPC | | Subject: | Linearization of a Weighed average | | Date: | Mon, 17 Jan 2005 20:32:46 +0100 |
|
|
 |
Hi to all, I'm contending with difficulties of modelling a problem.
I've the following SET with the following properties:
PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD
where : QUANTITY = the quantity that I have to rent (the solver will suggest how many of each product I will rent) Monthly Cost = the money I've to pay each month to rent this product, this is a fixed amount for each product and period RENT_PERIOD = how many months I will use the product
for example I can have:
PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months
PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months
than, I have various constraint about the QUANTITY of each Product (I omit them, as they are not important here).
than I've the Objective function that is:
MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / SUM(PRODUCT: QUANTITY * RENT_PERIOD)
i.e. I want to minimize the weighed average of the MONTHLY_COST.
This objective will make my problem NOT LINEAR!!
Any way/chance to transform it in a Linear problem?
thanks a lot for any suggestion.
JPC
|
|
 | | From: | Steve | | Subject: | Re: Linearization of a Weighed average | | Date: | 18 Jan 2005 07:55:41 -0800 |
|
|
 | JPC,
You may have lost me here. But you are optimizing cost. While demand is a constraint. If you set demand constraints (PC's required) for each month in your operating profile, the solver will be forced to pick the best combination of cost-period combinations.
And if you do have month-specific demands it will pay you to create a month-specific index.
BTW, generally you can not formulate a linear model in which decision variables are multiplied or divided by each other. (There is an exception called quadratic programming, but forget about that for now.)
Steve
P.S. I am busy so if you have another question, I may not get to it till tomorrow.
|
|
 | | From: | JPC | | Subject: | Re: Linearization of a Weighed average | | Date: | Tue, 18 Jan 2005 17:03:29 +0100 |
|
|
 | Many thanks Steve!
I'm going to think better about your helpful assertions.
Sorry for all my annoying questions.
thanks JPC
|
|
 | | From: | Bob Daniel | | Subject: | Re: Linearization of a Weighed average | | Date: | Tue, 18 Jan 2005 09:35:50 -0000 |
|
|
 | I do suggest you buy a book on MP modeling. I would suggest (but then I would) Applications of optimization with Xpress-MP Christelle Guéret, Christian Prins & Marc Sevaux Translated and revised by Susanne Heipcke Dash Optimization, 2002, ISBN 0-9543503-0-8
I have put the section on ratio objective functions at http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf
Regards Bob Daniel
"JPC" wrote in message news:csh3t2$gus$1@atlantis.cu.mi.it... > > > Hi to all, > I'm contending with difficulties of modelling a problem. > > I've the following SET with the following properties: > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > where : > QUANTITY = the quantity that I have to rent (the solver will suggest how > many of each product I will rent) > Monthly Cost = the money I've to pay each month to rent this product, this > is a fixed amount for each product and period > RENT_PERIOD = how many months I will use the product > > for example I can have: > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > than, I have various constraint about the QUANTITY of each Product (I omit > them, as they are not important here). > > > than I've the Objective function that is: > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / SUM(PRODUCT: > QUANTITY * RENT_PERIOD) > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > This objective will make my problem NOT LINEAR!! > > Any way/chance to transform it in a Linear problem? > > thanks a lot for any suggestion. > > JPC > > >
|
|
 | | From: | JPC | | Subject: | Re: Linearization of a Weighed average | | Date: | Tue, 18 Jan 2005 13:40:45 +0100 |
|
|
 | Hi Bob,
can you give me a little help with the modelling? I wrote the following (omitting the not important information):
SETS: PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD, Y !where the values of the variables MONTHLY_COST and RENT_PERIOD are loaded from a file, so they are frozen, while the QUANTITY and Y variables(I intoduced the Y variable following your help) must be calculated by the solver;
!Objective; MIN = SUM(PRODUCT: MONTHLY_COST * RENT_PERIOD * Y ) ;
!Constraints:; 1= SUM(PRODUCT: RENT_PERIOD * Y);
FOR (PRODUCT: Y = QUANTITY * D ); !--> this last condition makes my problem not linear;
How to write it in a linear way? thanks again, I promise that after this I will buy a good book! The problem is that is not easy to find a good book here in my little town in Italy...
bye JPC
--
"Bob Daniel" wrote in message news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > I do suggest you buy a book on MP modeling. I would suggest (but then I > would) > Applications of optimization with Xpress-MP > Christelle Guéret, Christian Prins & Marc Sevaux > Translated and revised by Susanne Heipcke > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > I have put the section on ratio objective functions at > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > Regards > Bob Daniel > > "JPC" wrote in message > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > Hi to all, > > I'm contending with difficulties of modelling a problem. > > > > I've the following SET with the following properties: > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > where : > > QUANTITY = the quantity that I have to rent (the solver will suggest how > > many of each product I will rent) > > Monthly Cost = the money I've to pay each month to rent this product, > this > > is a fixed amount for each product and period > > RENT_PERIOD = how many months I will use the product > > > > for example I can have: > > > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > > > > than, I have various constraint about the QUANTITY of each Product (I omit > > them, as they are not important here). > > > > > > than I've the Objective function that is: > > > > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / SUM(PRODUCT: > > QUANTITY * RENT_PERIOD) > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > This objective will make my problem NOT LINEAR!! > > > > Any way/chance to transform it in a Linear problem? > > > > thanks a lot for any suggestion. > > > > JPC > > > > > > > >
|
|
 | | From: | Bob Daniel | | Subject: | Re: Linearization of a Weighed average | | Date: | Wed, 19 Jan 2005 10:34:15 -0000 |
|
|
 | From the incomplete info you have given I guess your problem is to minimise the cost of covering demand for products p in month m. Your decision variables are say h(p,m',t), the number of product p to hire in month m' for a duration of t months. I don't understand why these isn't a separate problem for each p. If the rental cost depends on the total hired in month m' over all p, then of course you just have 1 problem. All (all!) you have to do is to get the right summations to find the total of each p you have in month m (clue: not those for which m'>m, not those whose hire period has finished). We leave getting the summation limits right as an exercise for you, AFTER you have used the internet to order a book, and got the italian post office to deliver it to you. The ratio obj fn looks a (wrong) side issue. Regards Bob
"JPC" wrote in message news:csj04d$jdk$1@atlantis.cu.mi.it... > Hi Bob, > > can you give me a little help with the modelling? > I wrote the following (omitting the not important information): > > SETS: > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD, Y > !where the values of the variables MONTHLY_COST and RENT_PERIOD are loaded > from a file, so they are frozen, while the QUANTITY and Y variables(I > intoduced the Y variable following your help) must be calculated by the > solver; > > !Objective; > MIN = SUM(PRODUCT: MONTHLY_COST * RENT_PERIOD * Y ) ; > > !Constraints:; > 1= SUM(PRODUCT: RENT_PERIOD * Y); > > FOR (PRODUCT: Y = QUANTITY * D ); !--> this last condition makes my problem > not linear; > > > How to write it in a linear way? > thanks again, I promise that after this I will buy a good book! > The problem is that is not easy to find a good book here in my little town > in Italy... > > bye > JPC > > -- > > "Bob Daniel" wrote in message > news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > > I do suggest you buy a book on MP modeling. I would suggest (but then I > > would) > > Applications of optimization with Xpress-MP > > Christelle Guéret, Christian Prins & Marc Sevaux > > Translated and revised by Susanne Heipcke > > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > > > I have put the section on ratio objective functions at > > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > > > Regards > > Bob Daniel > > > > "JPC" wrote in message > > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > > > > Hi to all, > > > I'm contending with difficulties of modelling a problem. > > > > > > I've the following SET with the following properties: > > > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > > > where : > > > QUANTITY = the quantity that I have to rent (the solver will suggest > how > > > many of each product I will rent) > > > Monthly Cost = the money I've to pay each month to rent this product, > > this > > > is a fixed amount for each product and period > > > RENT_PERIOD = how many months I will use the product > > > > > > for example I can have: > > > > > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > > > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > > > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > > > > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > > > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > > > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > > > > > > > than, I have various constraint about the QUANTITY of each Product (I > omit > > > them, as they are not important here). > > > > > > > > > than I've the Objective function that is: > > > > > > > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / SUM(PRODUCT: > > > QUANTITY * RENT_PERIOD) > > > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > > > This objective will make my problem NOT LINEAR!! > > > > > > Any way/chance to transform it in a Linear problem? > > > > > > thanks a lot for any suggestion. > > > > > > JPC > > > > > > > > > > > > > > >
|
|
 | | From: | JPC | | Subject: | Re: Linearization of a Weighed average | | Date: | Wed, 19 Jan 2005 13:43:18 +0100 |
|
|
 | Bob, thanks for your suggestions. I want just let you know that I've already modelled the problem, and the primary goal, i.e. the demand covering for each month, has been altready reached. The problem of the demand covering is separated for each Prodoct, as you have observed. But the cost, I think, to be minimised, is the weighed average cost, considering all the Products. Am I wrong in this assumption?
The problem, IMHO, is due to the fact that when I run the solver, the demand is defined ONLY for the Current Year (2005). A lot of products bought during the 2005, will have the End of the hire period in 2006. But in 2006 I've no demand to satisfy (or better, we will have the 2006 demand only in early autumn 2005), so that if I ask to the solver the best total cost (i.e. sum of Monthly Cost * Prod.qty * hire duration months), in my mind the solver, for those products ending in 2006, will try to reduce the "hire duration months", rather then chosing a best Monthly Cost. But, now, while I'm writing, I think that the solution can be the following: I've to calculate the Best Total Cost only for the whole 2005, not taking into account the hire period after the 2005. Total Cost = SUM(Monthly Cost * Product Qty * Hire Period); but the Hire period to be considered must be limited to Dec 2005. What do you think about that? Is it correct?
Regarding the book, does it contain also a sort of Tricks library (where to find for example how to linearise some conditions)? For me is very important to know all the possible Tricks, because really, since I'm a computer programmer, I did not spent a lot of time on the modelling (defining sets, variables, sum operations, an so on, are quite simple tasks), but I really spent a lot of time on the linearization of sum constraints, on the transformation of some constraints into goal objectives , and so on. So I really need a book that contains, besides a lto of example, also a sort of reference about all the possible Tricks. For example, I needed to linearise the Absolute Value of a variable. I searched the Internet and I spent one day to find the simple (all is simple when you know it) solution. If I had a good book with a a sort of "Tricks Reference", I think I would have saved a lot of time.
thanks again
--
"Bob Daniel" wrote in message news:csld4v$p5$1$8302bc10@news.demon.co.uk... > From the incomplete info you have given I guess your problem is to minimise > the cost of covering demand for products p in month m. Your decision > variables are say h(p,m',t), the number of product p to hire in month m' for > a duration of t months. > I don't understand why these isn't a separate problem for each p. If the > rental cost depends on the total hired in month m' over all p, then of > course you just have 1 problem. > All (all!) you have to do is to get the right summations to find the total > of each p you have in month m (clue: not those for which m'>m, not those > whose hire period has finished). We leave getting the summation limits right > as an exercise for you, AFTER you have used the internet to order a book, > and got the italian post office to deliver it to you. > The ratio obj fn looks a (wrong) side issue. > Regards > Bob > > "JPC" wrote in message > news:csj04d$jdk$1@atlantis.cu.mi.it... > > Hi Bob, > > > > can you give me a little help with the modelling? > > I wrote the following (omitting the not important information): > > > > SETS: > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD, Y > > !where the values of the variables MONTHLY_COST and RENT_PERIOD are loaded > > from a file, so they are frozen, while the QUANTITY and Y variables(I > > intoduced the Y variable following your help) must be calculated by the > > solver; > > > > !Objective; > > MIN = SUM(PRODUCT: MONTHLY_COST * RENT_PERIOD * Y ) ; > > > > !Constraints:; > > 1= SUM(PRODUCT: RENT_PERIOD * Y); > > > > FOR (PRODUCT: Y = QUANTITY * D ); !--> this last condition makes my > problem > > not linear; > > > > > > How to write it in a linear way? > > thanks again, I promise that after this I will buy a good book! > > The problem is that is not easy to find a good book here in my little town > > in Italy... > > > > bye > > JPC > > > > -- > > > > "Bob Daniel" wrote in message > > news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > > > I do suggest you buy a book on MP modeling. I would suggest (but then I > > > would) > > > Applications of optimization with Xpress-MP > > > Christelle Guéret, Christian Prins & Marc Sevaux > > > Translated and revised by Susanne Heipcke > > > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > > > > > I have put the section on ratio objective functions at > > > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > > > > > Regards > > > Bob Daniel > > > > > > "JPC" wrote in message > > > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > > > > > > > Hi to all, > > > > I'm contending with difficulties of modelling a problem. > > > > > > > > I've the following SET with the following properties: > > > > > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > > > > > where : > > > > QUANTITY = the quantity that I have to rent (the solver will suggest > > how > > > > many of each product I will rent) > > > > Monthly Cost = the money I've to pay each month to rent this product, > > > this > > > > is a fixed amount for each product and period > > > > RENT_PERIOD = how many months I will use the product > > > > > > > > for example I can have: > > > > > > > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > > > > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > > > > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > > > > > > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > > > > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > > > > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > > > > > > > > > > than, I have various constraint about the QUANTITY of each Product (I > > omit > > > > them, as they are not important here). > > > > > > > > > > > > than I've the Objective function that is: > > > > > > > > > > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / > SUM(PRODUCT: > > > > QUANTITY * RENT_PERIOD) > > > > > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > > > > > This objective will make my problem NOT LINEAR!! > > > > > > > > Any way/chance to transform it in a Linear problem? > > > > > > > > thanks a lot for any suggestion. > > > > > > > > JPC > > > > > > > > > > > > > > > > > > > > > > > >
|
|
 | | From: | Bob Daniel | | Subject: | Re: Linearization of a Weighed average | | Date: | Wed, 19 Jan 2005 15:06:32 -0000 |
|
|
 | "JPC" wrote in message news:cslkl7$8dh$1@atlantis.cu.mi.it... > Bob, > thanks for your suggestions. > I want just let you know that I've already modelled the problem, and the > primary goal, i.e. the demand covering for each month, has been altready > reached. > The problem of the demand covering is separated for each Prodoct, as you > have observed. > But the cost, I think, to be minimised, is the weighed average cost, > considering all the Products. > Am I wrong in this assumption?
I don't see why you want to do this. Is it linked to what follows?
> > The problem, IMHO, is due to the fact that when I run the solver, the demand > is defined ONLY for the Current Year (2005). > A lot of products bought during the 2005, will have the End of the hire > period in 2006. > But in 2006 I've no demand to satisfy (or better, we will have the 2006 > demand only in early autumn 2005), so that if I ask to the solver the best > total cost (i.e. sum of Monthly Cost * Prod.qty * hire duration months), > in my mind the solver, for those products ending in 2006, will try to reduce > the "hire duration months", rather then chosing a best Monthly Cost. > But, now, while I'm writing, I think that the solution can be the following: > I've to calculate the Best Total Cost only for the whole 2005, not taking > into account the hire period after the 2005. > Total Cost = SUM(Monthly Cost * Product Qty * Hire Period); but the Hire > period to be considered must be limited to Dec 2005. > What do you think about that? Is it correct?
You are going through the "how to model" learning process at an accelerated pace. Now you have come to the classic "what do I do about end effects?" problem. It's the same in production planning, when the "best" thing to do is to leave the system with no stock, as this minimizes costs. There is no correct answer, but ignoring 2006 is probably a bad idea. Your suggestion would lead to long hires going well into 2006, as they have the lowest cost per period in 2005. A conventional, easy idea is to duplicate the 2005 demand into 2006, on the hypothesis that the best forecast of tomorrow is today.
> Regarding the book, does it contain also a sort of Tricks library (where to > find for example how to linearise some conditions)?
Yes. But it doesn't have "all possible tricks". That would be too big a claim. A lot, though.
> For me is very important to know all the possible Tricks, because really, > since I'm a computer programmer, I did not spent a lot of time on the > modelling (defining sets, variables, sum operations, an so on, are quite > simple tasks), but I really spent a lot of time on the linearization of sum > constraints, on the transformation of some constraints into goal objectives > , and so on. > So I really need a book that contains, besides a lto of example, also a sort > of reference about all the possible Tricks. > For example, I needed to linearise the Absolute Value of a variable. I > searched the Internet and I spent one day to find the simple (all is simple > when you know it) solution. If I had a good book with a a sort of "Tricks > Reference", I think I would have saved a lot of time. > > thanks again > > -- > > "Bob Daniel" wrote in message > news:csld4v$p5$1$8302bc10@news.demon.co.uk... > > From the incomplete info you have given I guess your problem is to > minimise > > the cost of covering demand for products p in month m. Your decision > > variables are say h(p,m',t), the number of product p to hire in month m' > for > > a duration of t months. > > I don't understand why these isn't a separate problem for each p. If the > > rental cost depends on the total hired in month m' over all p, then of > > course you just have 1 problem. > > All (all!) you have to do is to get the right summations to find the total > > of each p you have in month m (clue: not those for which m'>m, not those > > whose hire period has finished). We leave getting the summation limits > right > > as an exercise for you, AFTER you have used the internet to order a book, > > and got the italian post office to deliver it to you. > > The ratio obj fn looks a (wrong) side issue. > > Regards > > Bob > > > > "JPC" wrote in message > > news:csj04d$jdk$1@atlantis.cu.mi.it... > > > Hi Bob, > > > > > > can you give me a little help with the modelling? > > > I wrote the following (omitting the not important information): > > > > > > SETS: > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD, Y > > > !where the values of the variables MONTHLY_COST and RENT_PERIOD are > loaded > > > from a file, so they are frozen, while the QUANTITY and Y variables(I > > > intoduced the Y variable following your help) must be calculated by the > > > solver; > > > > > > !Objective; > > > MIN = SUM(PRODUCT: MONTHLY_COST * RENT_PERIOD * Y ) ; > > > > > > !Constraints:; > > > 1= SUM(PRODUCT: RENT_PERIOD * Y); > > > > > > FOR (PRODUCT: Y = QUANTITY * D ); !--> this last condition makes my > > problem > > > not linear; > > > > > > > > > How to write it in a linear way? > > > thanks again, I promise that after this I will buy a good book! > > > The problem is that is not easy to find a good book here in my little > town > > > in Italy... > > > > > > bye > > > JPC > > > > > > -- > > > > > > "Bob Daniel" wrote in message > > > news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > > > > I do suggest you buy a book on MP modeling. I would suggest (but then > I > > > > would) > > > > Applications of optimization with Xpress-MP > > > > Christelle Guéret, Christian Prins & Marc Sevaux > > > > Translated and revised by Susanne Heipcke > > > > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > > > > > > > I have put the section on ratio objective functions at > > > > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > > > > > > > Regards > > > > Bob Daniel > > > > > > > > "JPC" wrote in message > > > > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > > > > > > > > > > Hi to all, > > > > > I'm contending with difficulties of modelling a problem. > > > > > > > > > > I've the following SET with the following properties: > > > > > > > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > > > > > > > where : > > > > > QUANTITY = the quantity that I have to rent (the solver will > suggest > > > how > > > > > many of each product I will rent) > > > > > Monthly Cost = the money I've to pay each month to rent this > product, > > > > this > > > > > is a fixed amount for each product and period > > > > > RENT_PERIOD = how many months I will use the product > > > > > > > > > > for example I can have: > > > > > > > > > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > > > > > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > > > > > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > > > > > > > > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > > > > > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > > > > > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > > > > > > > > > > > > > than, I have various constraint about the QUANTITY of each Product > (I > > > omit > > > > > them, as they are not important here). > > > > > > > > > > > > > > > than I've the Objective function that is: > > > > > > > > > > > > > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / > > SUM(PRODUCT: > > > > > QUANTITY * RENT_PERIOD) > > > > > > > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > > > > > > > This objective will make my problem NOT LINEAR!! > > > > > > > > > > Any way/chance to transform it in a Linear problem? > > > > > > > > > > thanks a lot for any suggestion. > > > > > > > > > > JPC > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
|
|
 | | From: | Bob Daniel | | Subject: | Re: Linearization of a Weighed average | | Date: | Wed, 19 Jan 2005 11:40:28 -0000 |
|
|
 | Example 10.6 of the book I suggested (see http://www.dashoptimization.com/home/services/publications/applications_book_ov.html) does nearly what you want. Bob "JPC" wrote in message news:csj04d$jdk$1@atlantis.cu.mi.it... > Hi Bob, > > can you give me a little help with the modelling? > I wrote the following (omitting the not important information): > > SETS: > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD, Y > !where the values of the variables MONTHLY_COST and RENT_PERIOD are loaded > from a file, so they are frozen, while the QUANTITY and Y variables(I > intoduced the Y variable following your help) must be calculated by the > solver; > > !Objective; > MIN = SUM(PRODUCT: MONTHLY_COST * RENT_PERIOD * Y ) ; > > !Constraints:; > 1= SUM(PRODUCT: RENT_PERIOD * Y); > > FOR (PRODUCT: Y = QUANTITY * D ); !--> this last condition makes my problem > not linear; > > > How to write it in a linear way? > thanks again, I promise that after this I will buy a good book! > The problem is that is not easy to find a good book here in my little town > in Italy... > > bye > JPC > > -- > > "Bob Daniel" wrote in message > news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > > I do suggest you buy a book on MP modeling. I would suggest (but then I > > would) > > Applications of optimization with Xpress-MP > > Christelle Guéret, Christian Prins & Marc Sevaux > > Translated and revised by Susanne Heipcke > > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > > > I have put the section on ratio objective functions at > > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > > > Regards > > Bob Daniel > > > > "JPC" wrote in message > > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > > > > Hi to all, > > > I'm contending with difficulties of modelling a problem. > > > > > > I've the following SET with the following properties: > > > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > > > where : > > > QUANTITY = the quantity that I have to rent (the solver will suggest > how > > > many of each product I will rent) > > > Monthly Cost = the money I've to pay each month to rent this product, > > this > > > is a fixed amount for each product and period > > > RENT_PERIOD = how many months I will use the product > > > > > > for example I can have: > > > > > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > > > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > > > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > > > > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > > > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > > > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > > > > > > > than, I have various constraint about the QUANTITY of each Product (I > omit > > > them, as they are not important here). > > > > > > > > > than I've the Objective function that is: > > > > > > > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / SUM(PRODUCT: > > > QUANTITY * RENT_PERIOD) > > > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > > > This objective will make my problem NOT LINEAR!! > > > > > > Any way/chance to transform it in a Linear problem? > > > > > > thanks a lot for any suggestion. > > > > > > JPC > > > > > > > > > > > > > > >
|
|
 | | From: | JPC | | Subject: | Re: Linearization of a Weighed average | | Date: | Wed, 19 Jan 2005 13:08:01 +0100 |
|
|
 | I'm ordering it!
thanks!
--
"Bob Daniel" wrote in message news:cslh15$6sg$1$830fa795@news.demon.co.uk... > Example 10.6 of the book I suggested (see > http://www.dashoptimization.com/home/services/publications/applications_book _ov.html) > does nearly what you want. > Bob > "JPC" wrote in message > news:csj04d$jdk$1@atlantis.cu.mi.it... > > Hi Bob, > > > > can you give me a little help with the modelling? > > I wrote the following (omitting the not important information): > > > > SETS: > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD, Y > > !where the values of the variables MONTHLY_COST and RENT_PERIOD are loaded > > from a file, so they are frozen, while the QUANTITY and Y variables(I > > intoduced the Y variable following your help) must be calculated by the > > solver; > > > > !Objective; > > MIN = SUM(PRODUCT: MONTHLY_COST * RENT_PERIOD * Y ) ; > > > > !Constraints:; > > 1= SUM(PRODUCT: RENT_PERIOD * Y); > > > > FOR (PRODUCT: Y = QUANTITY * D ); !--> this last condition makes my > problem > > not linear; > > > > > > How to write it in a linear way? > > thanks again, I promise that after this I will buy a good book! > > The problem is that is not easy to find a good book here in my little town > > in Italy... > > > > bye > > JPC > > > > -- > > > > "Bob Daniel" wrote in message > > news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > > > I do suggest you buy a book on MP modeling. I would suggest (but then I > > > would) > > > Applications of optimization with Xpress-MP > > > Christelle Guéret, Christian Prins & Marc Sevaux > > > Translated and revised by Susanne Heipcke > > > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > > > > > I have put the section on ratio objective functions at > > > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > > > > > Regards > > > Bob Daniel > > > > > > "JPC" wrote in message > > > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > > > > > > > Hi to all, > > > > I'm contending with difficulties of modelling a problem. > > > > > > > > I've the following SET with the following properties: > > > > > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > > > > > where : > > > > QUANTITY = the quantity that I have to rent (the solver will suggest > > how > > > > many of each product I will rent) > > > > Monthly Cost = the money I've to pay each month to rent this product, > > > this > > > > is a fixed amount for each product and period > > > > RENT_PERIOD = how many months I will use the product > > > > > > > > for example I can have: > > > > > > > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > > > > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > > > > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > > > > > > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > > > > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > > > > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > > > > > > > > > > than, I have various constraint about the QUANTITY of each Product (I > > omit > > > > them, as they are not important here). > > > > > > > > > > > > than I've the Objective function that is: > > > > > > > > > > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / > SUM(PRODUCT: > > > > QUANTITY * RENT_PERIOD) > > > > > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > > > > > This objective will make my problem NOT LINEAR!! > > > > > > > > Any way/chance to transform it in a Linear problem? > > > > > > > > thanks a lot for any suggestion. > > > > > > > > JPC > > > > > > > > > > > > > > > > > > > > > > > >
|
|
 | | From: | JPC | | Subject: | Re: Linearization of a Weighed average | | Date: | Tue, 18 Jan 2005 12:17:39 +0100 |
|
|
 | Thanks for the suggestions.
Just to be sure to have understood:
does this guideline(http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf) make the solution a LP one? I've tried but the problem remain NLP (I'm using lingo...).
bye JPC
--
"Bob Daniel" wrote in message news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > I do suggest you buy a book on MP modeling. I would suggest (but then I > would) > Applications of optimization with Xpress-MP > Christelle Guéret, Christian Prins & Marc Sevaux > Translated and revised by Susanne Heipcke > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > I have put the section on ratio objective functions at > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > Regards > Bob Daniel > > "JPC" wrote in message > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > Hi to all, > > I'm contending with difficulties of modelling a problem. > > > > I've the following SET with the following properties: > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > where : > > QUANTITY = the quantity that I have to rent (the solver will suggest how > > many of each product I will rent) > > Monthly Cost = the money I've to pay each month to rent this product, > this > > is a fixed amount for each product and period > > RENT_PERIOD = how many months I will use the product > > > > for example I can have: > > > > PRODUCT= PROD1, MONTHLY_COST = 100, RENT_PERIOD = 5 months > > PRODUCT= PROD1, MONTHLY_COST = 80, RENT_PERIOD = 6 months > > PRODUCT= PROD1, MONTHLY_COST = 75, RENT_PERIOD = 7 months > > > > PRODUCT= PROD2, MONTHLY_COST = 110, RENT_PERIOD = 5 months > > PRODUCT= PROD2, MONTHLY_COST = 120, RENT_PERIOD = 6 months > > PRODUCT= PROD2, MONTHLY_COST = 130, RENT_PERIOD = 7 months > > > > > > than, I have various constraint about the QUANTITY of each Product (I omit > > them, as they are not important here). > > > > > > than I've the Objective function that is: > > > > > > MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / SUM(PRODUCT: > > QUANTITY * RENT_PERIOD) > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > This objective will make my problem NOT LINEAR!! > > > > Any way/chance to transform it in a Linear problem? > > > > thanks a lot for any suggestion. > > > > JPC > > > > > > > >
|
|
 | | From: | Steve | | Subject: | Re: Linearization of a Weighed average | | Date: | 19 Jan 2005 04:06:04 -0800 |
|
|
 | Bob,
I think that's what I said. Even if JPC understands that, he still has to work through the learning process of the model management system to properly formulate the decision variables and constraints. And if the problem ends up going IP and it's large, he'll have to tune the solver too to ensure an acceptable run time, and not to mention managing data I/O. Quite a chore for a novice.
So JPC, yes buy a book (www.amazon.com). If you have a short turn around for this as well as other job responsibilities, you'll probably have some trouble unless you get someone to help you (not just this newsgroup.)
Steve
Bob Daniel wrote: > From the incomplete info you have given I guess your problem is to minimise > the cost of covering demand for products p in month m. Your decision > variables are say h(p,m',t), the number of product p to hire in month m' for > a duration of t months. > I don't understand why these isn't a separate problem for each p. If the > rental cost depends on the total hired in month m' over all p, then of > course you just have 1 problem. > All (all!) you have to do is to get the right summations to find the total > of each p you have in month m (clue: not those for which m'>m, not those > whose hire period has finished). We leave getting the summation limits right > as an exercise for you, AFTER you have used the internet to order a book, > and got the italian post office to deliver it to you. > The ratio obj fn looks a (wrong) side issue. > Regards > Bob > > "JPC" wrote in message > news:csj04d$jdk$1@atlantis.cu.mi.it... > > Hi Bob, > > > > can you give me a little help with the modelling? > > I wrote the following (omitting the not important information): > > > > SETS: > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD, Y > > !where the values of the variables MONTHLY_COST and RENT_PERIOD are loaded > > from a file, so they are frozen, while the QUANTITY and Y variables(I > > intoduced the Y variable following your help) must be calculated by the > > solver; > > > > !Objective; > > MIN =3D SUM(PRODUCT: MONTHLY_COST * RENT_PERIOD * Y ) ; > > > > !Constraints:; > > 1=3D SUM(PRODUCT: RENT_PERIOD * Y); > > > > FOR (PRODUCT: Y =3D QUANTITY * D ); !--> this last condition makes my > problem > > not linear; > > > > > > How to write it in a linear way? > > thanks again, I promise that after this I will buy a good book! > > The problem is that is not easy to find a good book here in my little town > > in Italy... > > > > bye > > JPC > > > > -- > > > > "Bob Daniel" wrote in message > > news:csilbe$1g8$1$8300dec7@news.demon.co.uk... > > > I do suggest you buy a book on MP modeling. I would suggest (but then I > > > would) > > > Applications of optimization with Xpress-MP > > > Christelle Gu=E9ret, Christian Prins & Marc Sevaux > > > Translated and revised by Susanne Heipcke > > > Dash Optimization, 2002, ISBN 0-9543503-0-8 > > > > > > I have put the section on ratio objective functions at > > > http://www.blisworthhouse.co.uk/OR/Bits_of_Book/ratio_obj_fn.pdf > > > > > > Regards > > > Bob Daniel > > > > > > "JPC" wrote in message > > > news:csh3t2$gus$1@atlantis.cu.mi.it... > > > > > > > > > > > > Hi to all, > > > > I'm contending with difficulties of modelling a problem. > > > > > > > > I've the following SET with the following properties: > > > > > > > > PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD > > > > > > > > where : > > > > QUANTITY =3D the quantity that I have to rent (the solver will suggest > > how > > > > many of each product I will rent) > > > > Monthly Cost =3D the money I've to pay each month to rent this product, > > > this > > > > is a fixed amount for each product and period > > > > RENT_PERIOD =3D how many months I will use the product > > > > > > > > for example I can have: > > > > > > > > PRODUCT=3D PROD1, MONTHLY_COST =3D 100, RENT_PERIOD =3D 5 months > > > > PRODUCT=3D PROD1, MONTHLY_COST =3D 80, RENT_PERIOD =3D 6 months > > > > PRODUCT=3D PROD1, MONTHLY_COST =3D 75, RENT_PERIOD =3D 7 months > > > > > > > > PRODUCT=3D PROD2, MONTHLY_COST =3D 110, RENT_PERIOD =3D 5 months > > > > PRODUCT=3D PROD2, MONTHLY_COST =3D 120, RENT_PERIOD =3D 6 months > > > > PRODUCT=3D PROD2, MONTHLY_COST =3D 130, RENT_PERIOD =3D 7 months > > > > > > > > > > > > than, I have various constraint about the QUANTITY of each Product (I > > omit > > > > them, as they are not important here). > > > > > > > > > > > > than I've the Objective function that is: > > > > > > > > > > > > MIN =3D SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / > SUM(PRODUCT: > > > > QUANTITY * RENT_PERIOD) > > > > > > > > i.e. I want to minimize the weighed average of the MONTHLY_COST. > > > > > > > > This objective will make my problem NOT LINEAR!! > > > > > > > > Any way/chance to transform it in a Linear problem? > > > > > > > > thanks a lot for any suggestion. > > > > > > > > JPC > > > > > > > > > > > > > > > > > > > > > >
|
|
 | | From: | Steve | | Subject: | Re: Linearization of a Weighed average | | Date: | 18 Jan 2005 05:57:39 -0800 |
|
|
 | JPC,
These problems always turn out more complicated than they initially seem. It appears that you have to create a set of integer variables that are indexed on the PC type (i), the plan type (Rent Period) (j) and the month that you the lease starts (k). For example Var P1,2,4 would represent leasing PC of type 1 using Lease Plan 2 (6 months), starting in month 4 (April).
So you would have many variables in order to cover all of the PC type, plan type, month start combinations. You would then create constraints by summing the feasible integer variables for each month such that demand is met. You also have to establish your internal policy for returning PC's early. It may be cost effective to rent using a 7 month agreement in July and return the machines in December (if you have a 12 month planning cycle.) And another policy to consider is whether you can buy multiple leases of the same PC type with the same or different plans starting on different months. If that is a policy, then you have a pretty complicated formulation indeed. But it should be workable with an algebraic modeling system. But you have to be very careful when you debug to ensure that the proper decision variables and constraints are being generated.
So I think I see what you want to do. I still do not think that weighted averaging is correct. Minimize total cost using the methodology above and it should work for you.
Steve
|
|
 | | From: | JPC | | Subject: | Re: Linearization of a Weighed average | | Date: | Tue, 18 Jan 2005 15:28:42 +0100 |
|
|
 | Steve,
yes I think you have understood. For a moment suppose that that we must start the renting in january 2005(now). We can omit the Starting Rental Month, ok?
My previous SET: PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD
describes exactly the situation: we have a PC_TYPE (product), and for each PC type we have different possible RENTAL_PERIOD(months of rent), and different MONTHLY_COST. So I have a (very large) matrix of possible combination and the solver should set the Qty of each possible combination.
In reality my optimisation function is composed, besides a lot of goal constraints, of two functions:
1) a function that will optimise the monthly demand 2) a function that will optimise the cost.
This 2nd function is a weighed average, because, otherwise, if I consider the total cost (i.e. QTY * MONTHLY_COST * RENT_PERIOD), then the RENT_PERIOD will have an important weight in the formula (i.e. the solver will obtain better solution both using lower Monthly_Cost and/or lower/shorter RENT_Period).
If I consider only the QTY * MONTHLY_COST, then again the solver can chose lower qty, instead of chosing the best COST. Consider that the first function can be optimised in a very different way, so that many possible combination of the QTY of each row can lead to the same best optimal Function1 result.
I'm pretty sure that the weighed average IS the solution.
Any way to make it a linear function?
thanks
"Steve" wrote in message news:1106056659.910066.247610@z14g2000cwz.googlegroups.com... > JPC, > > These problems always turn out more complicated than they initially > seem. It appears that you have to create a set of integer variables > that are indexed on the PC type (i), the plan type (Rent Period) (j) > and the month that you the lease starts (k). For example Var P1,2,4 > would represent leasing PC of type 1 using Lease Plan 2 (6 months), > starting in month 4 (April). > > So you would have many variables in order to cover all of the PC type, > plan type, month start combinations. You would then create constraints > by summing the feasible integer variables for each month such that > demand is met. You also have to establish your internal policy for > returning PC's early. It may be cost effective to rent using a 7 > month agreement in July and return the machines in December (if you > have a 12 month planning cycle.) And another policy to consider is > whether you can buy multiple leases of the same PC type with the same > or different plans starting on different months. If that is a policy, > then you have a pretty complicated formulation indeed. But it should > be workable with an algebraic modeling system. But you have to be very > careful when you debug to ensure that the proper decision variables and > constraints are being generated. > > So I think I see what you want to do. I still do not think that > weighted averaging is correct. Minimize total cost using the > methodology above and it should work for you. > > Steve >
|
|
 | | From: | Steve | | Subject: | Re: Linearization of a Weighed average | | Date: | 18 Jan 2005 04:58:49 -0800 |
|
|
 | JPC,
I'm not really sure what you are trying to do here. But I think that you may be missing at least one index (Month) in your model. It looks like you have a set covering problem. If you define and index your decision variables correctly, you should not need the denominator in the objective function. You will simply minimize cost. The demand and resource constraints would be handled as just that - constraints.
Agree with Bob Daniel. Suggest you find a book or web page that deals with linear programming applications or else hire someone to assist you. BTW, LINDO has an applications library on their web site: http://www.lindo.com/ If you bought LINGO from them, they may provide modeling support.
Steve
|
|
 | | From: | JPC | | Subject: | Re: Linearization of a Weighed average | | Date: | Tue, 18 Jan 2005 14:27:50 +0100 |
|
|
 | Hi Steve, I've omitted a lot of index and set here. Of course I've also Months and a lot of other indexes.
But what is important for me now, is to know if a weighed average can be linearized or not.
In any case, if you can kindly help me, with the following little model I want to resolve this simple problem: given a set of PRODUCTS(Personal Computers), my company needs to LEASE / RENT, now in january 2005, some Qty of these products(PC), then we will use them for a certain Period (i.e. for a certain number of months), then we will return these PCs to the suppliers. Depending on the PRODUCT (PC type), and depending on the Usage Period (RENT_PERIOD), we have to pay a MONTHLY_COST for each PC. At this point we want to be sure to pay the lowest weighed average MONTHLY_COST.
I've translated the problem in:
SETS: PRODUCT: QUANTITY, MONTHLY_COST, RENT_PERIOD where :
QUANTITY = the quantity that I have to rent (the solver will suggest how many of each product I will rent), this is the unique variable that must be calculated by the solver.
MONTHLY_COST = the money I've to pay each month to use each product type, this is a fixed amount for each row/combination below
RENT_PERIOD = how many months I will use the product, this is a fixed number for each row
for example I can have:
PRODUCT= PC_TYPE_1 , MONTHLY_COST = 100, RENT_PERIOD = 5 months PRODUCT= PC_TYPE_1 , MONTHLY_COST = 80, RENT_PERIOD = 6 months PRODUCT= PC_TYPE_1 , MONTHLY_COST = 75, RENT_PERIOD = 7 months
PRODUCT= PC_TYPE_2 , MONTHLY_COST = 110, RENT_PERIOD = 5 months PRODUCT= PC_TYPE_2 , MONTHLY_COST = 120, RENT_PERIOD = 6 months PRODUCT= PC_TYPE_2 , MONTHLY_COST = 130, RENT_PERIOD = 7 months
than, I have various constraint about the QUANTITY of each Product (I omit them, as they are not important here).
than I've the Objective function that is:
MIN = SUM(PRODUCT: QUANTITY * MONTHLY_COST * RENT_PERIOD) / SUM(PRODUCT: QUANTITY * RENT_PERIOD)
In other words, the solver should always try to give priority to the rows having the lowest MONTHLY_COST.
Hoping I've been clear, and that you have the patience to help me again.
thanks a lot. JPC
|
|
|