├── README.md ├── images ├── Cow.jpg ├── farm.jpg ├── excel.jpg ├── excel.png ├── freight.jpg ├── tools.jpg ├── thinking.jpg ├── CroppedCow.jpg ├── food_truck.jpg ├── math_symbols.jpg ├── new_orleans.jpg ├── power_plant.jpg ├── coffee_brewing.jpg ├── contemplation.jpg ├── energy_sector.jpg ├── building_scaling.jpg ├── business_strategy.jpg ├── finance_industry.jpg ├── math_blackboard.jpg ├── retail_industry.jpg ├── shipping_industry.jpg ├── energy_sector_night.jpg ├── BranchAndBound │ ├── Slide1.jpg │ ├── Slide10.jpg │ ├── Slide11.jpg │ ├── Slide12.jpg │ ├── Slide2.jpg │ ├── Slide3.jpg │ ├── Slide4.jpg │ ├── Slide5.jpg │ ├── Slide6.jpg │ ├── Slide7.jpg │ ├── Slide8.jpg │ └── Slide9.jpg ├── DecisionTypes │ ├── Slide1.jpg │ ├── Slide2.jpg │ └── Slide3.jpg ├── CuttingPlanesDiagram │ ├── Slide1.jpg │ ├── Slide2.jpg │ ├── Slide3.jpg │ ├── Slide4.jpg │ ├── Slide5.jpg │ ├── Slide6.jpg │ ├── Slide7.jpg │ ├── Slide8.jpg │ └── Slide9.jpg ├── SolvingAnLPDiagram │ ├── Slide1.jpg │ └── Slide2.jpg └── FoodTruckModelDiagram │ ├── Slide1.jpg │ ├── Slide2.jpg │ ├── Slide3.jpg │ ├── Slide4.jpg │ ├── Slide5.jpg │ └── Slide6.jpg ├── code ├── CoffeePlanningExample │ ├── CoffeePlanning.Tests │ │ ├── Program.fs │ │ └── CoffeePlanning.Tests.fsproj │ ├── CoffeePlanning.Console │ │ ├── CoffeePlanning.Console.fsproj │ │ └── Program.fs │ ├── CoffeePlanning.Cli │ │ ├── Program.fs │ │ ├── CoffeePlanning.Cli.fsproj │ │ └── PlanConfig.json │ ├── CoffeePlanning.CSharp.Cli │ │ ├── CoffeePlanning.CSharp.Cli.csproj │ │ ├── Program.cs │ │ └── PlanConfig.json │ └── CoffeePlanning │ │ ├── CoffeePlanning.fsproj │ │ ├── Domain.fs │ │ ├── Solve.fs │ │ └── Model.fs ├── fsharp-workshop │ ├── F-Sharp-README │ │ ├── open-notebook.PNG │ │ ├── python-verify.png │ │ ├── anaconda-prompt.PNG │ │ ├── install-DotNet.PNG │ │ ├── jupyter-notebook.PNG │ │ ├── miniconda-download.PNG │ │ └── dotnet-verify-install.PNG │ ├── Practice │ │ └── Dotnet Interactive │ │ │ ├── Ex02_FarmModel.dib │ │ │ ├── Ex03_RevisedFarmModel.dib │ │ │ ├── Ex05_PowerPlanningModel.dib │ │ │ └── Ex04_CoffeeModel.dib │ └── Solutions │ │ ├── Dotnet Interactive │ │ ├── Ex02_FarmModel.dib │ │ └── Ex03_RevisedFarmModel.dib │ │ └── Jupyter Notebook │ │ └── Ex03_RevisedFarmModel.ipynb ├── csharp-visualstudio │ ├── Practice │ │ ├── Practice.csproj │ │ ├── Extensions.cs │ │ ├── 02-FarmModel.cs │ │ ├── 01-FoodCart.cs │ │ ├── 03-RevisedFoodModel.cs │ │ ├── 04-CoffeePlanning.cs │ │ └── 05-PowerPlanning.cs │ ├── Solutions │ │ ├── Solutions.csproj │ │ ├── Extensions.cs │ │ ├── 01-FoodCart.cs │ │ ├── 02-FarmModel.cs │ │ └── 03-RevisedFarmModel.cs │ ├── ConsoleRunner │ │ ├── ConsoleRunner.csproj │ │ └── Program.cs │ └── Optimization101.sln ├── README.md ├── fsharp-visualstudio │ ├── ConsoleRunner │ │ ├── ConsoleRunner.fsproj │ │ └── Program.fs │ ├── Solutions │ │ ├── Solutions.fsproj │ │ ├── 02-FarmModel.fs │ │ ├── 01-FoodTruck.fs │ │ └── 03-RevisedFarmModel.fs │ ├── Practice │ │ ├── Practice.fsproj │ │ ├── 02-FarmModel.fs │ │ ├── 01-FoodTruck.fs │ │ ├── SliceMapDetour.fsx │ │ ├── 03-RevisedFarmModel.fs │ │ ├── 04-CoffeeModel.fs │ │ └── 05-PowerPlanning.fs │ └── Optimization101.sln └── python-workshop │ ├── Solutions │ ├── .ipynb_checkpoints │ │ ├── result-checkpoint.csv │ │ └── Ex01_TacoTruck-checkpoint.ipynb │ ├── Ex02_FarmModel.ipynb │ └── Ex01_TacoTruck.ipynb │ └── Practice │ ├── Ex02_FarmModel.ipynb │ └── Ex03_RevisedFarmModel.ipynb ├── dist ├── theme │ └── fonts │ │ ├── league-gothic │ │ ├── LICENSE │ │ ├── league-gothic.eot │ │ ├── league-gothic.ttf │ │ ├── league-gothic.woff │ │ └── league-gothic.css │ │ └── source-sans-pro │ │ ├── source-sans-pro-italic.eot │ │ ├── source-sans-pro-italic.ttf │ │ ├── source-sans-pro-italic.woff │ │ ├── source-sans-pro-regular.eot │ │ ├── source-sans-pro-regular.ttf │ │ ├── source-sans-pro-regular.woff │ │ ├── source-sans-pro-semibold.eot │ │ ├── source-sans-pro-semibold.ttf │ │ ├── source-sans-pro-semibold.woff │ │ ├── source-sans-pro-semibolditalic.eot │ │ ├── source-sans-pro-semibolditalic.ttf │ │ ├── source-sans-pro-semibolditalic.woff │ │ ├── source-sans-pro.css │ │ └── LICENSE └── reset.css ├── .gitattributes ├── js ├── utils │ ├── constants.js │ ├── device.js │ ├── loader.js │ └── color.js ├── index.js └── controllers │ ├── progress.js │ ├── focus.js │ ├── notes.js │ ├── pointer.js │ └── slidenumber.js ├── css ├── theme │ ├── source │ │ ├── night.scss │ │ ├── serif.scss │ │ ├── league.scss │ │ ├── sky.scss │ │ ├── white.scss │ │ ├── beige.scss │ │ ├── black.scss │ │ ├── simple.scss │ │ ├── moon.scss │ │ ├── solarized.scss │ │ └── blood.scss │ ├── template │ │ ├── exposer.scss │ │ ├── settings.scss │ │ └── mixins.scss │ └── README.md ├── layout.scss └── print │ ├── pdf.scss │ └── paper.scss ├── LICENSE ├── plugin ├── highlight │ ├── monokai.css │ └── zenburn.css ├── math │ ├── math.esm.js │ ├── math.js │ └── plugin.js └── zoom │ ├── zoom.esm.js │ └── zoom.js ├── index.html └── package.json /README.md: -------------------------------------------------------------------------------- 1 | # MathematicalPlanningWorkshops 2 | A series of workshops on Mathematical Planning 3 | -------------------------------------------------------------------------------- /images/Cow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/Cow.jpg -------------------------------------------------------------------------------- /images/farm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/farm.jpg -------------------------------------------------------------------------------- /images/excel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/excel.jpg -------------------------------------------------------------------------------- /images/excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/excel.png -------------------------------------------------------------------------------- /images/freight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/freight.jpg -------------------------------------------------------------------------------- /images/tools.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/tools.jpg -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.Tests/Program.fs: -------------------------------------------------------------------------------- 1 | module Program = let [] main _ = 0 2 | -------------------------------------------------------------------------------- /images/thinking.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/thinking.jpg -------------------------------------------------------------------------------- /images/CroppedCow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CroppedCow.jpg -------------------------------------------------------------------------------- /images/food_truck.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/food_truck.jpg -------------------------------------------------------------------------------- /images/math_symbols.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/math_symbols.jpg -------------------------------------------------------------------------------- /images/new_orleans.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/new_orleans.jpg -------------------------------------------------------------------------------- /images/power_plant.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/power_plant.jpg -------------------------------------------------------------------------------- /images/coffee_brewing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/coffee_brewing.jpg -------------------------------------------------------------------------------- /images/contemplation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/contemplation.jpg -------------------------------------------------------------------------------- /images/energy_sector.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/energy_sector.jpg -------------------------------------------------------------------------------- /images/building_scaling.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/building_scaling.jpg -------------------------------------------------------------------------------- /images/business_strategy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/business_strategy.jpg -------------------------------------------------------------------------------- /images/finance_industry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/finance_industry.jpg -------------------------------------------------------------------------------- /images/math_blackboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/math_blackboard.jpg -------------------------------------------------------------------------------- /images/retail_industry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/retail_industry.jpg -------------------------------------------------------------------------------- /images/shipping_industry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/shipping_industry.jpg -------------------------------------------------------------------------------- /images/energy_sector_night.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/energy_sector_night.jpg -------------------------------------------------------------------------------- /dist/theme/fonts/league-gothic/LICENSE: -------------------------------------------------------------------------------- 1 | SIL Open Font License (OFL) 2 | http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL 3 | -------------------------------------------------------------------------------- /images/BranchAndBound/Slide1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide1.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide10.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide11.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide12.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide2.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide3.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide4.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide5.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide6.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide7.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide8.jpg -------------------------------------------------------------------------------- /images/BranchAndBound/Slide9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/BranchAndBound/Slide9.jpg -------------------------------------------------------------------------------- /images/DecisionTypes/Slide1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/DecisionTypes/Slide1.jpg -------------------------------------------------------------------------------- /images/DecisionTypes/Slide2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/DecisionTypes/Slide2.jpg -------------------------------------------------------------------------------- /images/DecisionTypes/Slide3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/DecisionTypes/Slide3.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide1.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide2.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide3.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide4.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide5.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide6.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide7.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide8.jpg -------------------------------------------------------------------------------- /images/CuttingPlanesDiagram/Slide9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/CuttingPlanesDiagram/Slide9.jpg -------------------------------------------------------------------------------- /images/SolvingAnLPDiagram/Slide1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/SolvingAnLPDiagram/Slide1.jpg -------------------------------------------------------------------------------- /images/SolvingAnLPDiagram/Slide2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/SolvingAnLPDiagram/Slide2.jpg -------------------------------------------------------------------------------- /images/FoodTruckModelDiagram/Slide1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/FoodTruckModelDiagram/Slide1.jpg -------------------------------------------------------------------------------- /images/FoodTruckModelDiagram/Slide2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/FoodTruckModelDiagram/Slide2.jpg -------------------------------------------------------------------------------- /images/FoodTruckModelDiagram/Slide3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/FoodTruckModelDiagram/Slide3.jpg -------------------------------------------------------------------------------- /images/FoodTruckModelDiagram/Slide4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/FoodTruckModelDiagram/Slide4.jpg -------------------------------------------------------------------------------- /images/FoodTruckModelDiagram/Slide5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/FoodTruckModelDiagram/Slide5.jpg -------------------------------------------------------------------------------- /images/FoodTruckModelDiagram/Slide6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/images/FoodTruckModelDiagram/Slide6.jpg -------------------------------------------------------------------------------- /dist/theme/fonts/league-gothic/league-gothic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/league-gothic/league-gothic.eot -------------------------------------------------------------------------------- /dist/theme/fonts/league-gothic/league-gothic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/league-gothic/league-gothic.ttf -------------------------------------------------------------------------------- /dist/theme/fonts/league-gothic/league-gothic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/league-gothic/league-gothic.woff -------------------------------------------------------------------------------- /code/fsharp-workshop/F-Sharp-README/open-notebook.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/code/fsharp-workshop/F-Sharp-README/open-notebook.PNG -------------------------------------------------------------------------------- /code/fsharp-workshop/F-Sharp-README/python-verify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/code/fsharp-workshop/F-Sharp-README/python-verify.png -------------------------------------------------------------------------------- /code/fsharp-workshop/F-Sharp-README/anaconda-prompt.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/code/fsharp-workshop/F-Sharp-README/anaconda-prompt.PNG -------------------------------------------------------------------------------- /code/fsharp-workshop/F-Sharp-README/install-DotNet.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/code/fsharp-workshop/F-Sharp-README/install-DotNet.PNG -------------------------------------------------------------------------------- /code/fsharp-workshop/F-Sharp-README/jupyter-notebook.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/code/fsharp-workshop/F-Sharp-README/jupyter-notebook.PNG -------------------------------------------------------------------------------- /code/fsharp-workshop/F-Sharp-README/miniconda-download.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/code/fsharp-workshop/F-Sharp-README/miniconda-download.PNG -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-italic.eot -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-italic.ttf -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-italic.woff -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-regular.eot -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-regular.ttf -------------------------------------------------------------------------------- /code/fsharp-workshop/F-Sharp-README/dotnet-verify-install.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/code/fsharp-workshop/F-Sharp-README/dotnet-verify-install.PNG -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-regular.woff -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.eot -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.ttf -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-semibold.woff -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.eot -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.ttf -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matthewcrews/MathematicalPlanning101/HEAD/dist/theme/fonts/source-sans-pro/source-sans-pro-semibolditalic.woff -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.css linguist-detectable=false 2 | *.scss linguist-detectable=false 3 | *.js linguist-detectable=false 4 | *.java linguist-detectable=false 5 | *.html linguist-detectable=false 6 | *.javascript linguist-detectable=false 7 | *.ipynb linguist-detectable=false -------------------------------------------------------------------------------- /code/csharp-visualstudio/Practice/Practice.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | x64 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Solutions/Solutions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | x64 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /dist/theme/fonts/league-gothic/league-gothic.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'League Gothic'; 3 | src: url('league-gothic.eot'); 4 | src: url('league-gothic.eot?#iefix') format('embedded-opentype'), 5 | url('league-gothic.woff') format('woff'), 6 | url('league-gothic.ttf') format('truetype'); 7 | 8 | font-weight: normal; 9 | font-style: normal; 10 | } -------------------------------------------------------------------------------- /code/csharp-visualstudio/ConsoleRunner/ConsoleRunner.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | x64 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /code/README.md: -------------------------------------------------------------------------------- 1 | # Applied AI : Mathematical Planning 2 | 3 | This repo contains the material for the Applied AI: Mathematical Planning workshop put on by the QTrade group. It is meant to be an introduction to the tools of Mathematical Planning. The workshop can be given in Python, C#, or F#. The practice problems and solutions for each language are in their respective directories. The presentation is hosted [here](https://git.rockfin.com/pages/mcrews/optimization101/#/). 4 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.Console/CoffeePlanning.Console.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | AnyCPU;x64 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Practice/Extensions.cs: -------------------------------------------------------------------------------- 1 | using Google.OrTools.LinearSolver; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace Practice 7 | { 8 | public static class Extensions 9 | { 10 | public static LinearExpr Sum(this IEnumerable source, Func selector) 11 | { 12 | var zeroExpr = new LinearExpr(); 13 | return source.Aggregate(zeroExpr, (current, entry) => current + selector(entry)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Solutions/Extensions.cs: -------------------------------------------------------------------------------- 1 | using Google.OrTools.LinearSolver; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace Solutions 7 | { 8 | public static class Extensions 9 | { 10 | public static LinearExpr Sum(this IEnumerable source, Func selector) 11 | { 12 | var zeroExpr = new LinearExpr(); 13 | return source.Aggregate(zeroExpr, (current, entry) => current + selector(entry)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/ConsoleRunner/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConsoleRunner 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | Console.WriteLine("Optimization 101!"); 10 | Console.WriteLine(); 11 | 12 | Practice.FoodCart.Solve(); 13 | //Practice.FarmModel.Solve(); 14 | //Practice.RevisedFarmModel.Solve(); 15 | //Practice.CoffePlanning.Solve(); 16 | //Practice.PowerPlanning.Solve(); 17 | 18 | Console.WriteLine("Press Enter to close..."); 19 | Console.ReadLine(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /js/utils/constants.js: -------------------------------------------------------------------------------- 1 | 2 | export const SLIDES_SELECTOR = '.slides section'; 3 | export const HORIZONTAL_SLIDES_SELECTOR = '.slides>section'; 4 | export const VERTICAL_SLIDES_SELECTOR = '.slides>section.present>section'; 5 | 6 | // Methods that may not be invoked via the postMessage API 7 | export const POST_MESSAGE_METHOD_BLACKLIST = /registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener/; 8 | 9 | // Regex for retrieving the fragment style from a class attribute 10 | export const FRAGMENT_STYLE_REGEX = /fade-(down|up|right|left|out|in-then-out|in-then-semi-out)|semi-fade-out|current-visible|shrink|grow/; -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.Cli/Program.fs: -------------------------------------------------------------------------------- 1 | open System 2 | open Newtonsoft.Json 3 | open CoffeePlanning 4 | 5 | [] 6 | let main argv = 7 | Console.Title <- "F# Coffee Planning Example" 8 | printfn "F# Coffee Planning Example" 9 | 10 | let configFile = "PlanConfig.json" 11 | let config = JsonConvert.DeserializeObject(System.IO.File.ReadAllText configFile) 12 | let result = Solve.findPlan config 10_000L 13 | 14 | let resultJson = JsonConvert.SerializeObject(result, Formatting.Indented) 15 | printfn "================Result================" 16 | printfn "%s" resultJson 17 | 18 | 0 // return an integer exit code 19 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.CSharp.Cli/CoffeePlanning.CSharp.Cli.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | AnyCPU;x64 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | PreserveNewest 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.Cli/CoffeePlanning.Cli.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | AnyCPU;x64 7 | 8 | 9 | 10 | 11 | PreserveNewest 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /js/utils/device.js: -------------------------------------------------------------------------------- 1 | const UA = navigator.userAgent; 2 | const testElement = document.createElement( 'div' ); 3 | 4 | export const isMobile = /(iphone|ipod|ipad|android)/gi.test( UA ) || 5 | ( navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ); // iPadOS 6 | 7 | export const isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA ); 8 | 9 | export const isAndroid = /android/gi.test( UA ); 10 | 11 | // Flags if we should use zoom instead of transform to scale 12 | // up slides. Zoom produces crisper results but has a lot of 13 | // xbrowser quirks so we only use it in whitelisted browsers. 14 | export const supportsZoom = 'zoom' in testElement.style && !isMobile && 15 | ( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) ); 16 | 17 | export const supportsHistoryAPI = typeof window.history.replaceState === 'function' && !/PhantomJS/.test( UA ); -------------------------------------------------------------------------------- /code/fsharp-visualstudio/ConsoleRunner/ConsoleRunner.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | AnyCPU;x64 7 | 8 | 9 | 10 | DEBUG;TRACE 11 | NU1701; 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /code/fsharp-visualstudio/ConsoleRunner/Program.fs: -------------------------------------------------------------------------------- 1 | // Learn more about F# at http://docs.microsoft.com/dotnet/fsharp 2 | 3 | open System 4 | open Practice 5 | 6 | 7 | [] 8 | let main argv = 9 | 10 | // Practice 11 | //Practice.FoodTruck.solve () 12 | //Practice.FarmModel.solve () 13 | //Practice.RevisedFarmModel.solve () 14 | //Practice.CoffeeModel.solve () 15 | //Practice.CoffeeModelRevised.solve () 16 | //Practice.PowerPlanning.solve () 17 | 18 | // Solutions 19 | //Solutions.FoodTruck.solve () 20 | //Solutions.FarmModel.solve () 21 | //Solutions.RevisedFarmModel.solve () 22 | //Solutions.CoffeeModel.solve () 23 | //Solutions.CoffeeModelRevised.solve () 24 | //Solutions.PowerPlanning.solve () 25 | 26 | printfn "Hit Enter to exit..." 27 | let r = Console.ReadLine() 28 | 0 // return an integer exit code -------------------------------------------------------------------------------- /code/fsharp-visualstudio/Solutions/Solutions.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | AnyCPU;x64 6 | 7 | 8 | 9 | NU1701; 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.CSharp.Cli/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using CoffeePlanning; 4 | 5 | namespace CoffeePlanning.CSharp.Cli 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | Console.Title = "C# Coffee Planning Example"; 12 | Console.WriteLine("C# Coffee Planning Example"); 13 | 14 | var configFile = "PlanConfig.json"; 15 | var config = JsonConvert.DeserializeObject(System.IO.File.ReadAllText(configFile)); 16 | var result = Solve.findPlan(config, 10000L); 17 | 18 | var resultJson = JsonConvert.SerializeObject(result, Formatting.Indented); 19 | Console.WriteLine("================Result================"); 20 | Console.WriteLine(resultJson); 21 | Console.WriteLine("Press ENTER to close..."); 22 | Console.ReadLine(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dist/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v4.0 | 20180602 3 | License: none (public domain) 4 | */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | main, menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | /* HTML5 display-role reset for older browsers */ 27 | article, aside, details, figcaption, figure, 28 | footer, header, hgroup, main, menu, nav, section { 29 | display: block; 30 | } -------------------------------------------------------------------------------- /code/fsharp-visualstudio/Practice/Practice.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | AnyCPU;x64 6 | 7 | 8 | 9 | NU1701; 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /css/theme/source/night.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Black theme for reveal.js. 3 | * 4 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(https://fonts.googleapis.com/css?family=Montserrat:700); 16 | @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic); 17 | 18 | 19 | // Override theme settings (see ../template/settings.scss) 20 | $backgroundColor: #111; 21 | 22 | $mainFont: 'Open Sans', sans-serif; 23 | $linkColor: #e7ad52; 24 | $linkColorHover: lighten( $linkColor, 20% ); 25 | $headingFont: 'Montserrat', Impact, sans-serif; 26 | $headingTextShadow: none; 27 | $headingLetterSpacing: -0.03em; 28 | $headingTextTransform: none; 29 | $selectionBackgroundColor: #e7ad52; 30 | 31 | 32 | // Theme template ------------------------------ 33 | @import "../template/theme"; 34 | // --------------------------------------------- -------------------------------------------------------------------------------- /css/theme/template/exposer.scss: -------------------------------------------------------------------------------- 1 | // Exposes theme's variables for easy re-use in CSS for plugin authors 2 | 3 | :root { 4 | --background-color: #{$backgroundColor}; 5 | --main-font: #{$mainFont}; 6 | --main-font-size: #{$mainFontSize}; 7 | --main-color: #{$mainColor}; 8 | --block-margin: #{$blockMargin}; 9 | --heading-margin: #{$headingMargin}; 10 | --heading-font: #{$headingFont}; 11 | --heading-color: #{$headingColor}; 12 | --heading-line-height: #{$headingLineHeight}; 13 | --heading-letter-spacing: #{$headingLetterSpacing}; 14 | --heading-text-transform: #{$headingTextTransform}; 15 | --heading-text-shadow: #{$headingTextShadow}; 16 | --heading-font-weight: #{$headingFontWeight}; 17 | --heading1-text-shadow: #{$heading1TextShadow}; 18 | --heading1-size: #{$heading1Size}; 19 | --heading2-size: #{$heading2Size}; 20 | --heading3-size: #{$heading3Size}; 21 | --heading4-size: #{$heading4Size}; 22 | --code-font: #{$codeFont}; 23 | --link-color: #{$linkColor}; 24 | --link-color-hover: #{$linkColorHover}; 25 | --selection-background-color: #{$selectionBackgroundColor}; 26 | --selection-color: #{$selectionColor}; 27 | } 28 | -------------------------------------------------------------------------------- /css/theme/source/serif.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple theme for reveal.js presentations, similar 3 | * to the default theme. The accent color is brown. 4 | * 5 | * This theme is Copyright (C) 2012-2013 Owen Versteeg, http://owenversteeg.com - it is MIT licensed. 6 | */ 7 | 8 | 9 | // Default mixins and settings ----------------- 10 | @import "../template/mixins"; 11 | @import "../template/settings"; 12 | // --------------------------------------------- 13 | 14 | 15 | 16 | // Override theme settings (see ../template/settings.scss) 17 | $mainFont: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; 18 | $mainColor: #000; 19 | $headingFont: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; 20 | $headingColor: #383D3D; 21 | $headingTextShadow: none; 22 | $headingTextTransform: none; 23 | $backgroundColor: #F0F1EB; 24 | $linkColor: #51483D; 25 | $linkColorHover: lighten( $linkColor, 20% ); 26 | $selectionBackgroundColor: #26351C; 27 | 28 | .reveal a { 29 | line-height: 1.3em; 30 | } 31 | 32 | 33 | // Theme template ------------------------------ 34 | @import "../template/theme"; 35 | // --------------------------------------------- 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2020 Hakim El Hattab, http://hakim.se, and reveal.js contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning/CoffeePlanning.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | AnyCPU;x64 6 | 7 | 8 | 9 | NU1701; 10 | 11 | 12 | 13 | 14 | <_Parameter1>$(AssemblyName).Tests 15 | 16 | 17 | <_Parameter1>DynamicProxyGenAssembly2 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | NU1701 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /code/fsharp-visualstudio/Practice/02-FarmModel.fs: -------------------------------------------------------------------------------- 1 | module Practice.FarmModel 2 | 3 | open Flips 4 | open Flips.Types 5 | 6 | let solve () = 7 | 8 | // Create decision variables for cows, pigs, and chickens 9 | 10 | // Create an objective expression 11 | 12 | // Create an objective 13 | 14 | 15 | // Add constraint for amount of Pasture 16 | 17 | // Add constraint for amount of Feed 18 | 19 | // Add constraint for amount of Labor 20 | 21 | 22 | // Create the model and add the constraints 23 | 24 | 25 | // Create the solver settings 26 | let settings = { 27 | SolverType = SolverType.CBC 28 | MaxDuration = 10000L 29 | WriteLPFile = None 30 | } 31 | 32 | // Solve the model and save the results 33 | 34 | printfn "--Results--" 35 | 36 | // Print the results of the solver 37 | //match result with 38 | //| Optimal solution -> 39 | // printfn "Objective Value: %f" solution.ObjectiveResult 40 | // for (decision, value) in solution.DecisionResults |> Map.toSeq do 41 | // let (DecisionName name) = decision.Name 42 | // printfn "Decision: %s\tValue: %f" name value 43 | //| _ -> printfn "Unable to solve." -------------------------------------------------------------------------------- /css/theme/source/league.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * League theme for reveal.js. 3 | * 4 | * This was the default theme pre-3.0.0. 5 | * 6 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 7 | */ 8 | 9 | 10 | // Default mixins and settings ----------------- 11 | @import "../template/mixins"; 12 | @import "../template/settings"; 13 | // --------------------------------------------- 14 | 15 | 16 | 17 | // Include theme-specific fonts 18 | @import url(fonts/league-gothic/league-gothic.css); 19 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 20 | 21 | // Override theme settings (see ../template/settings.scss) 22 | $headingTextShadow: 0px 0px 6px rgba(0,0,0,0.2); 23 | $heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15); 24 | 25 | // Background generator 26 | @mixin bodyBackground() { 27 | @include radial-gradient( rgba(28,30,32,1), rgba(85,90,95,1) ); 28 | } 29 | 30 | 31 | 32 | // Theme template ------------------------------ 33 | @import "../template/theme"; 34 | // --------------------------------------------- -------------------------------------------------------------------------------- /css/theme/template/settings.scss: -------------------------------------------------------------------------------- 1 | // Base settings for all themes that can optionally be 2 | // overridden by the super-theme 3 | 4 | // Background of the presentation 5 | $backgroundColor: #2b2b2b; 6 | 7 | // Primary/body text 8 | $mainFont: 'Lato', sans-serif; 9 | $mainFontSize: 40px; 10 | $mainColor: #eee; 11 | 12 | // Vertical spacing between blocks of text 13 | $blockMargin: 20px; 14 | 15 | // Headings 16 | $headingMargin: 0 0 $blockMargin 0; 17 | $headingFont: 'League Gothic', Impact, sans-serif; 18 | $headingColor: #eee; 19 | $headingLineHeight: 1.2; 20 | $headingLetterSpacing: normal; 21 | $headingTextTransform: uppercase; 22 | $headingTextShadow: none; 23 | $headingFontWeight: normal; 24 | $heading1TextShadow: $headingTextShadow; 25 | 26 | $heading1Size: 3.77em; 27 | $heading2Size: 2.11em; 28 | $heading3Size: 1.55em; 29 | $heading4Size: 1.00em; 30 | 31 | $codeFont: monospace; 32 | 33 | // Links and actions 34 | $linkColor: #13DAEC; 35 | $linkColorHover: lighten( $linkColor, 20% ); 36 | 37 | // Text selection 38 | $selectionBackgroundColor: #FF5E99; 39 | $selectionColor: #fff; 40 | 41 | // Generates the presentation background, can be overridden 42 | // to return a background image or gradient 43 | @mixin bodyBackground() { 44 | background: $backgroundColor; 45 | } 46 | -------------------------------------------------------------------------------- /code/fsharp-visualstudio/Practice/01-FoodTruck.fs: -------------------------------------------------------------------------------- 1 | module Practice.FoodTruck 2 | 3 | open Flips 4 | open Flips.Types 5 | 6 | let solve () = 7 | 8 | // Create a decision variable for the number of burgers below 9 | 10 | // Create a decision variable for the number of tacos below 11 | 12 | // Create an objective expression here 13 | 14 | // Create an objective here 15 | 16 | // Create a constraint for the max number of Burgers 17 | 18 | // Create a constraint for the max number of Tacos 19 | 20 | // Create a constraint for the total weight 21 | 22 | 23 | // Create the model below 24 | 25 | 26 | let settings = { 27 | SolverType = SolverType.CBC 28 | MaxDuration = 10_000L 29 | WriteLPFile = None 30 | } 31 | 32 | // Store result of solved model below 33 | 34 | 35 | printfn "--Result--" 36 | 37 | // Print the results of the solver below 38 | //match result with 39 | //| Optimal solution -> 40 | // printfn "Objective Value: %f" solution.ObjectiveResult 41 | // for (decision, value) in solution.DecisionResults |> Map.toSeq do 42 | // let (DecisionName name) = decision.Name 43 | // printfn "Decision: %s\tValue: %f" name value 44 | //| _ -> printfn "Unable to solve." -------------------------------------------------------------------------------- /plugin/highlight/monokai.css: -------------------------------------------------------------------------------- 1 | /* 2 | Monokai style - ported by Luigi Maselli - http://grigio.org 3 | */ 4 | 5 | .hljs { 6 | display: block; 7 | overflow-x: auto; 8 | padding: 0.5em; 9 | background: #272822; 10 | color: #ddd; 11 | } 12 | 13 | .hljs-tag, 14 | .hljs-keyword, 15 | .hljs-selector-tag, 16 | .hljs-literal, 17 | .hljs-strong, 18 | .hljs-name { 19 | color: #f92672; 20 | } 21 | 22 | .hljs-code { 23 | color: #66d9ef; 24 | } 25 | 26 | .hljs-class .hljs-title { 27 | color: white; 28 | } 29 | 30 | .hljs-attribute, 31 | .hljs-symbol, 32 | .hljs-regexp, 33 | .hljs-link { 34 | color: #bf79db; 35 | } 36 | 37 | .hljs-string, 38 | .hljs-bullet, 39 | .hljs-subst, 40 | .hljs-title, 41 | .hljs-section, 42 | .hljs-emphasis, 43 | .hljs-type, 44 | .hljs-built_in, 45 | .hljs-builtin-name, 46 | .hljs-selector-attr, 47 | .hljs-selector-pseudo, 48 | .hljs-addition, 49 | .hljs-variable, 50 | .hljs-template-tag, 51 | .hljs-template-variable { 52 | color: #a6e22e; 53 | } 54 | 55 | .hljs-comment, 56 | .hljs-quote, 57 | .hljs-deletion, 58 | .hljs-meta { 59 | color: #75715e; 60 | } 61 | 62 | .hljs-keyword, 63 | .hljs-selector-tag, 64 | .hljs-literal, 65 | .hljs-doctag, 66 | .hljs-title, 67 | .hljs-section, 68 | .hljs-type, 69 | .hljs-selector-id { 70 | font-weight: bold; 71 | } 72 | -------------------------------------------------------------------------------- /js/utils/loader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Loads a JavaScript file from the given URL and executes it. 3 | * 4 | * @param {string} url Address of the .js file to load 5 | * @param {function} callback Method to invoke when the script 6 | * has loaded and executed 7 | */ 8 | export const loadScript = ( url, callback ) => { 9 | 10 | const script = document.createElement( 'script' ); 11 | script.type = 'text/javascript'; 12 | script.async = false; 13 | script.defer = false; 14 | script.src = url; 15 | 16 | if( typeof callback === 'function' ) { 17 | 18 | // Success callback 19 | script.onload = script.onreadystatechange = event => { 20 | if( event.type === 'load' || /loaded|complete/.test( script.readyState ) ) { 21 | 22 | // Kill event listeners 23 | script.onload = script.onreadystatechange = script.onerror = null; 24 | 25 | callback(); 26 | 27 | } 28 | }; 29 | 30 | // Error callback 31 | script.onerror = err => { 32 | 33 | // Kill event listeners 34 | script.onload = script.onreadystatechange = script.onerror = null; 35 | 36 | callback( new Error( 'Failed loading script: ' + script.src + '\n' + err ) ); 37 | 38 | }; 39 | 40 | } 41 | 42 | // Append the script at the end of 43 | const head = document.querySelector( 'head' ); 44 | head.insertBefore( script, head.lastChild ); 45 | 46 | } -------------------------------------------------------------------------------- /plugin/highlight/zenburn.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Zenburn style from voldmar.ru (c) Vladimir Epifanov 4 | based on dark.css by Ivan Sagalaev 5 | 6 | */ 7 | 8 | .hljs { 9 | display: block; 10 | overflow-x: auto; 11 | padding: 0.5em; 12 | background: #3f3f3f; 13 | color: #dcdcdc; 14 | } 15 | 16 | .hljs-keyword, 17 | .hljs-selector-tag, 18 | .hljs-tag { 19 | color: #e3ceab; 20 | } 21 | 22 | .hljs-template-tag { 23 | color: #dcdcdc; 24 | } 25 | 26 | .hljs-number { 27 | color: #8cd0d3; 28 | } 29 | 30 | .hljs-variable, 31 | .hljs-template-variable, 32 | .hljs-attribute { 33 | color: #efdcbc; 34 | } 35 | 36 | .hljs-literal { 37 | color: #efefaf; 38 | } 39 | 40 | .hljs-subst { 41 | color: #8f8f8f; 42 | } 43 | 44 | .hljs-title, 45 | .hljs-name, 46 | .hljs-selector-id, 47 | .hljs-selector-class, 48 | .hljs-section, 49 | .hljs-type { 50 | color: #efef8f; 51 | } 52 | 53 | .hljs-symbol, 54 | .hljs-bullet, 55 | .hljs-link { 56 | color: #dca3a3; 57 | } 58 | 59 | .hljs-deletion, 60 | .hljs-string, 61 | .hljs-built_in, 62 | .hljs-builtin-name { 63 | color: #cc9393; 64 | } 65 | 66 | .hljs-addition, 67 | .hljs-comment, 68 | .hljs-quote, 69 | .hljs-meta { 70 | color: #7f9f7f; 71 | } 72 | 73 | 74 | .hljs-emphasis { 75 | font-style: italic; 76 | } 77 | 78 | .hljs-strong { 79 | font-weight: bold; 80 | } 81 | -------------------------------------------------------------------------------- /css/theme/source/sky.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Sky theme for reveal.js. 3 | * 4 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | 15 | // Include theme-specific fonts 16 | @import url(https://fonts.googleapis.com/css?family=Quicksand:400,700,400italic,700italic); 17 | @import url(https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700); 18 | 19 | 20 | // Override theme settings (see ../template/settings.scss) 21 | $mainFont: 'Open Sans', sans-serif; 22 | $mainColor: #333; 23 | $headingFont: 'Quicksand', sans-serif; 24 | $headingColor: #333; 25 | $headingLetterSpacing: -0.08em; 26 | $headingTextShadow: none; 27 | $backgroundColor: #f7fbfc; 28 | $linkColor: #3b759e; 29 | $linkColorHover: lighten( $linkColor, 20% ); 30 | $selectionBackgroundColor: #134674; 31 | 32 | // Fix links so they are not cut off 33 | .reveal a { 34 | line-height: 1.3em; 35 | } 36 | 37 | // Background generator 38 | @mixin bodyBackground() { 39 | @include radial-gradient( #add9e4, #f7fbfc ); 40 | } 41 | 42 | 43 | 44 | // Theme template ------------------------------ 45 | @import "../template/theme"; 46 | // --------------------------------------------- 47 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Practice/02-FarmModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Google.OrTools.LinearSolver; 3 | 4 | namespace Practice 5 | { 6 | public class FarmModel 7 | { 8 | public static void Solve() 9 | { 10 | // Create an instance of the Solver class 11 | var solver = Solver.CreateSolver("FarmModel", "GLOP_LINEAR_PROGRAMMING"); 12 | 13 | // Create variables for each type of Anaimal 14 | 15 | // Create expression for Revenue 16 | 17 | // Add the expression to the solver 18 | 19 | 20 | // Create constraint for Pasture 21 | 22 | 23 | // Create constraint for the Feed 24 | 25 | 26 | // Create constraint for the Labor 27 | 28 | 29 | // Solve the problem 30 | 31 | 32 | //// Evaluate the solve status 33 | //if (resultStatus != Solver.ResultStatus.OPTIMAL) 34 | //{ 35 | // Console.WriteLine("The problem does not have an optimal solution!"); 36 | // return; 37 | //} 38 | 39 | //// Print the results 40 | //Console.WriteLine("Solution:"); 41 | //Console.WriteLine("Objective value = " + solver.Objective().Value()); 42 | //foreach (var variable in solver.variables()) 43 | //{ 44 | // Console.WriteLine($"{variable.Name()} = {variable.SolutionValue()}"); 45 | //} 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /css/theme/source/white.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * White theme for reveal.js. This is the opposite of the 'black' theme. 3 | * 4 | * By Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(fonts/source-sans-pro/source-sans-pro.css); 16 | 17 | 18 | // Override theme settings (see ../template/settings.scss) 19 | $backgroundColor: #fff; 20 | 21 | $mainColor: #222; 22 | $headingColor: #222; 23 | 24 | $mainFontSize: 42px; 25 | $mainFont: 'Source Sans Pro', Helvetica, sans-serif; 26 | $headingFont: 'Source Sans Pro', Helvetica, sans-serif; 27 | $headingTextShadow: none; 28 | $headingLetterSpacing: normal; 29 | $headingTextTransform: uppercase; 30 | $headingFontWeight: 600; 31 | $linkColor: #2a76dd; 32 | $linkColorHover: lighten( $linkColor, 15% ); 33 | $selectionBackgroundColor: lighten( $linkColor, 25% ); 34 | 35 | $heading1Size: 2.5em; 36 | $heading2Size: 1.6em; 37 | $heading3Size: 1.3em; 38 | $heading4Size: 1.0em; 39 | 40 | section.has-dark-background { 41 | &, h1, h2, h3, h4, h5, h6 { 42 | color: #fff; 43 | } 44 | } 45 | 46 | 47 | // Theme template ------------------------------ 48 | @import "../template/theme"; 49 | // --------------------------------------------- -------------------------------------------------------------------------------- /css/theme/source/beige.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Beige theme for reveal.js. 3 | * 4 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | 15 | // Include theme-specific fonts 16 | @import url(fonts/league-gothic/league-gothic.css); 17 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 18 | 19 | 20 | // Override theme settings (see ../template/settings.scss) 21 | $mainColor: #333; 22 | $headingColor: #333; 23 | $headingTextShadow: none; 24 | $backgroundColor: #f7f3de; 25 | $linkColor: #8b743d; 26 | $linkColorHover: lighten( $linkColor, 20% ); 27 | $selectionBackgroundColor: rgba(79, 64, 28, 0.99); 28 | $heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15); 29 | 30 | // Background generator 31 | @mixin bodyBackground() { 32 | @include radial-gradient( rgba(247,242,211,1), rgba(255,255,255,1) ); 33 | } 34 | 35 | 36 | 37 | // Theme template ------------------------------ 38 | @import "../template/theme"; 39 | // --------------------------------------------- -------------------------------------------------------------------------------- /css/theme/source/black.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Black theme for reveal.js. This is the opposite of the 'white' theme. 3 | * 4 | * By Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(fonts/source-sans-pro/source-sans-pro.css); 16 | 17 | 18 | // Override theme settings (see ../template/settings.scss) 19 | $backgroundColor: #191919; 20 | 21 | $mainColor: #fff; 22 | $headingColor: #fff; 23 | 24 | $mainFontSize: 42px; 25 | $mainFont: 'Source Sans Pro', Helvetica, sans-serif; 26 | $headingFont: 'Source Sans Pro', Helvetica, sans-serif; 27 | $headingTextShadow: none; 28 | $headingLetterSpacing: normal; 29 | $headingTextTransform: uppercase; 30 | $headingFontWeight: 600; 31 | $linkColor: #42affa; 32 | $linkColorHover: lighten( $linkColor, 15% ); 33 | $selectionBackgroundColor: lighten( $linkColor, 25% ); 34 | 35 | $heading1Size: 2.5em; 36 | $heading2Size: 1.6em; 37 | $heading3Size: 1.3em; 38 | $heading4Size: 1.0em; 39 | 40 | section.has-light-background { 41 | &, h1, h2, h3, h4, h5, h6 { 42 | color: #222; 43 | } 44 | } 45 | 46 | 47 | // Theme template ------------------------------ 48 | @import "../template/theme"; 49 | // --------------------------------------------- -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.Cli/PlanConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "Locations": [ 3 | "Sellwood", 4 | "Hawthorne", 5 | "The Pearl", 6 | "Eastmoreland", 7 | "St. Johns", 8 | "Alberta", 9 | "Nob Hill", 10 | "Belmont" 11 | ], 12 | "WarehouseCosts": { 13 | "Sellwood": 80000.0, 14 | "Hawthorne": 90000.0, 15 | "The Pearl": 120000.0, 16 | "Eastmoreland": 90000.0, 17 | "St. Johns": 85000.0, 18 | "Alberta": 70000.0, 19 | "Nob Hill": 85000.0, 20 | "Belmont": 90000.0 21 | }, 22 | "WarehouseCapacity": { 23 | "Sellwood": 8000.0, 24 | "Hawthorne": 6000.0, 25 | "The Pearl": 12000.0, 26 | "Eastmoreland": 6000.0, 27 | "St. Johns": 7000.0, 28 | "Alberta": 9000.0, 29 | "Nob Hill": 6000.0, 30 | "Belmont": 9200.0 31 | }, 32 | "RoasterCosts": { 33 | "Sellwood": 150000.0, 34 | "Hawthorne": 100000.0, 35 | "The Pearl": 250000.0, 36 | "Eastmoreland": 120000.0, 37 | "St. Johns": 130000.0, 38 | "Alberta": 110000.0, 39 | "Nob Hill": 135000.0, 40 | "Belmont": 180000.0 41 | }, 42 | "RoasterCapacity": { 43 | "Sellwood": 12.0, 44 | "Hawthorne": 18.0, 45 | "The Pearl": 22.0, 46 | "Eastmoreland": 13.0, 47 | "St. Johns": 14.0, 48 | "Alberta": 10.0, 49 | "Nob Hill": 17.0, 50 | "Belmont": 12.0 51 | }, 52 | "MinWarehouseCapacity": 30000.0, 53 | "MinRoasterCapacity": 30.0 54 | } -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.CSharp.Cli/PlanConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "Locations": [ 3 | "Sellwood", 4 | "Hawthorne", 5 | "The Pearl", 6 | "Eastmoreland", 7 | "St. Johns", 8 | "Alberta", 9 | "Nob Hill", 10 | "Belmont" 11 | ], 12 | "WarehouseCosts": { 13 | "Sellwood": 80000.0, 14 | "Hawthorne": 90000.0, 15 | "The Pearl": 120000.0, 16 | "Eastmoreland": 90000.0, 17 | "St. Johns": 85000.0, 18 | "Alberta": 70000.0, 19 | "Nob Hill": 85000.0, 20 | "Belmont": 90000.0 21 | }, 22 | "WarehouseCapacity": { 23 | "Sellwood": 8000.0, 24 | "Hawthorne": 6000.0, 25 | "The Pearl": 12000.0, 26 | "Eastmoreland": 6000.0, 27 | "St. Johns": 7000.0, 28 | "Alberta": 9000.0, 29 | "Nob Hill": 6000.0, 30 | "Belmont": 9200.0 31 | }, 32 | "RoasterCosts": { 33 | "Sellwood": 150000.0, 34 | "Hawthorne": 100000.0, 35 | "The Pearl": 250000.0, 36 | "Eastmoreland": 120000.0, 37 | "St. Johns": 130000.0, 38 | "Alberta": 110000.0, 39 | "Nob Hill": 135000.0, 40 | "Belmont": 180000.0 41 | }, 42 | "RoasterCapacity": { 43 | "Sellwood": 12.0, 44 | "Hawthorne": 18.0, 45 | "The Pearl": 22.0, 46 | "Eastmoreland": 13.0, 47 | "St. Johns": 14.0, 48 | "Alberta": 10.0, 49 | "Nob Hill": 17.0, 50 | "Belmont": 12.0 51 | }, 52 | "MinWarehouseCapacity": 30000.0, 53 | "MinRoasterCapacity": 30.0 54 | } -------------------------------------------------------------------------------- /code/fsharp-workshop/Practice/Dotnet Interactive/Ex02_FarmModel.dib: -------------------------------------------------------------------------------- 1 | #!markdown 2 | 3 | # Farm Model 4 | 5 | #!markdown 6 | 7 | ## Import Flips 8 | 9 | Import Flips and open `System`, `Flips`, and `Flips.Types` 10 | 11 | #!fsharp 12 | 13 | // Import Flips 14 | 15 | #!markdown 16 | 17 | ## Import Modules 18 | 19 | #!fsharp 20 | 21 | // Open System, Flips, and Flips.Types 22 | 23 | #!markdown 24 | 25 | ## Step 1: Create the Decision Variables 26 | 27 | #!fsharp 28 | 29 | // Create decision variables for cows, pigs, and chickens 30 | 31 | #!markdown 32 | 33 | ## Step 2: Create the Objective 34 | 35 | #!fsharp 36 | 37 | // Create an objective expression 38 | 39 | // Create an objective 40 | 41 | #!markdown 42 | 43 | ## Step 3: Add Constraints 44 | 45 | #!fsharp 46 | 47 | // Add constraint for amount of Pasture 48 | 49 | // Add constraint for amount of Feed 50 | 51 | // Add constraint for amount of Labor 52 | 53 | #!markdown 54 | 55 | ## Step 4: Create the model 56 | 57 | #!fsharp 58 | 59 | // Create the model and add the constraints 60 | 61 | #!markdown 62 | 63 | ## Step 5: Create the Settings and Solve 64 | 65 | #!fsharp 66 | 67 | // Create the solver settings 68 | 69 | #!fsharp 70 | 71 | // Solve the model and save the results 72 | 73 | #!markdown 74 | 75 | ## Step 6: Print Results 76 | 77 | #!fsharp 78 | 79 | printfn "--Results--" 80 | // Print the results of the solver 81 | 82 | 83 | -------------------------------------------------------------------------------- /css/theme/source/simple.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple theme for reveal.js presentations, similar 3 | * to the default theme. The accent color is darkblue. 4 | * 5 | * This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed. 6 | * reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 7 | */ 8 | 9 | 10 | // Default mixins and settings ----------------- 11 | @import "../template/mixins"; 12 | @import "../template/settings"; 13 | // --------------------------------------------- 14 | 15 | 16 | 17 | // Include theme-specific fonts 18 | @import url(https://fonts.googleapis.com/css?family=News+Cycle:400,700); 19 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 20 | 21 | 22 | // Override theme settings (see ../template/settings.scss) 23 | $mainFont: 'Lato', sans-serif; 24 | $mainColor: #000; 25 | $headingFont: 'News Cycle', Impact, sans-serif; 26 | $headingColor: #000; 27 | $headingTextShadow: none; 28 | $headingTextTransform: none; 29 | $backgroundColor: #fff; 30 | $linkColor: #00008B; 31 | $linkColorHover: lighten( $linkColor, 20% ); 32 | $selectionBackgroundColor: rgba(0, 0, 0, 0.99); 33 | 34 | section.has-dark-background { 35 | &, h1, h2, h3, h4, h5, h6 { 36 | color: #fff; 37 | } 38 | } 39 | 40 | 41 | // Theme template ------------------------------ 42 | @import "../template/theme"; 43 | // --------------------------------------------- -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | reveal.js 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 | 21 |
23 |
24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /css/layout.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Layout helpers. 3 | */ 4 | 5 | // Stretch an element vertically based on available space 6 | .reveal .stretch, 7 | .reveal .r-stretch { 8 | max-width: none; 9 | max-height: none; 10 | } 11 | 12 | .reveal pre.stretch code, 13 | .reveal pre.r-stretch code { 14 | height: 100%; 15 | max-height: 100%; 16 | box-sizing: border-box; 17 | } 18 | 19 | // Stack multiple elements on top of each other 20 | .reveal .r-stack { 21 | display: grid; 22 | } 23 | 24 | .reveal .r-stack > * { 25 | grid-area: 1/1; 26 | margin: auto; 27 | } 28 | 29 | // Horizontal and vertical stacks 30 | .reveal .r-vstack, 31 | .reveal .r-hstack { 32 | display: flex; 33 | } 34 | 35 | .reveal .r-vstack { 36 | flex-direction: column; 37 | align-items: center; 38 | justify-content: center; 39 | } 40 | 41 | .reveal .r-hstack { 42 | flex-direction: row; 43 | align-items: center; 44 | justify-content: center; 45 | } 46 | 47 | // Naming based on tailwindcss 48 | .reveal .items-stretch { align-items: stretch; } 49 | .reveal .items-start { align-items: flex-start; } 50 | .reveal .items-center { align-items: center; } 51 | .reveal .items-end { align-items: flex-end; } 52 | 53 | .reveal .justify-between { justify-content: space-between; } 54 | .reveal .justify-around { justify-content: space-around; } 55 | .reveal .justify-start { justify-content: flex-start; } 56 | .reveal .justify-center { justify-content: center; } 57 | .reveal .justify-end { justify-content: flex-end; } 58 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.Tests/CoffeePlanning.Tests.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | false 7 | false 8 | AnyCPU;x64 9 | 10 | 11 | 12 | NU1701; 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | runtime; build; native; contentfiles; analyzers; buildtransitive 26 | all 27 | 28 | 29 | runtime; build; native; contentfiles; analyzers; buildtransitive 30 | all 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /css/theme/source/moon.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Solarized Dark theme for reveal.js. 3 | * Author: Achim Staebler 4 | */ 5 | 6 | 7 | // Default mixins and settings ----------------- 8 | @import "../template/mixins"; 9 | @import "../template/settings"; 10 | // --------------------------------------------- 11 | 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(fonts/league-gothic/league-gothic.css); 16 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 17 | 18 | /** 19 | * Solarized colors by Ethan Schoonover 20 | */ 21 | html * { 22 | color-profile: sRGB; 23 | rendering-intent: auto; 24 | } 25 | 26 | // Solarized colors 27 | $base03: #002b36; 28 | $base02: #073642; 29 | $base01: #586e75; 30 | $base00: #657b83; 31 | $base0: #839496; 32 | $base1: #93a1a1; 33 | $base2: #eee8d5; 34 | $base3: #fdf6e3; 35 | $yellow: #b58900; 36 | $orange: #cb4b16; 37 | $red: #dc322f; 38 | $magenta: #d33682; 39 | $violet: #6c71c4; 40 | $blue: #268bd2; 41 | $cyan: #2aa198; 42 | $green: #859900; 43 | 44 | // Override theme settings (see ../template/settings.scss) 45 | $mainColor: $base1; 46 | $headingColor: $base2; 47 | $headingTextShadow: none; 48 | $backgroundColor: $base03; 49 | $linkColor: $blue; 50 | $linkColorHover: lighten( $linkColor, 20% ); 51 | $selectionBackgroundColor: $magenta; 52 | 53 | 54 | 55 | // Theme template ------------------------------ 56 | @import "../template/theme"; 57 | // --------------------------------------------- 58 | -------------------------------------------------------------------------------- /code/python-workshop/Solutions/.ipynb_checkpoints/result-checkpoint.csv: -------------------------------------------------------------------------------- 1 | option_id,loan_number,is_high_balance,loan_balance,execution_price,is_relo,is_coop,pool_id,revenue,decision 2 | 1234567,58425820711,0,69440.0,102.082373,0,0,A,70885.9998112,0.0 3 | 1234568,58435038740,1,131191.2,103.214961,0,0,A,135408.945915432,0.0 4 | 1234569,58449246915,0,137984.0,101.822916,1,0,A,140499.33241344002,0.0 5 | 1234570,58415554870,0,122046.4,103.36101500000001,0,1,A,126148.39781096,0.0 6 | 1234571,58434199858,0,117600.0,102.369331,0,0,A,120386.333256,0.0 7 | 1234572,58426935214,0,136640.0,102.369331,0,0,A,139877.4538784,0.0 8 | 1234573,58446388314,0,100800.0,102.301866,0,0,A,103120.28092800001,0.0 9 | 1234574,58431567170,0,101645.6,103.100528,0,0,A,104797.150288768,0.0 10 | 1234575,58444410993,0,170016.0,103.61346800000001,0,0,A,176159.47375488002,0.0 11 | 1234576,58425820711,0,69440.0,103.10319670000001,0,0,B,71594.85978848001,1.0 12 | 1234577,58435038740,1,131191.2,104.24711059999998,0,0,B,136763.0353614672,0.0 13 | 1234578,58449246915,0,137984.0,102.8411452,1,0,B,141904.325792768,0.0 14 | 1234579,58415554870,0,122046.4,104.3946252,0,1,B,127409.88185009279,0.0 15 | 1234580,58434199858,0,117600.0,103.39302430000001,0,0,B,121590.19657680001,1.0 16 | 1234581,58426935214,0,136640.0,103.39302430000001,0,0,B,141276.22840352,1.0 17 | 1234582,58446388314,0,100800.0,103.32488470000001,0,0,B,104151.4837776,1.0 18 | 1234583,58431567170,0,101645.6,104.1315333,0,0,B,105845.12181198482,1.0 19 | 1234584,58444410993,0,170016.0,104.6496027,0,0,B,177921.068526432,1.0 20 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Practice/01-FoodCart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Google.OrTools.LinearSolver; 3 | 4 | 5 | namespace Practice 6 | { 7 | public class FoodCart 8 | { 9 | public static void Solve() 10 | { 11 | var solver = Solver.CreateSolver("FoodCart", "GLOP_LINEAR_PROGRAMMING"); 12 | 13 | var numberOfHamburgers = solver.MakeNumVar(0.0, Double.MaxValue, "X1"); 14 | var numberOfTacos = solver.MakeNumVar(0.0, Double.MaxValue, "X2"); 15 | 16 | var objExpr = 1.0 * numberOfHamburgers + 1.5 * numberOfTacos; 17 | solver.Maximize(objExpr); 18 | 19 | var maxHamburgers = numberOfHamburgers <= 300.0; 20 | solver.Add(maxHamburgers); 21 | 22 | var maxTacos = numberOfTacos <= 200.0; 23 | solver.Add(maxTacos); 24 | 25 | var maxWeight = 1.5 * numberOfTacos + 1.0 * numberOfHamburgers <= 450.0; 26 | solver.Add(maxWeight); 27 | 28 | // Solve the problem 29 | var resultStatus = solver.Solve(); 30 | 31 | // Evaluate the solve status 32 | if (resultStatus != Solver.ResultStatus.OPTIMAL) 33 | { 34 | Console.WriteLine("The problem does not have an optimal solution!"); 35 | return; 36 | } 37 | 38 | // Print the results 39 | Console.WriteLine("Solution:"); 40 | Console.WriteLine("Objective value = " + solver.Objective().Value()); 41 | foreach (var variable in solver.variables()) 42 | { 43 | Console.WriteLine($"{variable.Name()} = {variable.SolutionValue()}"); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Solutions/01-FoodCart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Google.OrTools.LinearSolver; 3 | 4 | 5 | namespace Solutions 6 | { 7 | public class FoodCart 8 | { 9 | public static void Solve() 10 | { 11 | var solver = Solver.CreateSolver("FoodCart", "GLOP_LINEAR_PROGRAMMING"); 12 | 13 | var numberOfHamburgers = solver.MakeNumVar(0.0, Double.MaxValue, "X1"); 14 | var numberOfTacos = solver.MakeNumVar(0.0, Double.MaxValue, "X2"); 15 | 16 | var objExpr = 1.0 * numberOfHamburgers + 1.5 * numberOfTacos; 17 | solver.Maximize(objExpr); 18 | 19 | var maxHamburgers = numberOfHamburgers <= 300.0; 20 | solver.Add(maxHamburgers); 21 | 22 | var maxTacos = numberOfTacos <= 200.0; 23 | solver.Add(maxTacos); 24 | 25 | var maxWeight = 1.5 * numberOfTacos + 1.0 * numberOfHamburgers <= 450.0; 26 | solver.Add(maxWeight); 27 | 28 | // Solve the problem 29 | var resultStatus = solver.Solve(); 30 | 31 | // Evaluate the solve status 32 | if (resultStatus != Solver.ResultStatus.OPTIMAL) 33 | { 34 | Console.WriteLine("The problem does not have an optimal solution!"); 35 | return; 36 | } 37 | 38 | // Print the results 39 | Console.WriteLine("Solution:"); 40 | Console.WriteLine("Objective value = " + solver.Objective().Value()); 41 | foreach(var variable in solver.variables()) 42 | { 43 | Console.WriteLine($"{variable.Name()} = {variable.SolutionValue()}"); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /dist/theme/fonts/source-sans-pro/source-sans-pro.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Source Sans Pro'; 3 | src: url('source-sans-pro-regular.eot'); 4 | src: url('source-sans-pro-regular.eot?#iefix') format('embedded-opentype'), 5 | url('source-sans-pro-regular.woff') format('woff'), 6 | url('source-sans-pro-regular.ttf') format('truetype'); 7 | font-weight: normal; 8 | font-style: normal; 9 | } 10 | 11 | @font-face { 12 | font-family: 'Source Sans Pro'; 13 | src: url('source-sans-pro-italic.eot'); 14 | src: url('source-sans-pro-italic.eot?#iefix') format('embedded-opentype'), 15 | url('source-sans-pro-italic.woff') format('woff'), 16 | url('source-sans-pro-italic.ttf') format('truetype'); 17 | font-weight: normal; 18 | font-style: italic; 19 | } 20 | 21 | @font-face { 22 | font-family: 'Source Sans Pro'; 23 | src: url('source-sans-pro-semibold.eot'); 24 | src: url('source-sans-pro-semibold.eot?#iefix') format('embedded-opentype'), 25 | url('source-sans-pro-semibold.woff') format('woff'), 26 | url('source-sans-pro-semibold.ttf') format('truetype'); 27 | font-weight: 600; 28 | font-style: normal; 29 | } 30 | 31 | @font-face { 32 | font-family: 'Source Sans Pro'; 33 | src: url('source-sans-pro-semibolditalic.eot'); 34 | src: url('source-sans-pro-semibolditalic.eot?#iefix') format('embedded-opentype'), 35 | url('source-sans-pro-semibolditalic.woff') format('woff'), 36 | url('source-sans-pro-semibolditalic.ttf') format('truetype'); 37 | font-weight: 600; 38 | font-style: italic; 39 | } -------------------------------------------------------------------------------- /plugin/math/math.esm.js: -------------------------------------------------------------------------------- 1 | function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(n){for(var r=1;r i, float i] |> Map.ofList 7 | let d1 = DecisionBuilder "Test" { 8 | for index in indices -> Boolean 9 | } |> Map 10 | 11 | // What we have to do to take the product of Map values 12 | let sum1 = List.sum [for i in indices -> m1.[i] * d1.[i]] 13 | 14 | 15 | 16 | 17 | 18 | 19 | // What if we had a different data structure? 20 | 21 | open Flips.SliceMap 22 | 23 | let sm1 = SMap [for i in indices -> i, float i] 24 | let sm2 = DecisionBuilder "Test" { 25 | for index in indices -> Boolean 26 | } |> SMap 27 | 28 | let sm3 = sum (sm1 .* sm2) 29 | 30 | // The Hadamard Product 31 | // https://en.wikipedia.org/wiki/Hadamard_product_(matrices) 32 | 33 | 34 | // SliceMaps also support slicing 35 | let cities = ["A"; "B"; "C"] 36 | let items = [1; 2; 3] 37 | 38 | let itemCost = [ 39 | "A", 1.0 40 | "B", 1.5 41 | "C", 3.0 42 | "D", 2.3 43 | "E", 3.7 44 | ] 45 | 46 | let sm4 = SMap itemCost 47 | sm4.["A"] // You can retrieve an item 48 | sm4.[GreaterThan "A"] // You can slice 49 | sm4.[Between ("B", "D")] // Subslicing 50 | 51 | // More than 1 dimension 52 | let itemLocationCost = [ 53 | ("A", "Location1"), 1.0 54 | ("B", "Location1"), 1.5 55 | ("C", "Location1"), 3.0 56 | ("A", "Location2"), 2.0 57 | ("B", "Location2"), 4.5 58 | ("C", "Location2"), 1.0 59 | ] 60 | 61 | let sm5 = SMap2 itemLocationCost 62 | sm5.["A", All] // Two dimensional slicing 63 | sm5.[All, "Location2"] 64 | sm5.[GreaterOrEqual "B", LessThan "Location2"] 65 | 66 | // Up to 5 dimensions -------------------------------------------------------------------------------- /js/index.js: -------------------------------------------------------------------------------- 1 | import Deck, { VERSION } from './reveal.js' 2 | 3 | /** 4 | * Expose the Reveal class to the window. To create a 5 | * new instance: 6 | * let deck = new Reveal( document.querySelector( '.reveal' ), { 7 | * controls: false 8 | * } ); 9 | * deck.initialize().then(() => { 10 | * // reveal.js is ready 11 | * }); 12 | */ 13 | let Reveal = Deck; 14 | 15 | 16 | /** 17 | * The below is a thin shell that mimics the pre 4.0 18 | * reveal.js API and ensures backwards compatibility. 19 | * This API only allows for one Reveal instance per 20 | * page, whereas the new API above lets you run many 21 | * presentations on the same page. 22 | * 23 | * Reveal.initialize( { controls: false } ).then(() => { 24 | * // reveal.js is ready 25 | * }); 26 | */ 27 | 28 | let enqueuedAPICalls = []; 29 | 30 | Reveal.initialize = options => { 31 | 32 | // Create our singleton reveal.js instance 33 | Object.assign( Reveal, new Deck( document.querySelector( '.reveal' ), options ) ); 34 | 35 | // Invoke any enqueued API calls 36 | enqueuedAPICalls.map( method => method( Reveal ) ); 37 | 38 | return Reveal.initialize(); 39 | 40 | } 41 | 42 | /** 43 | * The pre 4.0 API let you add event listener before 44 | * initializing. We maintain the same behavior by 45 | * queuing up premature API calls and invoking all 46 | * of them when Reveal.initialize is called. 47 | */ 48 | [ 'configure', 'on', 'off', 'addEventListener', 'removeEventListener', 'registerPlugin' ].forEach( method => { 49 | Reveal[method] = ( ...args ) => { 50 | enqueuedAPICalls.push( deck => deck[method].call( null, ...args ) ); 51 | } 52 | } ); 53 | 54 | Reveal.isReady = () => false; 55 | 56 | Reveal.VERSION = VERSION; 57 | 58 | export default Reveal; -------------------------------------------------------------------------------- /css/theme/template/mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin vertical-gradient( $top, $bottom ) { 2 | background: $top; 3 | background: -moz-linear-gradient( top, $top 0%, $bottom 100% ); 4 | background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,$top), color-stop(100%,$bottom) ); 5 | background: -webkit-linear-gradient( top, $top 0%, $bottom 100% ); 6 | background: -o-linear-gradient( top, $top 0%, $bottom 100% ); 7 | background: -ms-linear-gradient( top, $top 0%, $bottom 100% ); 8 | background: linear-gradient( top, $top 0%, $bottom 100% ); 9 | } 10 | 11 | @mixin horizontal-gradient( $top, $bottom ) { 12 | background: $top; 13 | background: -moz-linear-gradient( left, $top 0%, $bottom 100% ); 14 | background: -webkit-gradient( linear, left top, right top, color-stop(0%,$top), color-stop(100%,$bottom) ); 15 | background: -webkit-linear-gradient( left, $top 0%, $bottom 100% ); 16 | background: -o-linear-gradient( left, $top 0%, $bottom 100% ); 17 | background: -ms-linear-gradient( left, $top 0%, $bottom 100% ); 18 | background: linear-gradient( left, $top 0%, $bottom 100% ); 19 | } 20 | 21 | @mixin radial-gradient( $outer, $inner, $type: circle ) { 22 | background: $outer; 23 | background: -moz-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 24 | background: -webkit-gradient( radial, center center, 0px, center center, 100%, color-stop(0%,$inner), color-stop(100%,$outer) ); 25 | background: -webkit-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 26 | background: -o-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 27 | background: -ms-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 28 | background: radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 29 | } -------------------------------------------------------------------------------- /plugin/math/math.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealMath=t()}(this,(function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(n){for(var r=1;r Model.addConstraint maxPasture 30 | |> Model.addConstraint maxFeed 31 | |> Model.addConstraint maxLabor 32 | 33 | 34 | // Create the solver settings 35 | let settings = { 36 | SolverType = SolverType.CBC 37 | MaxDuration = 10_000L 38 | WriteLPFile = None 39 | } 40 | 41 | // Solve the model and save the results 42 | let result = Solver.solve settings model 43 | 44 | printfn "--Results--" 45 | // Print the results of the solver 46 | match result with 47 | | Optimal solution -> 48 | printfn "Objective Value: %f" solution.ObjectiveResult 49 | 50 | for (decision, value) in solution.DecisionResults |> Map.toSeq do 51 | let (DecisionName name) = decision.Name 52 | printfn "Decision: %s\tValue: %f" name value 53 | | _ -> printfn "Unable to solve." -------------------------------------------------------------------------------- /js/utils/color.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Converts various color input formats to an {r:0,g:0,b:0} object. 3 | * 4 | * @param {string} color The string representation of a color 5 | * @example 6 | * colorToRgb('#000'); 7 | * @example 8 | * colorToRgb('#000000'); 9 | * @example 10 | * colorToRgb('rgb(0,0,0)'); 11 | * @example 12 | * colorToRgb('rgba(0,0,0)'); 13 | * 14 | * @return {{r: number, g: number, b: number, [a]: number}|null} 15 | */ 16 | export const colorToRgb = ( color ) => { 17 | 18 | let hex3 = color.match( /^#([0-9a-f]{3})$/i ); 19 | if( hex3 && hex3[1] ) { 20 | hex3 = hex3[1]; 21 | return { 22 | r: parseInt( hex3.charAt( 0 ), 16 ) * 0x11, 23 | g: parseInt( hex3.charAt( 1 ), 16 ) * 0x11, 24 | b: parseInt( hex3.charAt( 2 ), 16 ) * 0x11 25 | }; 26 | } 27 | 28 | let hex6 = color.match( /^#([0-9a-f]{6})$/i ); 29 | if( hex6 && hex6[1] ) { 30 | hex6 = hex6[1]; 31 | return { 32 | r: parseInt( hex6.substr( 0, 2 ), 16 ), 33 | g: parseInt( hex6.substr( 2, 2 ), 16 ), 34 | b: parseInt( hex6.substr( 4, 2 ), 16 ) 35 | }; 36 | } 37 | 38 | let rgb = color.match( /^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i ); 39 | if( rgb ) { 40 | return { 41 | r: parseInt( rgb[1], 10 ), 42 | g: parseInt( rgb[2], 10 ), 43 | b: parseInt( rgb[3], 10 ) 44 | }; 45 | } 46 | 47 | let rgba = color.match( /^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\,\s*([\d]+|[\d]*.[\d]+)\s*\)$/i ); 48 | if( rgba ) { 49 | return { 50 | r: parseInt( rgba[1], 10 ), 51 | g: parseInt( rgba[2], 10 ), 52 | b: parseInt( rgba[3], 10 ), 53 | a: parseFloat( rgba[4] ) 54 | }; 55 | } 56 | 57 | return null; 58 | 59 | } 60 | 61 | /** 62 | * Calculates brightness on a scale of 0-255. 63 | * 64 | * @param {string} color See colorToRgb for supported formats. 65 | * @see {@link colorToRgb} 66 | */ 67 | export const colorBrightness = ( color ) => { 68 | 69 | if( typeof color === 'string' ) color = colorToRgb( color ); 70 | 71 | if( color ) { 72 | return ( color.r * 299 + color.g * 587 + color.b * 114 ) / 1000; 73 | } 74 | 75 | return null; 76 | 77 | } -------------------------------------------------------------------------------- /code/fsharp-visualstudio/Solutions/01-FoodTruck.fs: -------------------------------------------------------------------------------- 1 | module Solutions.FoodTruck 2 | 3 | open Flips 4 | open Flips.Types 5 | 6 | let solve () = 7 | 8 | // Create a decision variable for the number of burgers below 9 | let numberOfHamburgers = Decision.createContinuous "NumberOfHamburgers" 0.0 infinity 10 | 11 | // Create a decision variable for the number of tacos below 12 | let numberOfTacos = Decision.createContinuous "NumberOfTacos" 0.0 infinity 13 | 14 | // Create an objective expression here 15 | let objectiveExpression = 2.0 * numberOfHamburgers + 1.0 * numberOfTacos 16 | 17 | // Create an objective here 18 | let objective = 19 | Objective.create "MaximizeRevenue" Maximize objectiveExpression 20 | 21 | // Create a constraint for the max number of Burgers 22 | let maxBurgers = 23 | Constraint.create "MaxBurgers" (numberOfHamburgers <== 300.0) 24 | 25 | // Create a constraint for the max number of Tacos 26 | let maxTacos = 27 | Constraint.create "MaxTacos" (numberOfTacos <== 200.0) 28 | 29 | // Create a constraint for the total weight 30 | let maxWeight = 31 | Constraint.create "MaxWeight" ((1.5*numberOfTacos+1.0*numberOfHamburgers) <== 450.0) 32 | 33 | 34 | // Create the model below 35 | let model = 36 | Model.create objective 37 | |> Model.addConstraint maxBurgers 38 | |> Model.addConstraint maxTacos 39 | |> Model.addConstraint maxWeight 40 | 41 | 42 | let settings = { 43 | SolverType = SolverType.CBC 44 | MaxDuration = 10_000L 45 | WriteLPFile = None 46 | } 47 | 48 | // Store result of solved model below 49 | let result = Solver.solve settings model 50 | 51 | 52 | printfn "--Result--" 53 | 54 | // Print the results of the solver below 55 | match result with 56 | | Optimal solution -> 57 | printfn "Objective Value: %f" solution.ObjectiveResult 58 | 59 | for (decision, value) in solution.DecisionResults |> Map.toSeq do 60 | let (DecisionName name) = decision.Name 61 | printfn "Decision: %s\tValue: %f" name value 62 | | _ -> printfn "Unable to solve." -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning/Domain.fs: -------------------------------------------------------------------------------- 1 | namespace CoffeePlanning 2 | 3 | open Flips.SliceMap 4 | open System.Collections.Generic 5 | 6 | // A type for external use. Typically easily maps to JSON 7 | type Config = { 8 | Locations : array 9 | WarehouseCosts : Dictionary 10 | WarehouseCapacity : Dictionary 11 | RoasterCosts : Dictionary 12 | RoasterCapacity : Dictionary 13 | MinWarehouseCapacity : float 14 | MinRoasterCapacity : float 15 | } 16 | 17 | // The type returned to external users 18 | type Plan = { 19 | SelectedWarehouses : array 20 | SelectedRoasters : array 21 | TotalCost : float 22 | } 23 | 24 | module internal Domain = 25 | 26 | type Location = Location of string 27 | 28 | type Parameters = { 29 | Locations : Location list 30 | WarehouseCosts : SMap 31 | WarehouseCapacity : SMap 32 | RoasterCosts : SMap 33 | RoasterCapacity : SMap 34 | MinWarehouseCapacity : float 35 | MinRoasterCapacity : float 36 | } 37 | 38 | module Parameters = 39 | 40 | let ofConfig (c:Config) = 41 | // This is where data validation would occur to make sure the Config data makes sense 42 | { 43 | Locations = c.Locations |> Seq.map Location |> List.ofSeq 44 | WarehouseCosts = c.WarehouseCosts :> seq<_> |> Seq.map (|KeyValue|) |> Seq.map (fun (k, v) -> Location k, v) |> SMap 45 | WarehouseCapacity = c.WarehouseCapacity :> seq<_> |> Seq.map (|KeyValue|) |> Seq.map (fun (k, v) -> Location k, v) |> SMap 46 | RoasterCosts = c.RoasterCosts :> seq<_> |> Seq.map (|KeyValue|) |> Seq.map (fun (k, v) -> Location k, v) |> SMap 47 | RoasterCapacity = c.RoasterCapacity :> seq<_> |> Seq.map (|KeyValue|) |> Seq.map (fun (k, v) -> Location k, v) |> SMap 48 | MinWarehouseCapacity = c.MinWarehouseCapacity 49 | MinRoasterCapacity = c.MinRoasterCapacity 50 | } 51 | -------------------------------------------------------------------------------- /css/theme/source/blood.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Blood theme for reveal.js 3 | * Author: Walther http://github.com/Walther 4 | * 5 | * Designed to be used with highlight.js theme 6 | * "monokai_sublime.css" available from 7 | * https://github.com/isagalaev/highlight.js/ 8 | * 9 | * For other themes, change $codeBackground accordingly. 10 | * 11 | */ 12 | 13 | // Default mixins and settings ----------------- 14 | @import "../template/mixins"; 15 | @import "../template/settings"; 16 | // --------------------------------------------- 17 | 18 | // Include theme-specific fonts 19 | 20 | @import url(https://fonts.googleapis.com/css?family=Ubuntu:300,700,300italic,700italic); 21 | 22 | // Colors used in the theme 23 | $blood: #a23; 24 | $coal: #222; 25 | $codeBackground: #23241f; 26 | 27 | $backgroundColor: $coal; 28 | 29 | // Main text 30 | $mainFont: Ubuntu, 'sans-serif'; 31 | $mainColor: #eee; 32 | 33 | // Headings 34 | $headingFont: Ubuntu, 'sans-serif'; 35 | $headingTextShadow: 2px 2px 2px $coal; 36 | 37 | // h1 shadow, borrowed humbly from 38 | // (c) Default theme by Hakim El Hattab 39 | $heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15); 40 | 41 | // Links 42 | $linkColor: $blood; 43 | $linkColorHover: lighten( $linkColor, 20% ); 44 | 45 | // Text selection 46 | $selectionBackgroundColor: $blood; 47 | $selectionColor: #fff; 48 | 49 | 50 | // Theme template ------------------------------ 51 | @import "../template/theme"; 52 | // --------------------------------------------- 53 | 54 | // some overrides after theme template import 55 | 56 | .reveal p { 57 | font-weight: 300; 58 | text-shadow: 1px 1px $coal; 59 | } 60 | 61 | .reveal h1, 62 | .reveal h2, 63 | .reveal h3, 64 | .reveal h4, 65 | .reveal h5, 66 | .reveal h6 { 67 | font-weight: 700; 68 | } 69 | 70 | .reveal p code { 71 | background-color: $codeBackground; 72 | display: inline-block; 73 | border-radius: 7px; 74 | } 75 | 76 | .reveal small code { 77 | vertical-align: baseline; 78 | } -------------------------------------------------------------------------------- /code/fsharp-visualstudio/Practice/03-RevisedFarmModel.fs: -------------------------------------------------------------------------------- 1 | module Practice.RevisedFarmModel 2 | 3 | open Flips 4 | open Flips.Types 5 | 6 | let solve () = 7 | 8 | // Define the set of animals you are working with 9 | let animals = ["cows"; "pigs"; "chickens"] 10 | 11 | // Dictionary of Revenue indexed by Animal Type 12 | let revenue = ["cows", 100.0; "pigs", 50.0; "chickens", 8.0] |> Map.ofList 13 | 14 | // Dictionary of Pasture required per animal indexed by Animal Type 15 | let pasture = ["cows",1.0; "pigs",0.5; "chickens",0.0] |> Map.ofList 16 | 17 | // Dictionary of Feed required per animal indexed by Animal Type 18 | let feed = ["cows",0.0; "pigs",1.0; "chickens",0.1] |> Map.ofList 19 | 20 | // Dictionary of the Labor required per animal indexed by Animal Type 21 | let labor = ["cows",9.5; "pigs",8.0; "chickens",0.0] |> Map.ofList 22 | 23 | // Constants which determine the limits on our resources 24 | let totalPasture = 1000.0 25 | let totalFeed = 100.0 26 | let totalLabor = 7200.0 27 | 28 | 29 | // Create decision variables for all of the animals 30 | 31 | 32 | // Create an objective expression 33 | 34 | 35 | // Create the objective 36 | 37 | 38 | // Add the constraint for the total amount of pasture available 39 | 40 | 41 | // Add the constraint for the total amount of feed available 42 | 43 | 44 | // Add the constraint for the total amount of labor available 45 | 46 | 47 | // Create the model and add the constraints 48 | 49 | 50 | // Create the solver settings 51 | let settings = { 52 | SolverType = SolverType.CBC 53 | MaxDuration = 10_000L 54 | WriteLPFile = None 55 | } 56 | 57 | // Solve the model and save the result 58 | 59 | printfn "--Results--" 60 | 61 | // Print the results of the solver 62 | //match result with 63 | //| Optimal solution -> 64 | // printfn "Objective Value: %f" solution.ObjectiveResult 65 | // for (decision, value) in solution.DecisionResults |> Map.toSeq do 66 | // let (DecisionName name) = decision.Name 67 | // printfn "Decision: %s\tValue: %f" name value 68 | //| _ -> printfn "Unable to solve." -------------------------------------------------------------------------------- /code/csharp-visualstudio/Practice/03-RevisedFoodModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Google.OrTools.LinearSolver; 5 | 6 | namespace Practice 7 | { 8 | public class RevisedFarmModel 9 | { 10 | public static void Solve() 11 | { 12 | var animals = new List 13 | { 14 | "cow", "pig", "chicken" 15 | }; 16 | 17 | var revenue = new Dictionary() 18 | { 19 | { "cow", 100.0 }, {"pig", 50.0 }, {"chicken", 8.0 } 20 | }; 21 | 22 | var pasture = new Dictionary() 23 | { 24 | { "cow", 1.0 }, {"pig", 0.5 }, {"chicken", 0.0 } 25 | }; 26 | 27 | var feed = new Dictionary() 28 | { 29 | { "cow", 0.0 }, {"pig", 1.0 }, {"chicken", 0.1 } 30 | }; 31 | 32 | var labor = new Dictionary() 33 | { 34 | { "cow", 9.5 }, {"pig", 8.0 }, {"chicken", 0.0 } 35 | }; 36 | 37 | var totalPasture = 1000.0; 38 | var totalFeed = 100.0; 39 | var totalLabor = 7200.0; 40 | 41 | // Create an instance of the Solver class 42 | var solver = Solver.CreateSolver("FarmModel", "GLOP_LINEAR_PROGRAMMING"); 43 | 44 | // Create variables for each type of Anaimal 45 | 46 | 47 | // Create expression for Revenue 48 | 49 | 50 | // Add the expression to the solver 51 | 52 | 53 | // Create constraint for Pasture 54 | 55 | 56 | // Create constraint for the Feed 57 | 58 | 59 | // Create constraint for the Labor 60 | 61 | 62 | // Solve the problem 63 | 64 | 65 | //// Evaluate the solve status 66 | //if (resultStatus != Solver.ResultStatus.OPTIMAL) 67 | //{ 68 | // Console.WriteLine("The problem does not have an optimal solution!"); 69 | // return; 70 | //} 71 | 72 | //// Print the results 73 | //Console.WriteLine("Solution:"); 74 | //Console.WriteLine("Objective value = " + solver.Objective().Value()); 75 | //foreach (var variable in solver.variables()) 76 | //{ 77 | // Console.WriteLine($"{variable.Name()} = {variable.SolutionValue()}"); 78 | //} 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /js/controllers/progress.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Creates a visual progress bar for the presentation. 3 | */ 4 | export default class Progress { 5 | 6 | constructor( Reveal ) { 7 | 8 | this.Reveal = Reveal; 9 | 10 | this.onProgressClicked = this.onProgressClicked.bind( this ); 11 | 12 | } 13 | 14 | render() { 15 | 16 | this.element = document.createElement( 'div' ); 17 | this.element.className = 'progress'; 18 | this.Reveal.getRevealElement().appendChild( this.element ); 19 | 20 | this.bar = document.createElement( 'span' ); 21 | this.element.appendChild( this.bar ); 22 | 23 | } 24 | 25 | /** 26 | * Called when the reveal.js config is updated. 27 | */ 28 | configure( config, oldConfig ) { 29 | 30 | this.element.style.display = config.progress ? 'block' : 'none'; 31 | 32 | } 33 | 34 | bind() { 35 | 36 | if( this.Reveal.getConfig().progress && this.element ) { 37 | this.element.addEventListener( 'click', this.onProgressClicked, false ); 38 | } 39 | 40 | } 41 | 42 | unbind() { 43 | 44 | if ( this.Reveal.getConfig().progress && this.element ) { 45 | this.element.removeEventListener( 'click', this.onProgressClicked, false ); 46 | } 47 | 48 | } 49 | 50 | /** 51 | * Updates the progress bar to reflect the current slide. 52 | */ 53 | update() { 54 | 55 | // Update progress if enabled 56 | if( this.Reveal.getConfig().progress && this.bar ) { 57 | 58 | this.bar.style.transform = 'scaleX('+ this.Reveal.getProgress() +')'; 59 | 60 | } 61 | 62 | } 63 | 64 | getMaxWidth() { 65 | 66 | return this.Reveal.getRevealElement().offsetWidth; 67 | 68 | } 69 | 70 | /** 71 | * Clicking on the progress bar results in a navigation to the 72 | * closest approximate horizontal slide using this equation: 73 | * 74 | * ( clickX / presentationWidth ) * numberOfSlides 75 | * 76 | * @param {object} event 77 | */ 78 | onProgressClicked( event ) { 79 | 80 | this.Reveal.onUserInput( event ); 81 | 82 | event.preventDefault(); 83 | 84 | let slidesTotal = this.Reveal.getHorizontalSlides().length; 85 | let slideIndex = Math.floor( ( event.clientX / this.getMaxWidth() ) * slidesTotal ); 86 | 87 | if( this.Reveal.getConfig().rtl ) { 88 | slideIndex = slidesTotal - slideIndex; 89 | } 90 | 91 | this.Reveal.slide( slideIndex ); 92 | 93 | } 94 | 95 | 96 | } -------------------------------------------------------------------------------- /js/controllers/focus.js: -------------------------------------------------------------------------------- 1 | import { closest } from '../utils/util.js' 2 | 3 | /** 4 | * Manages focus when a presentation is embedded. This 5 | * helps us only capture keyboard from the presentation 6 | * a user is currently interacting with in a page where 7 | * multiple presentations are embedded. 8 | */ 9 | 10 | const STATE_FOCUS = 'focus'; 11 | const STATE_BLUR = 'blur'; 12 | 13 | export default class Focus { 14 | 15 | constructor( Reveal ) { 16 | 17 | this.Reveal = Reveal; 18 | 19 | this.onRevealPointerDown = this.onRevealPointerDown.bind( this ); 20 | this.onDocumentPointerDown = this.onDocumentPointerDown.bind( this ); 21 | 22 | } 23 | 24 | /** 25 | * Called when the reveal.js config is updated. 26 | */ 27 | configure( config, oldConfig ) { 28 | 29 | if( config.embedded ) { 30 | this.blur(); 31 | } 32 | else { 33 | this.focus(); 34 | this.unbind(); 35 | } 36 | 37 | } 38 | 39 | bind() { 40 | 41 | if( this.Reveal.getConfig().embedded ) { 42 | this.Reveal.getRevealElement().addEventListener( 'pointerdown', this.onRevealPointerDown, false ); 43 | } 44 | 45 | } 46 | 47 | unbind() { 48 | 49 | this.Reveal.getRevealElement().removeEventListener( 'pointerdown', this.onRevealPointerDown, false ); 50 | document.removeEventListener( 'pointerdown', this.onDocumentPointerDown, false ); 51 | 52 | } 53 | 54 | focus() { 55 | 56 | if( this.state !== STATE_FOCUS ) { 57 | this.Reveal.getRevealElement().classList.add( 'focused' ); 58 | document.addEventListener( 'pointerdown', this.onDocumentPointerDown, false ); 59 | } 60 | 61 | this.state = STATE_FOCUS; 62 | 63 | } 64 | 65 | blur() { 66 | 67 | if( this.state !== STATE_BLUR ) { 68 | this.Reveal.getRevealElement().classList.remove( 'focused' ); 69 | document.removeEventListener( 'pointerdown', this.onDocumentPointerDown, false ); 70 | } 71 | 72 | this.state = STATE_BLUR; 73 | 74 | } 75 | 76 | isFocused() { 77 | 78 | return this.state === STATE_FOCUS; 79 | 80 | } 81 | 82 | onRevealPointerDown( event ) { 83 | 84 | this.focus(); 85 | 86 | } 87 | 88 | onDocumentPointerDown( event ) { 89 | 90 | let revealElement = closest( event.target, '.reveal' ); 91 | if( !revealElement || revealElement !== this.Reveal.getRevealElement() ) { 92 | this.blur(); 93 | } 94 | 95 | } 96 | 97 | } -------------------------------------------------------------------------------- /code/fsharp-workshop/Practice/Dotnet Interactive/Ex03_RevisedFarmModel.dib: -------------------------------------------------------------------------------- 1 | #!markdown 2 | 3 | # Revised Farm Model 4 | 5 | #!markdown 6 | 7 | ## Import Flips 8 | 9 | #!fsharp 10 | 11 | // Import Flips 12 | 13 | #!markdown 14 | 15 | ## Open Modules 16 | 17 | #!fsharp 18 | 19 | // Open System, Flips, and Flips.Types 20 | 21 | #!fsharp 22 | 23 | // Define the set of animals you are working with 24 | let animals = ["cows"; "pigs"; "chickens"] 25 | 26 | // Dictionary of Revenue indexed by Animal Type 27 | let revenue = ["cows", 100.0; "pigs", 50.0; "chickens", 8.0] |> Map.ofList 28 | 29 | // Dictionary of Pasture required per animal indexed by Animal Type 30 | let pasture = ["cows",1.0; "pigs",0.5; "chickens",0.0] |> Map.ofList 31 | 32 | // Dictionary of Feed required per animal indexed by Animal Type 33 | let feed = ["cows",0.0; "pigs",1.0; "chickens",0.1] |> Map.ofList 34 | 35 | // Dictionary of the Labor required per animal indexed by Animal Type 36 | let labor = ["cows",9.5; "pigs",8.0; "chickens",0.0] |> Map.ofList 37 | 38 | // Constants which determine the limits on our resources 39 | let total_pasture = 1000.0 40 | let total_feed = 100.0 41 | let total_labor = 7200.0 42 | 43 | #!markdown 44 | 45 | ## Step 1: Create the Decision Variables 46 | 47 | #!fsharp 48 | 49 | // Create decision variables for all of the animals 50 | 51 | #!markdown 52 | 53 | ## Step 2: Create the Objective 54 | 55 | #!fsharp 56 | 57 | // Create an objective expression 58 | 59 | 60 | // Create the objective 61 | 62 | #!markdown 63 | 64 | ## Step 3: Add Constraints 65 | 66 | #!fsharp 67 | 68 | // Add the constraint for the total amount of pasture available 69 | 70 | // Add the constraint for the total amount of feed available 71 | 72 | // Add the constraint for the total amount of labor available 73 | 74 | #!markdown 75 | 76 | ## Step 4: Create the Model 77 | 78 | #!fsharp 79 | 80 | // Create the model and add the constraints 81 | 82 | #!markdown 83 | 84 | ## Step 5: Create the Settings and Solve 85 | 86 | #!fsharp 87 | 88 | // Create the solver settings 89 | 90 | #!fsharp 91 | 92 | // Solve the model and save the result 93 | 94 | #!markdown 95 | 96 | ## Step 6: Print the Results 97 | 98 | #!fsharp 99 | 100 | printfn "--Results--" 101 | // Print the results of the solver 102 | 103 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning/Solve.fs: -------------------------------------------------------------------------------- 1 | namespace CoffeePlanning 2 | 3 | open Flips 4 | open Flips.Types 5 | open Flips.SliceMap 6 | open CoffeePlanning.Domain 7 | open CoffeePlanning.Model 8 | 9 | 10 | module Solve = 11 | 12 | /// A function for taking a solution and creating a Plan type to return 13 | let internal buildPlan 14 | (warehouseDecisions: SMap) 15 | (roasterDecisions: SMap) 16 | (solution:Solution) = 17 | 18 | let selectedWarehouses = 19 | Solution.getValues solution warehouseDecisions 20 | |> Map.toSeq 21 | |> Seq.filter (fun (_, decisionValue) -> decisionValue >= 1.0) 22 | |> Seq.map (fun (Location location, _) -> location) 23 | |> Array.ofSeq 24 | 25 | let selectedRoasters = 26 | Solution.getValues solution roasterDecisions 27 | |> Map.toSeq 28 | |> Seq.filter (fun (_, decisionValue) -> decisionValue >= 1.0) 29 | |> Seq.map (fun (Location location, _) -> location) 30 | |> Array.ofSeq 31 | 32 | let totalCost = solution.ObjectiveResult 33 | 34 | { 35 | SelectedRoasters = selectedRoasters 36 | SelectedWarehouses = selectedWarehouses 37 | TotalCost = totalCost 38 | } 39 | 40 | /// The one function that is exposed for external use 41 | let findPlan 42 | (config:Config) 43 | (maxDuration: int64) = 44 | 45 | let parameters = Parameters.ofConfig config 46 | 47 | let roasterDecisions = 48 | DecisionBuilder "BuildRoaster" { 49 | for location in parameters.Locations -> Boolean 50 | } |> SMap 51 | 52 | let warehouseDecisions = 53 | DecisionBuilder "BuildWarehouse" { 54 | for location in parameters.Locations -> Boolean 55 | } |> SMap 56 | 57 | let model = buildModel parameters warehouseDecisions roasterDecisions 58 | 59 | let settings = { 60 | SolverType = SolverType.CBC 61 | MaxDuration = maxDuration 62 | WriteLPFile = None 63 | } 64 | 65 | let result = Solver.solve settings model 66 | 67 | match result with 68 | | Optimal solution -> buildPlan warehouseDecisions roasterDecisions solution 69 | | _ -> failwith "Unable to solve model" 70 | 71 | 72 | -------------------------------------------------------------------------------- /plugin/math/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A plugin which enables rendering of math equations inside 3 | * of reveal.js slides. Essentially a thin wrapper for MathJax. 4 | * 5 | * @author Hakim El Hattab 6 | */ 7 | const Plugin = () => { 8 | 9 | // The reveal.js instance this plugin is attached to 10 | let deck; 11 | 12 | let defaultOptions = { 13 | messageStyle: 'none', 14 | tex2jax: { 15 | inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ], 16 | skipTags: [ 'script', 'noscript', 'style', 'textarea', 'pre' ] 17 | }, 18 | skipStartupTypeset: true 19 | }; 20 | 21 | function loadScript( url, callback ) { 22 | 23 | let head = document.querySelector( 'head' ); 24 | let script = document.createElement( 'script' ); 25 | script.type = 'text/javascript'; 26 | script.src = url; 27 | 28 | // Wrapper for callback to make sure it only fires once 29 | let finish = () => { 30 | if( typeof callback === 'function' ) { 31 | callback.call(); 32 | callback = null; 33 | } 34 | } 35 | 36 | script.onload = finish; 37 | 38 | // IE 39 | script.onreadystatechange = () => { 40 | if ( this.readyState === 'loaded' ) { 41 | finish(); 42 | } 43 | } 44 | 45 | // Normal browsers 46 | head.appendChild( script ); 47 | 48 | } 49 | 50 | return { 51 | id: 'math', 52 | 53 | init: function( reveal ) { 54 | 55 | deck = reveal; 56 | 57 | let revealOptions = deck.getConfig().math || {}; 58 | 59 | let options = { ...defaultOptions, ...revealOptions }; 60 | let mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js'; 61 | let config = options.config || 'TeX-AMS_HTML-full'; 62 | let url = mathjax + '?config=' + config; 63 | 64 | options.tex2jax = { ...defaultOptions.tex2jax, ...revealOptions.tex2jax }; 65 | 66 | options.mathjax = options.config = null; 67 | 68 | loadScript( url, function() { 69 | 70 | MathJax.Hub.Config( options ); 71 | 72 | // Typeset followed by an immediate reveal.js layout since 73 | // the typesetting process could affect slide height 74 | MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, deck.getRevealElement() ] ); 75 | MathJax.Hub.Queue( deck.layout ); 76 | 77 | // Reprocess equations in slides when they turn visible 78 | deck.on( 'slidechanged', function( event ) { 79 | 80 | MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] ); 81 | 82 | } ); 83 | 84 | } ); 85 | 86 | } 87 | } 88 | 89 | }; 90 | 91 | export default Plugin; 92 | -------------------------------------------------------------------------------- /code/fsharp-workshop/Practice/Dotnet Interactive/Ex05_PowerPlanningModel.dib: -------------------------------------------------------------------------------- 1 | #!markdown 2 | 3 | # Power Planning Model 4 | 5 | #!markdown 6 | 7 | ## Import Flips 8 | 9 | #!fsharp 10 | 11 | // Import Flips 12 | 13 | #!markdown 14 | 15 | ## Open Modules 16 | 17 | #!fsharp 18 | 19 | // Open System, Flips, and Flips.Types 20 | 21 | #!fsharp 22 | 23 | // Setup sets 24 | let cities = ["C1"; "C2"; "C3"; "C4"; "C5"; "C6"; "C7"; "C8"; "C9"] 25 | 26 | let powerPlants = ["P1"; "P2"; "P3"; "P4"; "P5"; "P6"] 27 | 28 | let connections = [ 29 | ("C1", "P1"); ("C1", "P3"); ("C1", "P5"); 30 | ("C2", "P1"); ("C2", "P2"); ("C2","P4"); 31 | ("C3", "P2"); ("C3", "P3"); ("C3","P4"); 32 | ("C4", "P2"); ("C4", "P4"); ("C4","P6"); 33 | ("C5", "P2"); ("C5", "P5"); ("C5","P6"); 34 | ("C6", "P3"); ("C6", "P4"); ("C6","P6"); 35 | ("C7", "P1"); ("C7", "P3"); ("C7","P6"); 36 | ("C8", "P2"); ("C8", "P3"); ("C8","P4"); 37 | ("C9", "P3"); ("C9", "P5"); ("C9","P6") 38 | ] 39 | 40 | // Setup parameters 41 | let maxPowerGeneration = ["P1", 100.0; "P2", 150.0; "P3", 250.0; "P4", 125.0; "P5", 175.0; "P6", 165.0] |> Map.ofSeq 42 | 43 | let startupCost = ["P1", 50.0; "P2", 80.0; "P3", 90.0; "P4", 60.0; "P5", 60.0; "P6", 70.0] |> Map.ofSeq 44 | 45 | let powerCost = ["P1", 2.0; "P2", 1.5; "P3", 1.2; "P4", 1.8; "P5", 0.8; "P6", 1.1] |> Map.ofSeq 46 | 47 | let powerRequired = ["C1", 25.0; "C2", 35.0; "C3", 30.0; "C4", 125.0; "C5", 40.0; "C6", 35.0; "C7", 50.0; "C8", 45.0; "C9", 38.0] |> Map.ofSeq 48 | 49 | #!markdown 50 | 51 | ## Step 1: Create Decision Variables 52 | 53 | #!fsharp 54 | 55 | // Create decision variables 56 | 57 | #!markdown 58 | 59 | ## Step 2: Create the Objective 60 | 61 | #!fsharp 62 | 63 | // Create an objective function 64 | 65 | // Create the Objective 66 | 67 | #!markdown 68 | 69 | ## Step 3: Add Constraints 70 | 71 | #!fsharp 72 | 73 | // Add Power Capacity Constraints 74 | 75 | // Add Power Balance Constraints 76 | 77 | 78 | // Add Cities Powered Constraints 79 | 80 | #!markdown 81 | 82 | ## Step 4: Create the Model 83 | 84 | #!fsharp 85 | 86 | // Create the model and add constraints 87 | 88 | #!markdown 89 | 90 | ## Step 5: Create the Settings and Solve 91 | 92 | #!fsharp 93 | 94 | // Create the solver settings 95 | 96 | 97 | // Solve the model and save the result 98 | 99 | #!markdown 100 | 101 | ## Step 6: Print the Results 102 | 103 | #!fsharp 104 | 105 | printfn "--Results--" 106 | // Print the results 107 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reveal.js", 3 | "version": "4.0.2", 4 | "description": "The HTML Presentation Framework", 5 | "homepage": "https://revealjs.com", 6 | "subdomain": "revealjs", 7 | "main": "dist/reveal.js", 8 | "module": "dist/reveal.esm.js", 9 | "license": "MIT", 10 | "scripts": { 11 | "test": "gulp test", 12 | "start": "gulp serve", 13 | "build": "gulp" 14 | }, 15 | "author": { 16 | "name": "Hakim El Hattab", 17 | "email": "hakim.elhattab@gmail.com", 18 | "web": "https://hakim.se" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git://github.com/hakimel/reveal.js.git" 23 | }, 24 | "engines": { 25 | "node": ">=10.0.0" 26 | }, 27 | "keywords": [ 28 | "reveal", 29 | "slides", 30 | "presentation" 31 | ], 32 | "devDependencies": { 33 | "@babel/core": "^7.9.6", 34 | "@babel/preset-env": "^7.9.6", 35 | "@rollup/plugin-babel": "^5.0.2", 36 | "@rollup/plugin-commonjs": "^12.0.0", 37 | "@rollup/plugin-node-resolve": "^8.0.0", 38 | "babel-eslint": "^10.1.0", 39 | "babel-plugin-transform-html-import-to-string": "0.0.1", 40 | "colors": "^1.4.0", 41 | "core-js": "^3.6.5", 42 | "glob": "^7.1.6", 43 | "gulp": "^4.0.2", 44 | "gulp-autoprefixer": "^7.0.1", 45 | "gulp-clean-css": "^4.2.0", 46 | "gulp-connect": "^5.7.0", 47 | "gulp-eslint": "^6.0.0", 48 | "gulp-header": "^2.0.9", 49 | "gulp-sass": "^4.0.2", 50 | "gulp-tap": "^2.0.0", 51 | "gulp-zip": "^5.0.1", 52 | "highlight.js": "^10.0.3", 53 | "marked": "^1.1.0", 54 | "node-qunit-puppeteer": "^2.0.1", 55 | "qunit": "^2.10.0", 56 | "rollup": "^2.10.9", 57 | "rollup-plugin-terser": "^5.3.0", 58 | "yargs": "^15.1.0" 59 | }, 60 | "browserslist": "> 0.5%, IE 11, not dead", 61 | "eslintConfig": { 62 | "env": { 63 | "browser": true, 64 | "es6": true 65 | }, 66 | "parser": "babel-eslint", 67 | "parserOptions": { 68 | "sourceType": "module", 69 | "allowImportExportEverywhere": true 70 | }, 71 | "globals": { 72 | "module": false, 73 | "console": false, 74 | "unescape": false, 75 | "define": false, 76 | "exports": false 77 | }, 78 | "rules": { 79 | "curly": 0, 80 | "eqeqeq": 2, 81 | "wrap-iife": [ 82 | 2, 83 | "any" 84 | ], 85 | "no-use-before-define": [ 86 | 2, 87 | { 88 | "functions": false 89 | } 90 | ], 91 | "new-cap": 2, 92 | "no-caller": 2, 93 | "dot-notation": 0, 94 | "no-eq-null": 2, 95 | "no-unused-expressions": 0 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Optimization101.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30011.22 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleRunner", "ConsoleRunner\ConsoleRunner.csproj", "{14DD365A-C683-4EE5-BF10-1CBB85DB6B76}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Practice", "Practice\Practice.csproj", "{E0934801-2072-458C-B2F5-93A05880B032}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Solutions", "Solutions\Solutions.csproj", "{CE08F12F-CDE6-4C71-909A-DB3E7C5D450C}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug|x64 = Debug|x64 16 | Release|Any CPU = Release|Any CPU 17 | Release|x64 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {14DD365A-C683-4EE5-BF10-1CBB85DB6B76}.Debug|Any CPU.ActiveCfg = Debug|x64 21 | {14DD365A-C683-4EE5-BF10-1CBB85DB6B76}.Debug|x64.ActiveCfg = Debug|x64 22 | {14DD365A-C683-4EE5-BF10-1CBB85DB6B76}.Debug|x64.Build.0 = Debug|x64 23 | {14DD365A-C683-4EE5-BF10-1CBB85DB6B76}.Release|Any CPU.ActiveCfg = Release|x64 24 | {14DD365A-C683-4EE5-BF10-1CBB85DB6B76}.Release|x64.ActiveCfg = Release|x64 25 | {14DD365A-C683-4EE5-BF10-1CBB85DB6B76}.Release|x64.Build.0 = Release|x64 26 | {E0934801-2072-458C-B2F5-93A05880B032}.Debug|Any CPU.ActiveCfg = Debug|x64 27 | {E0934801-2072-458C-B2F5-93A05880B032}.Debug|x64.ActiveCfg = Debug|x64 28 | {E0934801-2072-458C-B2F5-93A05880B032}.Debug|x64.Build.0 = Debug|x64 29 | {E0934801-2072-458C-B2F5-93A05880B032}.Release|Any CPU.ActiveCfg = Release|x64 30 | {E0934801-2072-458C-B2F5-93A05880B032}.Release|x64.ActiveCfg = Release|x64 31 | {E0934801-2072-458C-B2F5-93A05880B032}.Release|x64.Build.0 = Release|x64 32 | {CE08F12F-CDE6-4C71-909A-DB3E7C5D450C}.Debug|Any CPU.ActiveCfg = Debug|x64 33 | {CE08F12F-CDE6-4C71-909A-DB3E7C5D450C}.Debug|x64.ActiveCfg = Debug|x64 34 | {CE08F12F-CDE6-4C71-909A-DB3E7C5D450C}.Debug|x64.Build.0 = Debug|x64 35 | {CE08F12F-CDE6-4C71-909A-DB3E7C5D450C}.Release|Any CPU.ActiveCfg = Release|x64 36 | {CE08F12F-CDE6-4C71-909A-DB3E7C5D450C}.Release|x64.ActiveCfg = Release|x64 37 | {CE08F12F-CDE6-4C71-909A-DB3E7C5D450C}.Release|x64.Build.0 = Release|x64 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | GlobalSection(ExtensibilityGlobals) = postSolution 43 | SolutionGuid = {AA654B47-6426-4E74-B3A2-BC4E1B42ED1F} 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning/Model.fs: -------------------------------------------------------------------------------- 1 | namespace CoffeePlanning 2 | 3 | open Flips 4 | open Flips.Types 5 | open Flips.SliceMap 6 | open CoffeePlanning.Domain 7 | 8 | module internal Model = 9 | 10 | /// Create the base Model with just the Objective function 11 | let createBase 12 | (p: Parameters) 13 | (roasterDecision:SMap) 14 | (warehouseDecisions: SMap) = 15 | 16 | let costExpression = sum (p.RoasterCosts .* roasterDecision) + sum (p.WarehouseCosts .* warehouseDecisions) 17 | let objective = Objective.create "MinimizeCost" Minimize costExpression 18 | Model.create objective 19 | 20 | /// Add constraint for Minimum Warehouse Capacity 21 | let addMinWarehouseCapacityConstraint 22 | (p: Parameters) 23 | (warehouseDecisions: SMap) 24 | (model: Model.Model) = 25 | 26 | let warehouseConstraint = 27 | Constraint.create "MinWarehouseCapacity" (sum (p.WarehouseCapacity .* warehouseDecisions) >== p.MinWarehouseCapacity) 28 | 29 | Model.addConstraint warehouseConstraint model 30 | 31 | /// Add constraint for Minimum Roaster Capacity 32 | let addMinRoasterCapacityConstraint 33 | (p: Parameters) 34 | (roasterDecisions: SMap) 35 | (model: Model.Model) = 36 | 37 | let warehouseConstraint = 38 | Constraint.create "MinRoasterCapacity" (sum (p.RoasterCapacity .* roasterDecisions) >== p.MinRoasterCapacity) 39 | 40 | Model.addConstraint warehouseConstraint model 41 | 42 | /// Add Warehouse required wherever there is a Roaster constraints 43 | let addWarehouseRequiredConstraints 44 | (p: Parameters) 45 | (warehouseDecisions: SMap) 46 | (roasterDecisions: SMap) 47 | (model: Model.Model) = 48 | 49 | let warehouseRequiredConstraints = 50 | ConstraintBuilder "WarehouseAndRoasterCoexist" { 51 | for location in p.Locations -> 52 | roasterDecisions.[location] <== warehouseDecisions.[location] 53 | } 54 | 55 | Model.addConstraints warehouseRequiredConstraints model 56 | 57 | /// Build the full model 58 | let buildModel (p: Parameters) (warehouseDecisions: SMap) (roasterDecisions: SMap) = 59 | 60 | createBase p roasterDecisions warehouseDecisions 61 | |> addMinRoasterCapacityConstraint p roasterDecisions 62 | |> addMinWarehouseCapacityConstraint p warehouseDecisions 63 | |> addWarehouseRequiredConstraints p warehouseDecisions roasterDecisions 64 | 65 | -------------------------------------------------------------------------------- /code/csharp-visualstudio/Solutions/03-RevisedFarmModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Google.OrTools.LinearSolver; 5 | 6 | namespace Solutions 7 | { 8 | public class RevisedFarmModel 9 | { 10 | public static void Solve() 11 | { 12 | var animals = new List 13 | { 14 | "cow", "pig", "chicken" 15 | }; 16 | 17 | var revenue = new Dictionary() 18 | { 19 | { "cow", 100.0 }, {"pig", 50.0 }, {"chicken", 8.0 } 20 | }; 21 | 22 | var pasture = new Dictionary() 23 | { 24 | { "cow", 1.0 }, {"pig", 0.5 }, {"chicken", 0.0 } 25 | }; 26 | 27 | var feed = new Dictionary() 28 | { 29 | { "cow", 0.0 }, {"pig", 1.0 }, {"chicken", 0.1 } 30 | }; 31 | 32 | var labor = new Dictionary() 33 | { 34 | { "cow", 9.5 }, {"pig", 8.0 }, {"chicken", 0.0 } 35 | }; 36 | 37 | var totalPasture = 1000.0; 38 | var totalFeed = 100.0; 39 | var totalLabor = 7200.0; 40 | 41 | // Create an instance of the Solver class 42 | var solver = Solver.CreateSolver("FarmModel", "GLOP_LINEAR_PROGRAMMING"); 43 | 44 | // Create variables for each type of Anaimal 45 | var decisions = 46 | animals 47 | .ToDictionary(x => x, x => solver.MakeNumVar(0.0, Double.MaxValue, x)); 48 | 49 | // Create expression for Revenue 50 | var objExpr = 51 | animals.Sum(x => decisions[x] * revenue[x]); 52 | 53 | // Add the expression to the solver 54 | solver.Maximize(objExpr); 55 | 56 | // Create constraint for Pasture 57 | var maxPasture = animals.Sum(x => decisions[x] * pasture[x]) <= totalPasture; 58 | solver.Add(maxPasture); 59 | 60 | // Create constraint for the Feed 61 | var maxFeed = animals.Sum(x => decisions[x] * feed[x]) <= totalFeed; 62 | solver.Add(maxFeed); 63 | 64 | // Create constraint for the Labor 65 | var maxLabor = animals.Sum(x => decisions[x] * labor[x]) <= totalLabor; 66 | solver.Add(maxLabor); 67 | 68 | // Solve the problem 69 | var resultStatus = solver.Solve(); 70 | 71 | // Evaluate the solve status 72 | if (resultStatus != Solver.ResultStatus.OPTIMAL) 73 | { 74 | Console.WriteLine("The problem does not have an optimal solution!"); 75 | return; 76 | } 77 | 78 | // Print the results 79 | Console.WriteLine("Solution:"); 80 | Console.WriteLine("Objective value = " + solver.Objective().Value()); 81 | foreach (var variable in solver.variables()) 82 | { 83 | Console.WriteLine($"{variable.Name()} = {variable.SolutionValue()}"); 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /code/fsharp-workshop/Solutions/Dotnet Interactive/Ex02_FarmModel.dib: -------------------------------------------------------------------------------- 1 | #!markdown 2 | 3 | # Farm Model 4 | 5 | #!markdown 6 | 7 | ## Import Flips 8 | 9 | Import Flips and open `System`, `Flips`, and `Flips.Types` 10 | 11 | #!fsharp 12 | 13 | #r "nuget: Flips, 2.0.1" 14 | 15 | #!fsharp 16 | 17 | open System 18 | open Flips 19 | open Flips.Types 20 | 21 | #!markdown 22 | 23 | ## Step 1: Create the Decision Variables 24 | 25 | #!fsharp 26 | 27 | // Create decision variables for cows, pigs, and chickens 28 | let numberOfCows = Decision.createContinuous "NumberOfCows" 0.0 infinity 29 | let numberOfPigs = Decision.createContinuous "NumberOfPigs" 0.0 infinity 30 | let numberOfChickens = Decision.createContinuous "NumberOfChickens" 0.0 infinity 31 | 32 | #!markdown 33 | 34 | ## Step 2: Create the Objective 35 | 36 | #!fsharp 37 | 38 | // Create an objective expression 39 | let objectiveExpression = 100.0*numberOfCows+50.0*numberOfPigs+8.0*numberOfChickens 40 | // Create an objective 41 | let objective = Objective.create "MaximizeRevenue" Maximize objectiveExpression 42 | 43 | #!markdown 44 | 45 | ## Step 3: Add Constraints 46 | 47 | #!fsharp 48 | 49 | // Add constraint for amount of Pasture 50 | let maxPasture = Constraint.create "MaxPasture" (1.0*numberOfCows + 0.2*numberOfPigs <== 1000.0) 51 | // Add constraint for amount of Feed 52 | let maxFeed = Constraint.create "MaxFeed" (1.0*numberOfPigs + 0.1*numberOfChickens <== 100.0) 53 | // Add constraint for amount of Labor 54 | let maxLabor = Constraint.create "MaxLabor" (9.5*numberOfCows + 8.0*numberOfPigs <== 7200.0) 55 | 56 | #!markdown 57 | 58 | ## Step 4: Create the model 59 | 60 | #!fsharp 61 | 62 | // Create the model and add the constraints 63 | let model = 64 | Model.create objective 65 | |> Model.addConstraint maxPasture 66 | |> Model.addConstraint maxFeed 67 | |> Model.addConstraint maxLabor 68 | 69 | #!markdown 70 | 71 | ## Step 5: Create the Settings and Solve 72 | 73 | #!fsharp 74 | 75 | // Create the solver settings 76 | let settings = { 77 | SolverType = SolverType.CBC 78 | MaxDuration = 10000L 79 | WriteLPFile = None 80 | } 81 | 82 | #!fsharp 83 | 84 | // Solve the model and save the results 85 | let result = Solver.solve settings model 86 | 87 | #!markdown 88 | 89 | ## Step 6: Print Results 90 | 91 | #!fsharp 92 | 93 | printfn "--Results--" 94 | // Print the results of the solver 95 | match result with 96 | | Suboptimal msg -> printfn "Unable to solve. Error: %s" msg 97 | | Optimal solution -> 98 | printfn "Objective Value: %f" solution.ObjectiveResult 99 | 100 | for (decision, value) in solution.DecisionResults |> Map.toSeq do 101 | let (DecisionName name) = decision.Name 102 | printfn "Decision: %s\tValue: %f" name value 103 | 104 | -------------------------------------------------------------------------------- /code/fsharp-workshop/Practice/Dotnet Interactive/Ex04_CoffeeModel.dib: -------------------------------------------------------------------------------- 1 | #!markdown 2 | 3 | # Coffee Model 4 | 5 | #!markdown 6 | 7 | ## Import Flips 8 | 9 | #!fsharp 10 | 11 | // Import Flips 12 | 13 | #!markdown 14 | 15 | ## Open Modules 16 | 17 | #!fsharp 18 | 19 | // Open System, Flips, and Flips.Types 20 | 21 | #!fsharp 22 | 23 | let locations = ["Sellwood"; "Hawthorne"; "The Pearl"; "Eastmoreland"; "St. Johns"; "Alberta"; "Nob Hill"; "Belmont"] 24 | 25 | let roasterCost = ["Sellwood", 150000.0; "Hawthorne", 100000.0; "The Pearl", 250000.0; "Eastmoreland", 120000.0; "St. Johns", 130000.0; 26 | "Alberta", 110000.0; "Nob Hill", 135000.0; "Belmont", 180000.0] |> Map.ofSeq 27 | 28 | let roasterCapacity = ["Sellwood", 12.0; "Hawthorne", 18.0; "The Pearl", 22.0; "Eastmoreland", 13.0; 29 | "St. Johns", 14.0; "Alberta", 10.0; "Nob Hill", 17.0; "Belmont", 12.0] |> Map.ofSeq 30 | 31 | let warehouseCost = ["Sellwood", 80000.0; "Hawthorne", 90000.0; "The Pearl", 120000.0; "Eastmoreland", 90000.0; 32 | "St. Johns", 85000.0; "Alberta", 70000.0; "Nob Hill", 85000.0; "Belmont", 90000.0] |> Map.ofSeq 33 | 34 | let warehouseSize = ["Sellwood", 8000.0; "Hawthorne", 6000.0; "The Pearl", 12000.0; "Eastmoreland", 6000.0; 35 | "St. Johns", 7000.0; "Alberta", 9000.0; "Nob Hill", 6000.0; "Belmont", 9200.0] |> Map.ofSeq 36 | 37 | let minWarehouseCapacity = 30000.0 38 | let minRoastingCapacity = 30.0 39 | 40 | #!markdown 41 | 42 | ## Step 1: Create Decision Variables 43 | 44 | #!fsharp 45 | 46 | // Create variables to indicate whether to build a Roaster at a given location 47 | 48 | // Create variables to indicate whether or not to build a Warehouse at a given location 49 | 50 | #!markdown 51 | 52 | ## Step 2: Create the Objective 53 | 54 | #!fsharp 55 | 56 | // Create an objective expression (Sum of the costs of Roasters and Warehouses) 57 | 58 | // Create the Objective (minimize cost) 59 | 60 | #!markdown 61 | 62 | ## Step 3: Add Constraints 63 | 64 | #!fsharp 65 | 66 | // Total Roasting capacity must be greater than 30 tons 67 | 68 | // Total Warehouse size must be greater than 30000 sq. ft. 69 | 70 | // Warehouse must exist where there is a roasting plant 71 | 72 | #!markdown 73 | 74 | ## Step 4: Create the Model 75 | 76 | #!fsharp 77 | 78 | // Create the model and add constraints 79 | 80 | #!markdown 81 | 82 | ## Step 5: Create the Settings and Solve 83 | 84 | #!fsharp 85 | 86 | // Create the solver settings 87 | 88 | #!fsharp 89 | 90 | // Solve the model and save the results 91 | 92 | #!markdown 93 | 94 | ## Step 6: Print the Results 95 | 96 | #!fsharp 97 | 98 | printfn "--Results--" 99 | // Print the results of the solver 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /code/CoffeePlanningExample/CoffeePlanning.Console/Program.fs: -------------------------------------------------------------------------------- 1 | // Learn more about F# at http://fsharp.org 2 | 3 | open System 4 | open CoffeePlanning 5 | open System.Collections.Generic 6 | 7 | 8 | let locations = 9 | [| 10 | "Sellwood" 11 | "Hawthorne" 12 | "The Pearl" 13 | "Eastmoreland" 14 | "St. Johns" 15 | "Alberta" 16 | "Nob Hill" 17 | "Belmont" 18 | |] 19 | 20 | let roasterCost = 21 | [ 22 | "Sellwood", 150000.0 23 | "Hawthorne", 100000.0 24 | "The Pearl", 250000.0 25 | "Eastmoreland", 120000.0 26 | "St. Johns", 130000.0 27 | "Alberta", 110000.0 28 | "Nob Hill", 135000.0 29 | "Belmont", 180000.0 30 | ] 31 | |> List.map KeyValuePair 32 | |> Dictionary 33 | 34 | let roasterCapacity = 35 | [ 36 | "Sellwood", 12.0 37 | "Hawthorne", 18.0 38 | "The Pearl", 22.0 39 | "Eastmoreland", 13.0 40 | "St. Johns", 14.0 41 | "Alberta", 10.0 42 | "Nob Hill", 17.0 43 | "Belmont", 12.0 44 | ] 45 | |> List.map KeyValuePair 46 | |> Dictionary 47 | 48 | let warehouseCost = 49 | [ 50 | "Sellwood", 80000.0 51 | "Hawthorne", 90000.0 52 | "The Pearl", 120000.0 53 | "Eastmoreland", 90000.0 54 | "St. Johns", 85000.0 55 | "Alberta", 70000.0 56 | "Nob Hill", 85000.0 57 | "Belmont", 90000.0 58 | ] 59 | |> List.map KeyValuePair 60 | |> Dictionary 61 | 62 | let warehouseCapacity = 63 | [ 64 | "Sellwood", 8000.0 65 | "Hawthorne", 6000.0 66 | "The Pearl", 12000.0 67 | "Eastmoreland", 6000.0 68 | "St. Johns", 7000.0 69 | "Alberta", 9000.0 70 | "Nob Hill", 6000.0 71 | "Belmont", 9200.0 72 | ] 73 | |> List.map KeyValuePair 74 | |> Dictionary 75 | 76 | let minWarehouseCapacity = 30000.0 77 | let minRoastingCapacity = 30.0 78 | 79 | [] 80 | let main argv = 81 | printfn "Hello World from F#!" 82 | 83 | let config = { 84 | Locations = locations 85 | WarehouseCapacity = warehouseCapacity 86 | WarehouseCosts = warehouseCost 87 | RoasterCapacity = roasterCapacity 88 | RoasterCosts = roasterCost 89 | MinWarehouseCapacity = minWarehouseCapacity 90 | MinRoasterCapacity = minRoastingCapacity 91 | } 92 | 93 | let plan = CoffeePlanning.Solve.findPlan config 10_000L 94 | 95 | printfn "Our Plan..." 96 | printfn "%A" plan 97 | 98 | printfn "Press any key to close..." 99 | let _ = Console.ReadKey() 100 | 0 // return an integer exit code 101 | -------------------------------------------------------------------------------- /code/python-workshop/Practice/Ex02_FarmModel.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 2, 4 | "metadata": { 5 | "language_info": { 6 | "name": "python", 7 | "codemirror_mode": { 8 | "name": "ipython", 9 | "version": 3 10 | } 11 | }, 12 | "orig_nbformat": 2, 13 | "file_extension": ".py", 14 | "mimetype": "text/x-python", 15 | "name": "python", 16 | "npconvert_exporter": "python", 17 | "pygments_lexer": "ipython3", 18 | "version": 3 19 | }, 20 | "cells": [ 21 | { 22 | "cell_type": "code", 23 | "execution_count": 1, 24 | "metadata": {}, 25 | "outputs": [], 26 | "source": [ 27 | "# Import the PuLP library\n" 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 2, 33 | "metadata": {}, 34 | "outputs": [], 35 | "source": [ 36 | "# Create Decision Variables for the number of\n", 37 | "# Cows, Pigs, and Chickens\n" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": null, 43 | "metadata": {}, 44 | "outputs": [], 45 | "source": [ 46 | "# Create a new Problem object with the goal of Maximization\n", 47 | "# and the name 'Farm Problem'\n" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": 3, 53 | "metadata": {}, 54 | "outputs": [], 55 | "source": [ 56 | "# Add the Objective Function\n" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 4, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [ 65 | "# Add Constraint for amount of Pasture\n" 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": 5, 71 | "metadata": {}, 72 | "outputs": [], 73 | "source": [ 74 | "# Add Constraint for the amount of Feed\n" 75 | ] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "execution_count": 6, 80 | "metadata": {}, 81 | "outputs": [], 82 | "source": [ 83 | "# Add Constraint for the amount of Labor\n" 84 | ] 85 | }, 86 | { 87 | "cell_type": "code", 88 | "execution_count": 7, 89 | "metadata": {}, 90 | "outputs": [ 91 | { 92 | "data": { 93 | "text/plain": "1" 94 | }, 95 | "execution_count": 7, 96 | "metadata": {}, 97 | "output_type": "execute_result" 98 | } 99 | ], 100 | "source": [ 101 | "# Solve the problem\n" 102 | ] 103 | }, 104 | { 105 | "cell_type": "code", 106 | "execution_count": 11, 107 | "metadata": {}, 108 | "outputs": [ 109 | { 110 | "name": "stdout", 111 | "output_type": "stream", 112 | "text": "Status: Optimal\nchickens = 1000.0\ncows = 757.89474\npigs = 0.0\nTotal Revenue = $83,789.47\n" 113 | } 114 | ], 115 | "source": [ 116 | "# Check the status\n", 117 | "\n", 118 | "# It is best practice to always check the status of the solve before using the\n", 119 | "# values of the decision variables\n" 120 | ] 121 | }, 122 | { 123 | "cell_type": "code", 124 | "execution_count": null, 125 | "metadata": {}, 126 | "outputs": [], 127 | "source": [] 128 | } 129 | ] 130 | } -------------------------------------------------------------------------------- /code/fsharp-visualstudio/Optimization101.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30011.22 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ConsoleRunner", "ConsoleRunner\ConsoleRunner.fsproj", "{22F71BFC-E594-4C91-A862-13A0AF2815A8}" 7 | EndProject 8 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Practice", "Practice\Practice.fsproj", "{886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}" 9 | EndProject 10 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Solutions", "Solutions\Solutions.fsproj", "{1BF4C4F9-CA86-4E2E-A994-27389F31A34A}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug|x64 = Debug|x64 16 | Release|Any CPU = Release|Any CPU 17 | Release|x64 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Debug|x64.ActiveCfg = Debug|x64 23 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Debug|x64.Build.0 = Debug|x64 24 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Release|x64.ActiveCfg = Release|x64 27 | {22F71BFC-E594-4C91-A862-13A0AF2815A8}.Release|x64.Build.0 = Release|x64 28 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Debug|x64.ActiveCfg = Debug|x64 31 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Debug|x64.Build.0 = Debug|x64 32 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Release|x64.ActiveCfg = Release|x64 35 | {886AEEAA-0135-4F7A-8CB7-8EA0F975BAA1}.Release|x64.Build.0 = Release|x64 36 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Debug|x64.ActiveCfg = Debug|x64 39 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Debug|x64.Build.0 = Debug|x64 40 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Release|x64.ActiveCfg = Release|x64 43 | {1BF4C4F9-CA86-4E2E-A994-27389F31A34A}.Release|x64.Build.0 = Release|x64 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {65AEC478-8030-4EAE-9150-FB11D5028894} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /js/controllers/notes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Handles the showing and 3 | */ 4 | export default class Notes { 5 | 6 | constructor( Reveal ) { 7 | 8 | this.Reveal = Reveal; 9 | 10 | } 11 | 12 | render() { 13 | 14 | this.element = document.createElement( 'div' ); 15 | this.element.className = 'speaker-notes'; 16 | this.element.setAttribute( 'data-prevent-swipe', '' ); 17 | this.element.setAttribute( 'tabindex', '0' ); 18 | this.Reveal.getRevealElement().appendChild( this.element ); 19 | 20 | } 21 | 22 | /** 23 | * Called when the reveal.js config is updated. 24 | */ 25 | configure( config, oldConfig ) { 26 | 27 | if( config.showNotes ) { 28 | this.element.setAttribute( 'data-layout', typeof config.showNotes === 'string' ? config.showNotes : 'inline' ); 29 | } 30 | 31 | } 32 | 33 | /** 34 | * Pick up notes from the current slide and display them 35 | * to the viewer. 36 | * 37 | * @see {@link config.showNotes} 38 | */ 39 | update() { 40 | 41 | if( this.Reveal.getConfig().showNotes && this.element && this.Reveal.getCurrentSlide() && !this.Reveal.print.isPrintingPDF() ) { 42 | 43 | this.element.innerHTML = this.getSlideNotes() || 'No notes on this slide.'; 44 | 45 | } 46 | 47 | } 48 | 49 | /** 50 | * Updates the visibility of the speaker notes sidebar that 51 | * is used to share annotated slides. The notes sidebar is 52 | * only visible if showNotes is true and there are notes on 53 | * one or more slides in the deck. 54 | */ 55 | updateVisibility() { 56 | 57 | if( this.Reveal.getConfig().showNotes && this.hasNotes() && !this.Reveal.print.isPrintingPDF() ) { 58 | this.Reveal.getRevealElement().classList.add( 'show-notes' ); 59 | } 60 | else { 61 | this.Reveal.getRevealElement().classList.remove( 'show-notes' ); 62 | } 63 | 64 | } 65 | 66 | /** 67 | * Checks if there are speaker notes for ANY slide in the 68 | * presentation. 69 | */ 70 | hasNotes() { 71 | 72 | return this.Reveal.getSlidesElement().querySelectorAll( '[data-notes], aside.notes' ).length > 0; 73 | 74 | } 75 | 76 | /** 77 | * Checks if this presentation is running inside of the 78 | * speaker notes window. 79 | * 80 | * @return {boolean} 81 | */ 82 | isSpeakerNotesWindow() { 83 | 84 | return !!window.location.search.match( /receiver/gi ); 85 | 86 | } 87 | 88 | /** 89 | * Retrieves the speaker notes from a slide. Notes can be 90 | * defined in two ways: 91 | * 1. As a data-notes attribute on the slide
92 | * 2. As an