Mosel Programming.

Project Description

Mosel Programming Assignment help/ Xpress Programming help/ Linear programming expert help

mosel programming

 

Sample Question

1)  A textile company makes two types of cloth: light duty and heavy duty. The unit profits are €p1 and €p2 in respectively. Each metre of light cloth requires five metres of raw cotton and five hours of processing time. Each metre of heavy cloth requires three hours of processing time and eleven metres of raw cotton. There are 550 metres of raw cotton available and 300 hours of processing time. The sales department estimate demand for heavy duty cloth is at most 40 metres. a)  Formulate an LP model to determine the quantities of cloth that maximise profit and satisfy the constraints. b)  Explain the model and its components. State clearly any assumptions. c)  Explain the graphical solution method. You may use pseudocode and should give some insight to how and why the method works d)  Apply the graphical solution method to determine the optimal solution to your model. You can complete the graphical solution using pen and paper. Scan your work and include it in your report. Alternatively, you can use your favourite drawing tool and include the image(s) in your report, noting the software package used. e)  Interpret your solution fully and make a recommendation to the company. f)  Implement a fully commented Mosel model to confirm the optimal solution obtained by the graphical approach. g)  Write a short note comparing the approaches in parts d) and f) above. 2)  A craft brewer makes three types of cider:golden glow,autumn fresh and sparkling light. Profits per cask are €7,500, €8,200 and €9,500 respectively. The brewery orchard has yielded 17 tonnes of apples with which the cider is made. Each cask of Golden glow uses 0.2 tonnes of apples, while autumn fresh uses 0.24 and sparkling light uses 0.18. The brewery has 2,500 hours of production capacity and can store at most 80 casks. Each cask of golden glow requires 11 hours to produce, while autumn fresh requires 8 hours and sparkling light requires 16 hours. Demand for sparkling light will be no more than half of the sales of the other two types of cider combined. How many casks of each type should be made in order to maximise revenue? a) Formulate and solve an LP for the brewer problem in Mosel. Your Mosel model should be fully commented and explicitly demonstrate the use of: i)  a constant; ii)  a real variable; iii)  a string variable; iv)  a decision variable; v)  thesumlanguageconstruct; vi)  the forall language construct; You may hard code the data in your Mosel implementation. You must include an interpretation of the optimal LP solution in your report. You do not need to give a full description of the Mosel model in your report. The comments in your Mosel model serve to explain your implementation. TASK REQUIREMENT : you must answer all the questions above and Implement and upload the Mosel models as indicated.

{The brand new|The newest|The modern} release 2005A of Xpress-MP adds a number of enhancements to an already impressive suite of {marketing|search engine optimization|seo} and modeling software. {Seeing that|As} its inception, Xpress-MP has distinguished itself for {satisfying|rewarding|gratifying} the efficient implementation of algorithms to solve {geradlinig|thready|step-wise} and mixed integer {development|encoding|coding} (MIP) problems. Every {period|time|age} has continued to {increase|broaden|grow} the state-of-the-art for {numerical|statistical|math} programming commercial solvers. The solvers implemented in the Xpress-Optimizer — a central component of the Xpress-MP suite — benefit from many search-accelerating techniques like presolve algorithms, use of global variables, advanced {trimming|slicing|reducing} planes strategies, heuristics, and customizable node and {adjustable|varying|changing} selection strategies. {The most recent|The newest|The most up-to-date} release has speed improvements to the algorithms, {and in addition it|plus it|and it in addition} has added parallel MIP for multi-processing machines. Experience with time-critical applications, with considerable linear programs and with tough integer problems has earned Xpress-Optimizer a reputation among practitioners and academicians {to be|if you are|internet marketing} second to {none of them|nothing|zero} in {conditions} of {velocity|rate|acceleration} and reliability.
{Besides the|As well as the|Beyond the} Xpress-Optimizer, the Xpress-MP suite {consists of|includes|is made up of} an {impressive|progressive|ground breaking} modeling tool in the form of the Xpress-Mosel component. Mosel is conceived as a programming environment for both modeling and solving {marketing|search engine optimization|seo} problems. {As a result|Consequently}, the Mosel language {reaches|are at|is in} the same time an algebraic building language and also a true high-level programming {vocabulary|terminology|dialect}. This is {in comparison|as opposed} with other algebraic modeling {dialects|different languages|’languages’} like AMPL [Fourer et. al. (1993)] and OPL [Van Hentenryck (1998)], which count on scripting to perform {procedures|functions|businesses} around the model specification.

