Scilab---FOSSEE-Optimisation-Toolbox/C2/Linear-Programming-using-linprog-function/English
Title of script: Linear Programming using fot_linprog function
Author: Rupak Rokade, Siddharth Agarwal, Georgey John and Mankrit Singh
Keywords:Scilab console, FOSSEE Optimization Toolbox, Linear Programming, OR, Operations Research, fot_linprog, constraints, input, output, video tutorial.
Visual Cue | Narration |
---|---|
Show Slide Title Slide |
Hello and welcome to the spoken tutorial on “Linear Programming using fot underscore linprog function”. |
Show Slide Learning Objectives |
In this tutorial, we will learn how to:
|
Show Slide System requirement |
To record this tutorial, I am using
|
Show Slide Pre-requisites |
To follow this tutorial, you should
|
Show Slide Code Files |
|
Show Slide What is Linear Programming ? |
A function is linear, if it has a degree of one or zero. A linear program is a mathematical optimization model with:
|
Show Slide Mathematical Formulation |
A general form of the Linear Program is as shown. |
Show Slide Example |
We will now solve this example to illustrate the use of fot underscore linprog. In this example, we will learn how to:
Note that the objective function and constraints are linear. |
Show Slide Example |
I have downloaded the opt_linprog.sce file to my Downloads folder. |
Cursor on the Scilab console. | I have opened the Scilab console. |
Type editor >> press Enter. |
In the Scilab console, type editor and press Enter. Editor window opens. |
Click on Open button >> locate the file opt_linprog.sce. Click on the Ok button |
Click on the Open button on the tool-bar and locate the file opt_linprog.sce. Then click the Ok button. opt_linprog.sce file opens in the editor. |
Show opt_linprog.sce in scilab editor. | Now we will see the input arguments for fot underscore linprog. |
Highlight the line with ‘c’ | c is a vector of coefficients in the objective function |
Highlight the line with ‘A’ |
A is a matrix of coefficients of inequality constraints |
Highlight the line with ‘b’ |
b is a vector of the right-hand side of inequality constraints |
Highlight the line with ‘Aeq’ | ‘Aeq’ is a matrix of coefficients of equality constraints |
Highlight the line with ‘beq’ | ‘beq’ is a vector of the right-hand side of equality constraints |
Highlight the line with ‘lb’ | ‘lb’ is a vector of lower bounds on x |
Highlight the line with ‘ub’ | ‘ub’ is a vector of upper bounds on x. |
Now we will summarize the output arguments Output arguments are xopt, fopt, exitflag, output, lambda | |
Highlight ‘xopt’ | xopt is the optimal value of x. |
Highlight ‘fopt’ | fopt is the optimal objective function value. |
Highlight ‘exitflag’ | exitflag denotes the status of execution |
Highlight ‘output’ | Output is a structure containing detailed information about the optimization. |
Highlight ‘lambda’ | Lambda is a structure containing Lagrange multipliers at the optimal solution. |
Highlight the line calling ‘fot_linprog’ | We will use the fot underscore linprog function to solve the example |
Press CTRL + S Click on the Execute button on scilab. Select file with echo from the drop-down. Video-editor: Pls put a textbox on screen."Clear console" window opens to ask are you sure you want to clear the console? - click on the yes button |
Save the file by pressing Control and ‘S’ keys simultaneously. To run the file, click on the Execute menu. Then click on file with echo from the drop down. |
Change the window to Scilab console Highlight Optimal solution Highlight ‘xopt values’ Highlight ‘fopt value’ Highlight ‘exitflag value’ Highlight ‘output values’ Highlight ‘lambda values’ |
Switch to the Scilab console to see the output. Optimal solutions for the following are displayed on the Scilab console. xopt values fopt value exitflag output and lambda. |
Show Slide Alternate Input Arguments |
Now we see an alternate way of passing input arguments to fot underscore linprog. |
Show Slide Alternate Input Arguments Highlight ‘file’ Highlight ‘MPS’ |
file is a string stating the path of the mps file. MPS (Mathematical Programming System) is a file format. |
Show Slide Alternate Input Arguments Highlight ‘param’ |
It is used to present and archive:
param is a list containing parameters to be set. |
Show Slide Unbounded Problems I |
The problem we just saw was directly solvable using fot underscore linprog.
|
Show Slide Unbounded Problems II |
|
Show Slide Infeasible Problems |
We will see an example of these constraints on Scilab. |
Switch to the scilab editor. Replace the value. Click on the Execute menu Select File with Echo option |
We will now change the previous problem to make it infeasible.
This will execute the scilab code. |
Switch to the Scilab Console Highlight the message Primal Infeasible |
Switch to the Scilab console to see the output. The console shows that the problem is Primal Infeasible. |
Show Slide Summary |
This brings us to the end of this tutorial. Let us summarise. In this tutorial, we have learnt how to:
|
Show Slide Assignment Highlight the constraint |
As an assignment:
|
Show Slide About Spoken Tutorial Project |
The video at the following link summarises the Spoken Tutorial project. Please download and watch it. |
Show Slide Spoken Tutorial Workshops |
The Spoken Tutorial Project Team conducts workshops and gives certificates. For more details, please write to us |
Show Slide Answers for THIS Spoken Tutorial |
Please post your timed queries in this forum. |
Show Slide: FOSSEE Forum | Please post your general and technical queries on Scilab in this forum. |
Show Slide Textbook Companion project |
The FOSSEE team coordinates the Textbook Companion project. We give Certificates and Honorarium to the contributors. For more details, please visit this site.. |
Show Slide Lab Migration |
The FOSSEE team coordinates the Lab Migration project. For more details, please visit this site. |
Show Slide Acknowledgment |
Spoken Tutorial and FOSSEE projects are funded by MoE, the Government of India. |
Show Slide Thank you |
This is Mankrit Singh, a FOSSEE intern 2021, IIT Bombay signing off Thanks for joining. |