Applications built with ILOG ODM allow users to adjust assumptions,operating constraints,and goals for planning and scheduling resources,and see the results in familiar business terminology,providing extensive what-if analysis and scenario comparison features"out of the box." In essence,you supply the mathematical model in OPL,and ODM supplies the GUI and interactivity with your model that makes it easy to use for operations managers and planners 参见 Overview of ILOG Optimization Decision Manager (overviewodm.pdf) -6-
- 6 - Applications built with ILOG ODM allow users to adjust assumptions, operating constraints, and goals for planning and scheduling resources, and see the results in familiar business terminology, providing extensive what-if analysis and scenario comparison features “out of the box.” In essence, you supply the mathematical model in OPL, and ODM supplies the GUI and interactivity with your model that makes it easy to use for operations managers and planners. 参见 Overview of ILOG Optimization Decision Manager(overviewodm.pdf)
四、上机实验一 使用OPL IDE求解生产计划问题 1)实验目的 1)熟悉生产问题 2) 了解OPL(ILOG Optimization Programming Language),及其特点 3)了解OPL IDE求解规划问题的整个过程,了解OPL IDE的特点 4)了解求解规划问题的计算需求 2)生产计划问题 The production-planning problem is as follows. To meet the demands of its customers,a company manufactures its products in its own factories(inside production)or buys them from other companies(outside production).Inside production is subject to some resource constraints:each product consumes a certain amount of each resource.In contrast, outside production is theoretically unlimited.Each product can be produced either inside the company or outside.at a higher cost. The problem is to determine how much of each product should be produced inside and outside the company while minimizing the overall production cost,meeting the demand,and satisfying the resource constraints. The variables for this problem are the inside and outside production for each product. An instance of the problem must specify the products,the resources,the capacity of the resources,the demand for each product,the consumption of resources by the different products,and the inside and outside costs of each product. 3)生产问题的OPL模型 1)The Model for the Production-Planning Problem The model for the production-planning problem is depicted in Code Sample 4.I below and the instance data in Code Sample 4.2. -7-
- 7 - 四、上机实验一 使用 OPL IDE 求解生产计划问题 1) 实验目的 1) 熟悉生产问题 2) 了解OPL(ILOG Optimization Programming Language),及其特点 3) 了解 OPL IDE 求解规划问题的整个过程,了解 OPL IDE 的特点 4) 了解求解规划问题的计算需求 2) 生产计划问题 The production-planning problem is as follows. To meet the demands of its customers, a company manufactures its products in its own factories (inside production) or buys them from other companies (outside production). Inside production is subject to some resource constraints: each product consumes a certain amount of each resource. In contrast, outside production is theoretically unlimited. Each product can be produced either inside the company or outside, at a higher cost. The problem is to determine how much of each product should be produced inside and outside the company while minimizing the overall production cost, meeting the demand, and satisfying the resource constraints. The variables for this problem are the inside and outside production for each product. An instance of the problem must specify the products, the resources, the capacity of the resources, the demand for each product, the consumption of resources by the different products, and the inside and outside costs of each product. 3) 生产问题的 OPL 模型 1) The Model for the Production-Planning Problem The model for the production-planning problem is depicted in Code Sample 4. 1 below and the instance data in Code Sample 4. 2
(string)Products =... (string)Resources =...i tuple productData float demand; float insideCost; float outsideCost; float consumption[Resources]; productData Product[Products]=... float Capacity[Resources】=·..; dvar float+Inside[Products]; dvar float+Outside[Products]; execute CPX PARAM cplex.preind =0; cplex.simdisplay 2; minimize sum(p in Products (Product[p】.insideCost Inside[p】+ Product[p】.outsideCost*Outside[p】): subject to forall(r in Resources ctInside: sum(p in Products Product[p】.consumption[r】★Inside【p】<=Capacity[r】; forall(p in Products ctDemand: Inside[p]outside[p]>=Product[p].demand; Code Sample 4.I The Production-Planning Problem (product.mod) Products ="kluski","capellini","fettucine"} Resources ="flour","eggs") Product =# k1uski:<100,0.6,0.8,【0.5,0.2】>, cape11ini:<200,0.8,0.9,【0.4,0.4]>, -8-
- 8 - {string} Products = ...; {string} Resources = ...; tuple productData { float demand; float insideCost; float outsideCost; float consumption[Resources]; } productData Product[Products] = ...; float Capacity[Resources] = ...; dvar float+ Inside[Products]; dvar float+ Outside[Products]; execute CPX_PARAM { cplex.preind = 0; cplex.simdisplay = 2; } minimize sum( p in Products ) (Product[p].insideCost * Inside[p] + Product[p].outsideCost * Outside[p] ); subject to { forall( r in Resources ) ctInside: sum( p in Products ) Product[p].consumption[r] * Inside[p] <= Capacity[r]; forall( p in Products ) ctDemand: Inside[p] + Outside[p] >= Product[p].demand; } Code Sample 4. 1 The Production-Planning Problem (product.mod) Products = { “kluski”, “capellini”, “fettucine” }; Resources = { “flour”, “eggs” }; Product = #[ kluski : < 100, 0.6, 0.8, [ 0.5, 0.2 ] >, capellini : < 200, 0.8, 0.9, [ 0.4, 0.4 ] >
fettucine:<300,0.3,0.4,【0.3,0.6】> 】#: Capacity=【20,40】; Code Sample 4.2 Instance Data for the Production-Planning Problem (product.dat) The instruction tuple productData float demand; float insideCost; float outsideCost; float consumption【Resources】: declares a tuple type with four fields.The first three fields,of type float,are used to represent the demand and costs of a product;the last field is an array representing the resource consumptions of the product.These fields are intended to hold all the data related to a given product. The instruction ProductData product[Products]=... declares an array of these tuples,one for each product.Data structures in OPL can be constructed using tuples that cluster together closely related data. The...(ellipsis)syntax means that the data is initialized externally,that is,from a data file (product.dat). The initialization Product =# k1uski:<100,0.6,0.8,【0.5,0.2】>, cape11ini:<200,0.8,0.9,【0.4,0.4】>, fettucine:<300,0.3,0.4,【0.3,0.6】> ]#: from Code Sample 4.2 specifies these various data items:tuples are initialized by giving values for each of their fields.It is of course possible to use a named initialization for the tuple,as shown in Code Sample 4.2,in which case the initialization is enclosed with #and >#Tuple fields can be obtained by suffixing the tuple with a dot and the field name.For instance,in the objective function minimize -9
- 9 - fettucine : < 300, 0.3, 0.4, [ 0.3, 0.6 ] > ]#; Capacity = [ 20, 40 ]; Code Sample 4.2 Instance Data for the Production-Planning Problem (product.dat) The instruction tuple productData { float demand; float insideCost; float outsideCost; float consumption[Resources]; } declares a tuple type with four fields. The first three fields, of type float, are used to represent the demand and costs of a product; the last field is an array representing the resource consumptions of the product. These fields are intended to hold all the data related to a given product. The instruction ProductData product[Products] = ...; declares an array of these tuples, one for each product. Data structures in OPL can be constructed using tuples that cluster together closely related data. The ... (ellipsis) syntax means that the data is initialized externally, that is, from a data file (product.dat). The initialization Product = #[ kluski : < 100, 0.6, 0.8, [ 0.5, 0.2 ] >, capellini : < 200, 0.8, 0.9, [ 0.4, 0.4 ] >, fettucine : < 300, 0.3, 0.4, [ 0.3, 0.6 ] > ]#; from Code Sample 4.2 specifies these various data items: tuples are initialized by giving values for each of their fields. It is of course possible to use a named initialization for the tuple, as shown in Code Sample 4.2, in which case the initialization is enclosed with #< and >#. Tuple fields can be obtained by suffixing the tuple with a dot and the field name. For instance, in the objective function minimize