From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Dear Friends, Welcome to the spoken tutorial on Optimization of Linear Functions with Linear Constraints Using Scilab.
00:10 In this tutorial, We will learn:
00:12 what is meant by Optimization?
00:15 and how to use Scilab function karmarkar, for optimization.
00:20 Optimization means
00:22 minimize or maximize a given objective function
00:26 which is also called as Cost function sometimes,
00:30 by varying the decision variables.
00:33 The decision variables are varied subject to the predefined constraints.
00:38 These constraints are also in the form of some functions of the variables.
00:44 Optimization is extensively used in majority of the engineering as well as non-engineering fields like:
00:52 Economics
00:54 Control Theory and
00:56 Operations & Research.
00:58 The Scilab function karmarkar is used for
01:01 optimizing the linear objective function,
01:05 subject to linear constraints
01:07 on the decision variables.
01:10 We will solve the following example using karmarkar function:
01:14 Minimize minus three 'x' one minus 'x' two minus three 'x' three
01:19 for: two 'x' one plus 'x' two plus 'x' three less than or equal to two.
01:26 'x' one plus two 'x' two plus three 'x' three less than or equal to five.
01:32 two 'x' one plus two 'x' two plus 'x' three less than or equal to six.
01:36 where 'x' one 'x' two 'x' three are all greater than or equal to zero
01:42 Note that all the functions, objective functions as well as constraints, are linear.
01:49 Before we solve the given problem, go to scilab console and type:
01:54 help karmarkar
01:57 and press Enter.
01:59 You can see the calling sequence of the argument.
02:03 The argument explanation, description and some examples in the Help Browser.
02:12 Close the Help Browser .
02:14 We will summarize the input and output arguments here.
02:19 Output arguments are 'x' opt, 'f' opt, exitflag, iter, 'y' opt .
02:25 'x' opt: is the optimum solution .
02:28 'f' opt: is the objective function value at optimum solution
02:33 'exitflag' : is the status of execution, it helps in identifying if the algorithm is converging or not.
02:41 'iter' : is the number of iterations required to reach 'x' opt.
02:46 'y' opt : is the structure containing the dual solution.
02:49 This gives the Lagrange multipliers.
02:53 Input arguments are 'Aeq' 'beq' 'c' 'x zero' 'rtolf 'gam' 'maxiter' 'outfun' 'A' 'b' 'lb' and 'ub'
03:09 'Aeq'  : is the Matrix in the linear equality constraints.
03:12 'beq'  :is the right hand side of the linear equality constraint.
03:17 'c'  : is the Linear objective function coefficients of 'x'.
03:21 'x' zero : is the Initial guess .
03:25 rtolf : is Relative tolerance on 'f' of 'x' is equals to 'c' transpose multiplied by 'x'.
03:34 'gam'  : is the Scaling factor.
03:36 'maxiter'  : is the maximum number of iterations after which the output is returned.
03:43 'outfun'  : is the additional user-defined output function.
03:47 'A' : is the Matrix of linear inequality constraints
03:51 'b' : is the right hand side of the linear inequality constraints.
03:55 'lb' : is the lowerbound of 'x'.
03:58 'ub' are the upper bound of 'x'.
04:02 Now, we can solve the given example in Scilab using karmarkar function.
04:07 Go to the scilab console and type:
04:11 'A' is equals to open square bracket, two <space> one <space> one <semicolon> one <space> two <space> three <semicolon> two <space> two <space> one, close the square bracket
04:26 and press Enter.
04:28 similarly type: small 'b' equals to open square bracket, two <semicolon> five <semicolon> six, close the square bracket.
04:38 and press Enter.
04:41 Type: 'c' equals to open square bracket, minus three <semicolon> minus one <semicolon> minus three, close the square bracket.
04:53 and press Enter.
04:55 Type: 'lb' equals to open square bracket, zero <semicolon> zero <semicolon> zero, close the square bracket.
05:05 and press Enter.
05:07 Now clear the console using clc command.
05:12 Type: open square bracket, 'x' opt <comma> 'f' opt <comma> 'exitflag' <comma> iter, close the square bracket equals to karmarkar open parenthesis, open square bracket, close the square bracket <comma> open square bracket, close the square bracket <comma> 'c' <comma> open square bracket, close the square bracket <comma> open square bracket, close the square bracket <comma> open square bracket, close the square bracket <comma> open square bracket, close the square bracket <comma> open square bracket, close the square bracket <comma> capital 'A' <comma> 'small b' <comma> 'lb', close the round bracket.
06:09 and Press Enter.
06:11 Press Enter to continue the display.
06:14 This will give the output as shown on the screen
06:18 where xopt is the optimum solution to the problem,
06:23 fopt is the value of the objective function, calculated at optimum solution x is equal to xopt
06:32 and number of iteration required to reach the optimum solution xopt is 70.
06:39 Please note that: it is mandatory to specify the input arguments in the same order
06:46 in which they have been listed above, while calling the function.
06:51 In this tutorial, we learned:
06:53 What is optimization?
06:55 Use of Scilab function karmarkar in optimization to solve linear problems.
07:01 To contact the scilab team, please write to
07:08 Watch the video available at the following link.
07:10 It summarizes the Spoken Tutorial project.
07:14 If you do not have good bandwidth, you can download and watch it.
07:18 The spoken tutorial project Team:
07:20 Conducts workshops using spoken tutorials.
07:23 Gives certificates to those who pass an online test.
07:27 For more details, please write to
07:34 Spoken Tutorial Project is a part of the Talk to a Teacher project.
07:37 It is supported by the National Mission on Eduction through ICT, MHRD, Government of India.
07:44 More information on this mission is available at
07:53 This is Anuradha Amrutkar from IIT Bombay, signing off.
07:57 Thank you for joining. Good Bye.

Contributors and Content Editors

Gaurav, PoojaMoolya, Sandhya.np14