In Mosel, it is normal to {change|switch|varied} modeling and solving {claims|assertions|transactions} to program specialized solution algorithms or any {software|program|app} that is centered within an optimization model. And because the architecture of Xpress-Mosel was created to be open and {do it yourself|flip|flip-up}, the syntax of the Mosel language can be naturally extended. Mosel has a native interface that is identified as  public, allowing anyone to enrich the {features|efficiency|operation} of the language by creating new modules. {Intended for|To get|Pertaining to} instance, calls to exterior functions and procedures of existing specialized solvers and other programs can be {changed into|converted into} simple Mosel {claims|assertions|transactions}. This characteristic makes Xpress-Mosel {a fantastic|a thrilling|an exilerating} and {practically|almost|nearly} {unlimited|endless|inexhaustible} environment for optimization-centered applications.

Mosel models are typically developed within the visual user interface Xpress-IVE. This kind of visual environment has many facilities for model debugging, solution analysis and solution display that bolster the productivity of the development effort. Each Mosel model has been built and tested in Xpress-IVE, {it might be|it could be|it can be} accessed and executed from other applications through Mosel libraries. The latest release of Xpress-MP adds a. NET library to {the present|the current} C/C++, Java, and VB libraries. The Mosel your local library provide a simple and efficient device for an organization to integrate {advanced|superior|complex} optimization models with the rest of its information systems.

The Mosel Terminology
Coding in Mosel is easy enough if you incorporate some experience with other high-level programming {dialects|different languages|’languages’}. The statements that {designate|identify|stipulate} a model’s variables and constraints closely resemble the usual notation to {explain|identify|illustrate} optimization models. The {associated|enclosed|associating} lines (see box) provide an sort of Mosel code.

 

1. A.

x1*p1 + x2*p2 –> max (where is p1 and p2 is unit profits)

x1*5 + x2*11 <= 550

x1*5 + x2*3 <= 300

x2 <= 40

x1 >= 0, x2 >= 0

B.

x1 – meters of light duty clothes

x2 – meters of heavy duty clothes

Each metre of light cloth requires five metres of raw cotton and each metre of heavy cloth requires eleven metres of raw cotton. Due to we have only 550 metres of raw cotton comes this equation: x1*5 + x2*11 <= 550

Same with processing time one metre of light cloth requires five hours, and each metre of heavy cloth requires 3 hours. We have only 300 hours available, so we have one more equation:

x1*5 + x2*3 <= 300

Also we have demand for heavy duty cloth is at most 40 metres from which x2 <= 40

And also we can’t have negative meters of clothes, so x1 >= 0, x2 >= 0

C.

A linear programming problem or LP problem in two unknowns x1 and x2 is one in which we are to find the maximum or minimum value of a linear expression

x1*p1 + x2*p2 (where p1 and p2 is constants)

called the objective function

The solution set of the collection of constraints is called the feasible region of the LP problem. The largest or smallest value of the objective function is called the optimal value, and a pair of values of x1 and x2 that gives the optimal value constitutes an optimal solution.

D.

For equation x1*5 + x2*11 <= 550 let’s draw line 5*x + 11*y = 550 (x1 = x, x2 = y)

Everything upon it will be red, and everything down it white.

For equation x1*5 + x2*3 <= 300 The line will be 5*x + 3*y = 300, everything upon it will be red, and everything down it white.

And last one x2 <= 40, y = 40 with same principe as shown upon.

We will get such picture:

The feasible region is shown in white.

To find maxima we should draw family of lines p1*x = p2*y, p1 and p2 is constant, let’s suppose p1 = p2 = 1, to make our life easier.

Only lines that has points from white area is needed. After that we much choose line that have max distance to (0,0).

Not hard to understand that it’s this line

The answer is this x and y matched in circles bellow

X = 41.25, Y = 31.25

E. So company should make 41.25 metres of light duty clothes and 31.25 meters of heavy duty clothes.

F.

model “Clothing”

uses “mmxprs”; !gain access to the Xpress-Optimizer solver

!sample declarations section

declarations

x1,x2: mpvar ! Decision variables: produced quantities

end-declarations

Profit:= x1 + x2 !objective function

rawCotton:= 5*x1 + 11*x2 <= 550 ! cotton in metres

processingTime:= 5*x1 +3*x2 <= 300 !hrs of processing time

demand:= x2 <= 40 !demand

maximize(Profit) !Solve the problem

writeln(“Make “, getsol(x1), ” light Duty Clothes”)

writeln(“Make “,getsol(x2), ” heavy Duty Clothes”)

writeln(“Best profit is “, getobjval)

end-model

G. Graphically solution is good to understand LP problem but does not let you solve it 100% correct. Firstly it works only when your LP problem has 2 unknown secondly, it’s very hard to get accurately answer when. Mosel mode is hard to build but when you don’t know how to do it, but after you find out LP problems is very easy to solve.

2. A.

x1 – number of cask golden glow

x2 – number of cask autumn fresh

x3 – number of cask sparkling light

7500 * x1 + 8200 * x2 + 9500 * x3 –> max

20*x1 + 24*x2 + 18*x3 <= 1700

x1 + x2 + x3 <= 80

11*x1 + 8*x2 + 16*x3

