Difference between revisions of "Scilab---FOSSEE-Optimisation-Toolbox/C2/Unconstrained-Optimization-using-FOT/English"
Nancyvarkey (Talk | contribs) |
Nancyvarkey (Talk | contribs) |
||
Line 22: | Line 22: | ||
*Use '''fot_fminunc''' and '''fot_intfminunc functions''' in '''Scilab''' | *Use '''fot_fminunc''' and '''fot_intfminunc functions''' in '''Scilab''' | ||
− | *Solve ''' | + | *Solve unconstrained '''optimisation''' problems using '''fot_fminunc and fot_intfminunc functions''' |
|- | |- | ||
| | | | ||
Line 35: | Line 35: | ||
*'''FOSSEE Optimization Toolbox''' version '''0.4.1''' | *'''FOSSEE Optimization Toolbox''' version '''0.4.1''' | ||
− | The process demonstrated in this tutorial is identical in '''Linux''' OS also | + | The process demonstrated in this tutorial is identical in '''Linux''' OS also. |
− | + | ||
− | + | Annotations will be added to the tutorial if there are any differences. | |
− | + | ||
|- | |- | ||
| | | | ||
Line 49: | Line 48: | ||
To follow this tutorial, you should | To follow this tutorial, you should | ||
− | *Install '''FOSSEE Optimization Toolbox''' version 0.4.1 or above*Have basic understanding of Scilab and optimization theory | + | *Install '''FOSSEE Optimization Toolbox''' version 0.4.1 or above |
+ | *Have basic understanding of '''Scilab''' and '''optimization theory''' | ||
If not, for relevant tutorials please visit this site. | If not, for relevant tutorials please visit this site. | ||
Line 66: | Line 66: | ||
'''What is the Unconstrained Optimisation problem?''' | '''What is the Unconstrained Optimisation problem?''' | ||
− | |A '''function''' is nonlinear if it has a degree of two or more. | + | |A '''function''' is '''nonlinear''' if it has a degree of two or more. |
− | ''' | + | An unconstrained '''optimisation''' problem is a mathematical '''optimization model''' with: |
− | *'''Nonlinear''' | + | *'''Nonlinear objective function''' |
− | * | + | *No constraints |
|- | |- | ||
| | | | ||
Line 102: | Line 102: | ||
| Type '''editor''' >> press '''Enter'''. | | Type '''editor''' >> press '''Enter'''. | ||
| | | | ||
− | In the '''Scilab console''' type '''editor''' and press '''Enter'''. | + | In the '''Scilab console,''' type '''editor''' and press '''Enter'''. |
'''Editor''' window opens. | '''Editor''' window opens. | ||
|- | |- | ||
− | | | + | |Click on '''Open''' button. |
− | Click on Open button. | + | |Click on '''Open''' button on the '''toolbar'''. |
− | + | |- | |
− | Go to the Downloads folder. | + | |Go to the '''Downloads''' folder. |
Locate the file '''opt_fminunc.sce'''. | Locate the file '''opt_fminunc.sce'''. | ||
Click the '''Open''' button. | Click the '''Open''' button. | ||
− | + | |Go to the '''Downloads''' folder. | |
− | + | ||
− | | | + | |
− | + | ||
− | + | ||
− | Go to the '''Downloads''' folder. | + | |
Locate the file '''opt_fminunc.sce'''. | Locate the file '''opt_fminunc.sce'''. | ||
Then click the '''Open''' button. | Then click the '''Open''' button. | ||
− | + | |- | |
− | '''opt_fminunc.sce''' file opens in the '''editor'''. | + | |Point to the file. |
+ | |'''opt_fminunc.sce''' file opens in the '''editor'''. | ||
|- | |- | ||
| Show '''opt_fminunc.sce''' in scilab editor. | | Show '''opt_fminunc.sce''' in scilab editor. | ||
Line 177: | Line 173: | ||
To '''run''' the file, click on the '''Execute menu'''. | To '''run''' the file, click on the '''Execute menu'''. | ||
− | Click on '''File with Echo''' from the drop-down | + | Click on '''File with Echo''' from the drop-down. |
|- | |- | ||
| Change the window to '''Scilab console.''' | | Change the window to '''Scilab console.''' | ||
Line 254: | Line 250: | ||
|- | |- | ||
| Highlight '''‘Gradient’''' | | Highlight '''‘Gradient’''' | ||
− | |'''Gradient''' is a '''vector''' containing the '''objective's | + | |'''Gradient''' is a '''vector''' containing the '''objective's gradient''' of the solution |
|- | |- | ||
| Highlight '''‘Hessian’''' | | Highlight '''‘Hessian’''' | ||
Line 299: | Line 295: | ||
As an assignment, please do the following: | As an assignment, please do the following: | ||
− | *What will be the solution if we include the following constraint in the previous example | + | *What will be the solution if we include the following constraint in the previous example? |
|- | |- | ||
| | | |
Revision as of 08:45, 16 November 2021
Title of the script: Unconstrained Optimisation using FOT
Author: Siddharth Agarwal, Anandajith TS
Keywords: FOSSEE Optimization Toolbox, Integer Unconstrained Optimisation, Unconstrained Optimisation, fminunc, intfminunc.
Visual Cue | Narration |
---|---|
Show Slide 1 Title Slide |
Welcome to the spoken tutorial on Unconstrained Optimisation using FOT. |
Show Slide 2 Learning Objectives |
In this tutorial, we will learn how to:
|
Show Slide 3 System Requirements |
To record this tutorial, I am using
The process demonstrated in this tutorial is identical in Linux OS also. Annotations will be added to the tutorial if there are any differences. |
Show Slide 4 Pre-requisites |
To follow this tutorial, you should
If not, for relevant tutorials please visit this site. |
Show slide Code Files |
|
Slide 5 What is the Unconstrained Optimisation problem? |
A function is nonlinear if it has a degree of two or more.
An unconstrained optimisation problem is a mathematical optimization model with:
|
Show Slide 6 Mathematical Formulation |
A general form of the unconstrained optimization problem is as shown. |
Show Slide 7 Example |
We will now solve this example to illustrate the use of fot_fminunc In this example, we will learn how to:
|
We will use the toolbox to solve this example.
Make sure that the toolbox is already installed on Scilab. | |
Cursor on the Scilab console. | Now open the Scilab console. |
Type editor >> press Enter. |
In the Scilab console, type editor and press Enter. Editor window opens. |
Click on Open button. | Click on Open button on the toolbar. |
Go to the Downloads folder.
Locate the file opt_fminunc.sce. Click the Open button. |
Go to the Downloads folder.
Locate the file opt_fminunc.sce. Then click the Open button. |
Point to the file. | opt_fminunc.sce file opens in the editor. |
Show opt_fminunc.sce in scilab editor. | Now we will see the input arguments for fot_fminunc. |
Highlight ‘f’ | f is an objective function |
Highlight ‘x0’ | x0 is a vector containing the starting values of the decision variables. |
Highlight ‘xopt, fopt, exitflag, output, gradient, hessian’ |
Now we will see the output arguments. Output arguments are xopt, fopt, exitflag, output, gradient, hessian. |
Highlight ‘xopt’ | xopt is the optimal value of x. |
Highlight ‘fopt’ | fopt is the optimal objective function value. |
Highlight ‘exitflag’ | exitflag is the status of execution. |
Highlight ‘Output’ | Output is structure containing detailed information about the optimization. |
Highlight ‘Gradient’ | Gradient is a vector containing the objective's gradient of the solution. |
Highlight ‘Hessian’ | Hessian is a matrix containing the Lagrangian's hessian of the solution. |
Highlight [xopt,fopt,exitflag,output,gradient,hessian]=fot_fminunc(f,x0) |
Here we see the Scilab code to define and solve the example.
We call the fot_fminunc function to solve the given problem. |
Press CTRL + s Click on execute button on scilab. |
Save the file by pressing Control and S keys simultaneously. To run the file, click on the Execute menu. Click on File with Echo from the drop-down. |
Change the window to Scilab console. |
Switch to the Scilab console to see the output. We see that it prints the
|
Show Slide Integer Nonlinear Programming |
We will now look at integer nonlinear programming problems. These are problems where some decision variables are constrained to be integers. |
Show Slide 6 Mathematical Formulation |
A general form of the unconstrained integer programming problem is as shown. |
Show Slide Example |
We will now solve this example to illustrate the use of fot_intfminunc. In this example, we will learn how to:
Some of the decision variables are integers. |
Show opt_intfminunc.sce in scilab editor. |
We will use the toolbox to solve this example. Open the Scilab console. Type editor on the Scilab console and press Enter. Open opt_intfminunc.sce in the Scilab editor. |
Highlight ‘f’ | f is the objective function. |
Highlight ‘x0’ | x0 is a vector containing the starting values of the decision variables. |
Highlight ‘intcon’ | intcon is a vector of the indices of the integer variables. |
Highlight ‘xopt, fopt, exitflag, output, gradient, hessian’ |
Now we will see the output arguments. Output arguments are xopt, fopt, exitflag, output, gradient, hessian |
Highlight ‘xopt’ | xopt is the optimal value of x. |
Highlight ‘fopt’ | fopt is the optimal objective function value. |
Highlight ‘exitflag’ | exitflag is the status of execution. |
Highlight ‘Gradient’ | Gradient is a vector containing the objective's gradient of the solution |
Highlight ‘Hessian’ | Hessian is a matrix containing the Lagrangian's hessian of the solution. |
Press CTRL + s Click on execute button on scilab. |
Save the file by pressing Control and S keys simultaneously. To run the file, click on the Execute menu. Click on File with Echo from the drop-down. |
Change the window to Scilab console. |
Switch to the Scilab console to see the output. We see that it prints the
|
Show Slide Summary |
This brings us to the end of this tutorial. Let us summarise. In this tutorial, we have learnt to:
|
Show Slide Assignment |
As an assignment, please do the following:
|
Show Slide 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: Acknowledgement |
Spoken Tutorial and FOSSEE projects are funded by MoE, Government of India. |
Show Slide : Thank you |
This is Anandajith TS, FOSSEE intern 2021, IIT Bombay signing off.
Thanks for joining. |