Mosel mode :

model “cider”

uses “mmxprs”; !gain access to the Xpress-Optimizer solver

!sample declarations section

declarations

x1,x2,x3: mpvar ! Decision variables: produced quantities

end-declarations

Profit:= 7500 * x1 + 8200 * x2 + 9500 * x3 !objective function

tonesApple:= 0.2*x1 + 0.24*x2 + 0.18*x3 <= 17 ! tones of apples

processingTime:= 11*x1 + 8*x2 + 16*x3 <= 2500 ! hrs of processing time

casks:= x1 + x2 + x3 <= 80 ! can store at most 80 casks

1. A.

x1*p1 + x2*p2 –> max (where is p1 and p2 is unit profits)

x1*5 + x2*11 <= 550

x1*5 + x2*3 <= 300

x2 <= 40

x1 >= 0, x2 >= 0

B.

x1 – meters of light duty clothes

x2 – meters of heavy duty clothes

Each metre of light cloth requires five metres of raw cotton and each metre of heavy cloth requires eleven metres of raw cotton. Due to we have only 550 metres of raw cotton comes this equation: x1*5 + x2*11 <= 550

Same with processing time one metre of light cloth requires five hours, and each metre of heavy cloth requires 3 hours. We have only 300 hours available, so we have one more equation:

x1*5 + x2*3 <= 300

Also we have demand for heavy duty cloth is at most 40 metres from which x2 <= 40

And also we can’t have negative meters of clothes, so x1 >= 0, x2 >= 0

C.

A linear programming problem or LP problem in two unknowns x1 and x2 is one in which we are to find the maximum or minimum value of a linear expression

x1*p1 + x2*p2 (where p1 and p2 is constants)

called the objective function

The solution set of the collection of constraints is called the feasible region of the LP problem. The largest or smallest value of the objective function is called the optimal value, and a pair of values of x1 and x2 that gives the optimal value constitutes an optimal solution.

D.

For equation x1*5 + x2*11 <= 550 let’s draw line 5*x + 11*y = 550 (x1 = x, x2 = y)

Everything upon it will be red, and everything down it white.

For equation x1*5 + x2*3 <= 300 The line will be 5*x + 3*y = 300, everything upon it will be red, and everything down it white.

And last one x2 <= 40, y = 40 with same principe as shown upon.

We will get such picture:

The feasible region is shown in white.

To find maxima we should draw family of lines p1*x = p2*y, p1 and p2 is constant, let’s suppose p1 = p2 = 1, to make our life easier.

Only lines that has points from white area is needed. After that we much choose line that have max distance to (0,0).

Not hard to understand that it’s this line

The answer is this x and y matched in circles bellow

X = 41.25, Y = 31.25

E. So company should make 41.25 metres of light duty clothes and 31.25 meters of heavy duty clothes.

F.

model “Clothing”

uses “mmxprs”; !gain access to the Xpress-Optimizer solver

!sample declarations section

declarations

x1,x2: mpvar ! Decision variables: produced quantities

end-declarations

Profit:= x1 + x2 !objective function

rawCotton:= 5*x1 + 11*x2 <= 550 ! cotton in metres

processingTime:= 5*x1 +3*x2 <= 300 !hrs of processing time

demand:= x2 <= 40 !demand

maximize(Profit) !Solve the problem

writeln(“Make “, getsol(x1), ” light Duty Clothes”)

writeln(“Make “,getsol(x2), ” heavy Duty Clothes”)

writeln(“Best profit is “, getobjval)

end-model

G. Graphically solution is good to understand LP problem but does not let you solve it 100% correct. Firstly it works only when your LP problem has 2 unknown secondly, it’s very hard to get accurately answer when. Mosel mode is hard to build but when you don’t know how to do it, but after you find out LP problems is very easy to solve.

2. A.

x1 – number of cask golden glow

x2 – number of cask autumn fresh

x3 – number of cask sparkling light

7500 * x1 + 8200 * x2 + 9500 * x3 –> max

20*x1 + 24*x2 + 18*x3 <= 1700

x1 + x2 + x3 <= 80

11*x1 + 8*x2 + 16*x3

Mosel mode :

model “cider”

uses “mmxprs”; !gain access to the Xpress-Optimizer solver

!sample declarations section

declarations

x1,x2,x3: mpvar ! Decision variables: produced quantities

end-declarations

Profit:= 7500 * x1 + 8200 * x2 + 9500 * x3 !objective function

tonesApple:= 0.2*x1 + 0.24*x2 + 0.18*x3 <= 17 ! tones of apples

processingTime:= 11*x1 + 8*x2 + 16*x3 <= 2500 ! hrs of processing time

casks:= x1 + x2 + x3 <= 80 ! can store at most 80 casks

Project Details

  • Date February 12, 2017
  • Tags Mosel Programming, Programming

Leave a reply

Back to Top