diff --git a/404.html b/404.html index 95484e1..371daff 100644 --- a/404.html +++ b/404.html @@ -6,13 +6,13 @@ Page Not Found | Badger - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/0e384e19.48759c90.js b/assets/js/0e384e19.48759c90.js deleted file mode 100644 index c6bc7aa..0000000 --- a/assets/js/0e384e19.48759c90.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbadger_home=self.webpackChunkbadger_home||[]).push([[671],{9881:function(e,t,n){n.r(t),n.d(t,{frontMatter:function(){return l},contentTitle:function(){return c},metadata:function(){return d},toc:function(){return s},default:function(){return p}});var i=n(7462),r=n(3366),o=(n(7294),n(3905)),a=["components"],l={sidebar_position:1},c="Introduction",d={unversionedId:"intro",id:"intro",isDocsHomePage:!1,title:"Introduction",description:"Badger is an optimizer specifically designed for Accelerator Control Room (ACR). It's the spiritual successor of Ocelot optimizer.",source:"@site/docs/intro.md",sourceDirName:".",slug:"/intro",permalink:"/Badger/docs/intro",editUrl:"https://github.com/SLAC-ML/Badger-Home/edit/master/docs/intro.md",tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",next:{title:"Installation",permalink:"/Badger/docs/getting-started/installation"}},s=[{value:"Important Concepts",id:"important-concepts",children:[{value:"Interface",id:"interface",children:[],level:3},{value:"Environment",id:"environment",children:[],level:3}],level:2},{value:"Features",id:"features",children:[{value:"Plugin System",id:"plugin-system",children:[],level:3},{value:"Extension System",id:"extension-system",children:[],level:3}],level:2},{value:"Design Principles",id:"design-principles",children:[{value:"Decouple algorithm and environment",id:"decouple-algorithm-and-environment",children:[],level:3},{value:"Decouple backend and frontend",id:"decouple-backend-and-frontend",children:[],level:3}],level:2}],u={toc:s};function p(e){var t=e.components,l=(0,r.Z)(e,a);return(0,o.kt)("wrapper",(0,i.Z)({},u,l,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"introduction"},"Introduction"),(0,o.kt)("p",null,"Badger is an optimizer specifically designed for Accelerator Control Room (ACR). It's the spiritual successor of ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/ocelot-collab/optimizer"},"Ocelot optimizer"),"."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Badger architecture",src:n(4879).Z})),(0,o.kt)("h2",{id:"important-concepts"},"Important Concepts"),(0,o.kt)("h3",{id:"interface"},"Interface"),(0,o.kt)("h3",{id:"environment"},"Environment"),(0,o.kt)("h2",{id:"features"},"Features"),(0,o.kt)("h3",{id:"plugin-system"},"Plugin System"),(0,o.kt)("h3",{id:"extension-system"},"Extension System"),(0,o.kt)("h2",{id:"design-principles"},"Design Principles"),(0,o.kt)("h3",{id:"decouple-algorithm-and-environment"},"Decouple algorithm and environment"),(0,o.kt)("h3",{id:"decouple-backend-and-frontend"},"Decouple backend and frontend"))}p.isMDXComponent=!0},4879:function(e,t,n){t.Z=n.p+"assets/images/architecture-b0910240b36cb72a945230d415864f3a.png"}}]); \ No newline at end of file diff --git a/assets/js/0e384e19.ab9c8852.js b/assets/js/0e384e19.ab9c8852.js new file mode 100644 index 0000000..9b2dddb --- /dev/null +++ b/assets/js/0e384e19.ab9c8852.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbadger_home=self.webpackChunkbadger_home||[]).push([[671],{9881:function(e,t,n){n.r(t),n.d(t,{frontMatter:function(){return l},contentTitle:function(){return s},metadata:function(){return d},toc:function(){return c},default:function(){return p}});var i=n(7462),o=n(3366),a=(n(7294),n(3905)),r=["components"],l={sidebar_position:1},s="Introduction",d={unversionedId:"intro",id:"intro",isDocsHomePage:!1,title:"Introduction",description:"Badger is an optimizer specifically designed for Accelerator Control Room (ACR). It's the spiritual successor of Ocelot optimizer.",source:"@site/docs/intro.md",sourceDirName:".",slug:"/intro",permalink:"/Badger/docs/intro",editUrl:"https://github.com/SLAC-ML/Badger-Home/edit/master/docs/intro.md",tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",next:{title:"Installation",permalink:"/Badger/docs/getting-started/installation"}},c=[{value:"Important Concepts",id:"important-concepts",children:[{value:"Routine",id:"routine",children:[],level:3},{value:"Interface",id:"interface",children:[],level:3},{value:"Environment",id:"environment",children:[],level:3},{value:"Routine Config",id:"routine-config",children:[],level:3}],level:2},{value:"Features",id:"features",children:[{value:"Plugin System",id:"plugin-system",children:[],level:3},{value:"Extension System",id:"extension-system",children:[],level:3}],level:2},{value:"Design Principles",id:"design-principles",children:[{value:"Decouple algorithm and environment",id:"decouple-algorithm-and-environment",children:[],level:3},{value:"Decouple backend and frontend",id:"decouple-backend-and-frontend",children:[],level:3}],level:2}],m={toc:c};function p(e){var t=e.components,l=(0,o.Z)(e,r);return(0,a.kt)("wrapper",(0,i.Z)({},m,l,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"introduction"},"Introduction"),(0,a.kt)("p",null,"Badger is an optimizer specifically designed for Accelerator Control Room (ACR). It's the spiritual successor of ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/ocelot-collab/optimizer"},"Ocelot optimizer"),"."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Badger architecture",src:n(4879).Z})),(0,a.kt)("p",null,"Badger abstracts an optimization run as an optimization algorithm interacts with an environment, by following some pre-defined rules. As visualized in the picture above, the environment is controlled by the algorithm and tunes/observes the control system/machine through an interface, while the users control/monitor the optimization flow through a graphical user interface (GUI) or a command line interface (CLI)."),(0,a.kt)("p",null,"Algorithms, environments, and interfaces in Badger are all managed through a plugin system, and could be developed and maintained separately. The application interfaces (API) for creating the plugins are very straightforward and simple, yet abstractive enough to handle various situations."),(0,a.kt)("p",null,"Badger offers 3 modes to satisfy different user groups:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"GUI mode, for ACR operators, enable them to perform regular optimization tasks with one click"),(0,a.kt)("li",{parentName:"ul"},"CLI mode, for the command line lovers or the situation without a screen, configure and run the whole optimization in one line efficiently"),(0,a.kt)("li",{parentName:"ul"},"API mode, for the algorithm developers, use the environments provided by Badger without the troubles to configure them")),(0,a.kt)("h2",{id:"important-concepts"},"Important Concepts"),(0,a.kt)("p",null,"As shown in the Badger schematic plot above, there are several terms/concepts in Badger, and their meaning are a little different with regard to their general definitions. Let's briefly go through the terms/concepts in Badger in the following sections."),(0,a.kt)("h3",{id:"routine"},"Routine"),(0,a.kt)("p",null,"An optimization setup in Badger is called a routine. A routine contains all the information needed to perform the optimization:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"The optimization algorithm and its hyperparameters"),(0,a.kt)("li",{parentName:"ul"},"The environment on which the optimization would be performed"),(0,a.kt)("li",{parentName:"ul"},"The configuration of the optimization, such as variables, objectives, and constraints")),(0,a.kt)("p",null,"To run an optimization in Badger, the users need to define the routine. Badger provides several ways to easily compose the routine, so no worries, you'll not have to write it by hands:)"),(0,a.kt)("h3",{id:"interface"},"Interface"),(0,a.kt)("p",null,"An interface in Badger is a piece of code that talks to the underlying control system/machine. It communicates to the control system to:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Set a process variable (PVs) to some specific value"),(0,a.kt)("li",{parentName:"ul"},"Get the value of a PV")),(0,a.kt)("p",null,"An interface is also responsible to perform the configuration needed for communicating with the control system, and the configuration can be customized by passing a ",(0,a.kt)("inlineCode",{parentName:"p"},"params")," dictionary to the interface."),(0,a.kt)("p",null,"The concept of interface was introduced to Badger for better code reuse. You don't have to copy-n-paste the same fundamental code again and again when coding your optimization problems for the same underlying control system. Now you could simply ask Badger to use the same interface, and focus more on the higher level logic of the problem."),(0,a.kt)("div",{className:"admonition admonition-tip alert alert--success"},(0,a.kt)("div",{parentName:"div",className:"admonition-heading"},(0,a.kt)("h5",{parentName:"div"},(0,a.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,a.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},(0,a.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))),"tip")),(0,a.kt)("div",{parentName:"div",className:"admonition-content"},(0,a.kt)("p",{parentName:"div"},"Interfaces are ",(0,a.kt)("strong",{parentName:"p"},"optional")," in Badger -- an interface is not needed if the optimization problem is simple enough (say, analytical function) that you can directly shape it into an environment."))),(0,a.kt)("h3",{id:"environment"},"Environment"),(0,a.kt)("p",null,"An environment is Badger's way to (partially) abstract an optimization problem. A typical optimization problem usually consists of the variables to tune, and the objectives to optimize. A Badger environment defines all the interested ",(0,a.kt)("strong",{parentName:"p"},"variables")," and ",(0,a.kt)("strong",{parentName:"p"},"observations")," of a control system/machine. An optimization problem can be specified by stating which variables in the environment are the variables to tune, and which observations are the objectives to optimize. Furthermore, one can define the constraints for the optimization by picking up some observation from the environment and giving it a threshold."),(0,a.kt)("p",null,"Take the following case as an example. Assume that we have an accelerator control system and we'd like to tune the quadupoles ",(0,a.kt)("inlineCode",{parentName:"p"},"QUAD:1"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"QUAD:2")," and minimize the horizontal beam size on a screen ",(0,a.kt)("inlineCode",{parentName:"p"},"BSIZE:X"),". We also want to keep the vertical beam size ",(0,a.kt)("inlineCode",{parentName:"p"},"BSIZE:Y")," below a certain value. To do this in Badger, we could define an environment that has variables:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"QUAD:1")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"QUAD:2"))),(0,a.kt)("p",null,"And observations:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BSIZE:X")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"BSIZE:Y"))),(0,a.kt)("p",null,"Then define a ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("a",{parentName:"strong",href:"#routine-config"},"routine config"))," to specify details of the optimization problem, as will be mentioned in the next section."),(0,a.kt)("div",{className:"admonition admonition-tip alert alert--success"},(0,a.kt)("div",{parentName:"div",className:"admonition-heading"},(0,a.kt)("h5",{parentName:"div"},(0,a.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,a.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},(0,a.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))),"tip")),(0,a.kt)("div",{parentName:"div",className:"admonition-content"},(0,a.kt)("p",{parentName:"div"},"One environment could support multiple ",(0,a.kt)("strong",{parentName:"p"},"relevant")," optimization problems -- just put all the variables and observations to the environment, and use routine config to select which variables/observations to use for the optimization."))),(0,a.kt)("h3",{id:"routine-config"},"Routine Config"),(0,a.kt)("p",null,"A routine config is the counterpart of optimization problem abstraction with regard to environment. An optimization problem can be fully defined by an environment with a routine config."),(0,a.kt)("p",null,"On top of the variables and observations provided by environment, routine config tells Badger which and how variables/observations are used as the tuning variables/objectives/constraints."),(0,a.kt)("p",null,"Use the example from the last section, the routine config for the problem could be:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml",metastring:'title="Routine Config"',title:'"Routine','Config"':!0},"variables:\n - QUAD:1\n - QUAD:2\nobjectives:\n - BSIZE:X: MINIMIZE\nconstraints:\n - BSIZE:Y:\n - LESS_THAN\n - 0.5\n")),(0,a.kt)("p",null,"The reasons to divide the optimization problem definition into two parts (environment and routine config) are:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Better code reuse"),(0,a.kt)("li",{parentName:"ul"},"Operations in ACR usually require slightly changing a routine frequently, so it's good to have an abstraction for the frequently changed configurations (routine config), to avoid messing with the optimization source code")),(0,a.kt)("h2",{id:"features"},"Features"),(0,a.kt)("h3",{id:"plugin-system"},"Plugin System"),(0,a.kt)("h3",{id:"extension-system"},"Extension System"),(0,a.kt)("h2",{id:"design-principles"},"Design Principles"),(0,a.kt)("h3",{id:"decouple-algorithm-and-environment"},"Decouple algorithm and environment"),(0,a.kt)("h3",{id:"decouple-backend-and-frontend"},"Decouple backend and frontend"))}p.isMDXComponent=!0},4879:function(e,t,n){t.Z=n.p+"assets/images/architecture-b0910240b36cb72a945230d415864f3a.png"}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.b59fa388.js b/assets/js/runtime~main.953d2077.js similarity index 98% rename from assets/js/runtime~main.b59fa388.js rename to assets/js/runtime~main.953d2077.js index c9abf97..90d80ce 100644 --- a/assets/js/runtime~main.b59fa388.js +++ b/assets/js/runtime~main.953d2077.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r,o,c={},a={};function f(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={id:e,loaded:!1,exports:{}};return c[e].call(n.exports,n,n.exports,f),n.loaded=!0,n.exports}f.m=c,f.c=a,e=[],f.O=function(t,n,r,o){if(!n){var c=1/0;for(d=0;d=o)&&Object.keys(f.O).every((function(e){return f.O[e](n[u])}))?n.splice(u--,1):(a=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},f.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);f.r(o);var c={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((function(t){c[t]=function(){return e[t]}}));return c.default=function(){return e},f.d(o,c),o},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce((function(t,n){return f.f[n](e,t),t}),[]))},f.u=function(e){return"assets/js/"+({13:"01a85c17",53:"935f2afb",61:"5e2ad779",75:"6d4920cb",89:"a6aa9e1f",103:"ccc49370",104:"db84cbea",152:"54f44165",191:"dab224c2",195:"c4f5d8e4",214:"7a8ea9cb",276:"e689722c",288:"a2b18811",489:"2a19b374",496:"76085ad1",514:"1be78505",535:"814f3328",592:"common",608:"9e4087bc",610:"6875c492",618:"72b80372",648:"156db660",653:"67b9383b",659:"e3ae7939",671:"0e384e19",769:"6eada910",918:"17896441",965:"b171606d"}[e]||e)+"."+{13:"0af78e0c",53:"10a103d5",61:"86489224",75:"fcbe7e19",89:"37a21e01",103:"63b3eedb",104:"f3d00777",152:"bd72746d",191:"c1065257",195:"964462aa",214:"3a552fb0",276:"cc8f20c9",288:"b77eb052",489:"a7bdca31",496:"f7a98efa",514:"84f0b0c2",535:"4b1b2a12",592:"914f4003",608:"6ce78891",610:"73be0d48",618:"1d60fd4f",648:"9ccd6602",653:"69cb3bb8",659:"5669b728",671:"48759c90",707:"5cb9c152",769:"5341980a",814:"b54f29fc",818:"8df777da",918:"3da4c305",965:"5fe2ce0e"}[e]+".js"},f.miniCssF=function(e){return"assets/css/styles.de163cde.css"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="badger-home:",f.l=function(e,t,n,c){if(r[e])r[e].push(t);else{var a,u;if(void 0!==n)for(var i=document.getElementsByTagName("script"),d=0;d=o)&&Object.keys(f.O).every((function(e){return f.O[e](n[u])}))?n.splice(u--,1):(a=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[n,r,o]},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},f.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);f.r(o);var c={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((function(t){c[t]=function(){return e[t]}}));return c.default=function(){return e},f.d(o,c),o},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce((function(t,n){return f.f[n](e,t),t}),[]))},f.u=function(e){return"assets/js/"+({13:"01a85c17",53:"935f2afb",61:"5e2ad779",75:"6d4920cb",89:"a6aa9e1f",103:"ccc49370",104:"db84cbea",152:"54f44165",191:"dab224c2",195:"c4f5d8e4",214:"7a8ea9cb",276:"e689722c",288:"a2b18811",489:"2a19b374",496:"76085ad1",514:"1be78505",535:"814f3328",592:"common",608:"9e4087bc",610:"6875c492",618:"72b80372",648:"156db660",653:"67b9383b",659:"e3ae7939",671:"0e384e19",769:"6eada910",918:"17896441",965:"b171606d"}[e]||e)+"."+{13:"0af78e0c",53:"10a103d5",61:"86489224",75:"fcbe7e19",89:"37a21e01",103:"63b3eedb",104:"f3d00777",152:"bd72746d",191:"c1065257",195:"964462aa",214:"3a552fb0",276:"cc8f20c9",288:"b77eb052",489:"a7bdca31",496:"f7a98efa",514:"84f0b0c2",535:"4b1b2a12",592:"914f4003",608:"6ce78891",610:"73be0d48",618:"1d60fd4f",648:"9ccd6602",653:"69cb3bb8",659:"5669b728",671:"ab9c8852",707:"5cb9c152",769:"5341980a",814:"b54f29fc",818:"8df777da",918:"3da4c305",965:"5fe2ce0e"}[e]+".js"},f.miniCssF=function(e){return"assets/css/styles.de163cde.css"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="badger-home:",f.l=function(e,t,n,c){if(r[e])r[e].push(t);else{var a,u;if(void 0!==n)for(var i=document.getElementsByTagName("script"),d=0;d Blog | Badger - +
- + \ No newline at end of file diff --git a/blog/archive.html b/blog/archive.html index 96a8950..348c1ad 100644 --- a/blog/archive.html +++ b/blog/archive.html @@ -6,13 +6,13 @@ Archive | Badger - +

Archive

Archive

- + \ No newline at end of file diff --git a/blog/tags.html b/blog/tags.html index f6cf1e1..b8f75b5 100644 --- a/blog/tags.html +++ b/blog/tags.html @@ -6,13 +6,13 @@ Tags | Badger - +

Tags

- + \ No newline at end of file diff --git a/blog/tags/badger.html b/blog/tags/badger.html index 68e7ea6..7cbad58 100644 --- a/blog/tags/badger.html +++ b/blog/tags/badger.html @@ -6,13 +6,13 @@ One post tagged with "badger" | Badger - +

One post tagged with "badger"

View All Tags
- + \ No newline at end of file diff --git a/blog/tags/hello.html b/blog/tags/hello.html index 9ea1029..42edb3d 100644 --- a/blog/tags/hello.html +++ b/blog/tags/hello.html @@ -6,13 +6,13 @@ One post tagged with "hello" | Badger - +

One post tagged with "hello"

View All Tags
- + \ No newline at end of file diff --git a/blog/tags/slac.html b/blog/tags/slac.html index 3a40e89..166247e 100644 --- a/blog/tags/slac.html +++ b/blog/tags/slac.html @@ -6,13 +6,13 @@ One post tagged with "SLAC" | Badger - +

One post tagged with "SLAC"

View All Tags
- + \ No newline at end of file diff --git a/blog/welcome.html b/blog/welcome.html index b0eece9..c6bc44b 100644 --- a/blog/welcome.html +++ b/blog/welcome.html @@ -6,13 +6,13 @@ Welcome | Badger - +
- + \ No newline at end of file diff --git a/docs/getting-started/installation.html b/docs/getting-started/installation.html index f4bd426..240ba68 100644 --- a/docs/getting-started/installation.html +++ b/docs/getting-started/installation.html @@ -6,13 +6,13 @@ Installation | Badger - +

Installation

Badger is essentially a python package. It's recommended to install and test it in a separate python virtual environment before using it in a production env.

Requirements

  • Python version >= 3.6. Python 3.7 is recommended

Install core package

Badger has a core package (badger-opt) that can be extended by a set of plugins. Badger core package is available on both pip and conda. So you could install Badger with:

pip install badger-opt

Or

conda install -c conda-forge badger-opt

Install sample plugins

Clone the badger plugins repo to some directory on your computer:

git clone https://github.com/SLAC-ML/Badger-Plugins.git

Set up Badger

Once badger-opt is installed and you have the badger plugins ready, run the following command:

badger

Follow the instructions and configure several paths that are needed by Badger.

- + \ No newline at end of file diff --git a/docs/getting-started/tutorial.html b/docs/getting-started/tutorial.html index c096695..8966df1 100644 --- a/docs/getting-started/tutorial.html +++ b/docs/getting-started/tutorial.html @@ -6,7 +6,7 @@ Tutorial | Badger - + @@ -16,7 +16,7 @@ optimal means minimal c1) at the evaluation time are highlighted.

In the example above, we use the silly algorithm (which is just a random search algorithm) to optimize the TNK environment, as shown in the reviewed routine. Environment TNK has 2 variables and 5 observations:

TNK environment
name: TNK
version: '0.1'
dependencies:
- numpy
params: null
variables:
- x1: 0 -> 3.14159
- x2: 0 -> 3.14159
observations:
- y1
- y2
- c1
- c2
- some_array

We specify in the config.yaml that we would like to tune varaible x2, and minimize observation c1 of environment TNK as objective. The configuration that could reproduce the whole optimization setup is called a routine in Badger. A routine contains the information of the algorithm, the environment, and the config of the optimization (the variables, the objectives, and the constraints).

We just saved the routine of the run as helloworld. Now you could view the routine again by:

badger routine helloworld

Re-run an optimization

We can re-run a saved routine in Badger. Let's re-run the helloworld routine that we just saved:

badger routine helloworld -r

Badger would behave exactly the same way as the first time you run the routine.

View the historical optimization data

You can cd to the Badger archive root (the one you setup during the initial configurations) and view the historical optimization data. The file structure is a tree-like one, with year, year-month, year-month-day as the first 3 levels of branches, and the optimization runs as leaves:

Badger archive root file structure
|--2021
|--2021-11
|--2021-11-24
|--BadgerOpt-2021-11-24-133007.yaml
|--BadgerOpt-2021-11-24-113241.yaml
|--...
|--...
|--...
|--...

The yaml data file contains the routine information and the solutions evaluated during the run. The content would look like this:

BadgerOpt-2021-11-24-133007.yaml
routine:
name: helloworld
algo: silly
env: TNK
algo_params:
dimension: 1
max_iter: 10
env_params: null
config:
variables:
- x2:
- 0.0
- 3.1416
objectives:
- c1: MINIMIZE
constraints: null
data:
timestamp:
- 24-Nov-2021 13:30:06
- 24-Nov-2021 13:30:06
- 24-Nov-2021 13:30:06
- 24-Nov-2021 13:30:06
- 24-Nov-2021 13:30:06
- 24-Nov-2021 13:30:06
- 24-Nov-2021 13:30:06
- 24-Nov-2021 13:30:07
- 24-Nov-2021 13:30:07
- 24-Nov-2021 13:30:07
c1:
- 2.093905436806936
- 2.6185501712620036
- -0.8170601778601619
- 7.869183841178197
- -1.0945113202011
- 0.514833333947652
- -1.0331173238615994
- 1.4523371516674013
- 1.3610274948700156
- -0.0042273815683477045
x2:
- 1.78715008793524
- 1.9283542649788197
- 0.5319208795862764
- 2.9948595695254556
- 0.07408562477903413
- 1.2707609271407632
- 0.2586168520000207
- 1.5976035652399507
- 1.5687662333407153
- 1.0467915830917118

Create a simple environment

Now let's create a simple Badger environment and run optimization on it.

- + \ No newline at end of file diff --git a/docs/guides/api-usage.html b/docs/guides/api-usage.html index 447171f..a4316ac 100644 --- a/docs/guides/api-usage.html +++ b/docs/guides/api-usage.html @@ -6,13 +6,13 @@ API Usage | Badger - + - + \ No newline at end of file diff --git a/docs/guides/cli-usage.html b/docs/guides/cli-usage.html index 9887168..35a9433 100644 --- a/docs/guides/cli-usage.html +++ b/docs/guides/cli-usage.html @@ -6,13 +6,13 @@ CLI Usage | Badger - + - + \ No newline at end of file diff --git a/docs/guides/create-algo-plugin.html b/docs/guides/create-algo-plugin.html index 2f7fab2..7b037d7 100644 --- a/docs/guides/create-algo-plugin.html +++ b/docs/guides/create-algo-plugin.html @@ -6,13 +6,13 @@ Create algorithm plugin | Badger - + - + \ No newline at end of file diff --git a/docs/guides/create-env-plugin.html b/docs/guides/create-env-plugin.html index 4db9840..20f28d9 100644 --- a/docs/guides/create-env-plugin.html +++ b/docs/guides/create-env-plugin.html @@ -6,13 +6,13 @@ Create environment plugin | Badger - + - + \ No newline at end of file diff --git a/docs/guides/create-intf-plugin.html b/docs/guides/create-intf-plugin.html index 390865a..4bdab21 100644 --- a/docs/guides/create-intf-plugin.html +++ b/docs/guides/create-intf-plugin.html @@ -6,13 +6,13 @@ Create interface plugin | Badger - + - + \ No newline at end of file diff --git a/docs/guides/gui-usage.html b/docs/guides/gui-usage.html index 61dfbad..29649c0 100644 --- a/docs/guides/gui-usage.html +++ b/docs/guides/gui-usage.html @@ -6,13 +6,13 @@ GUI Usage | Badger - + - + \ No newline at end of file diff --git a/docs/intro.html b/docs/intro.html index 121680e..0f2363b 100644 --- a/docs/intro.html +++ b/docs/intro.html @@ -6,13 +6,13 @@ Introduction | Badger - +
-
- +

Introduction

Badger is an optimizer specifically designed for Accelerator Control Room (ACR). It's the spiritual successor of Ocelot optimizer.

Badger architecture

Badger abstracts an optimization run as an optimization algorithm interacts with an environment, by following some pre-defined rules. As visualized in the picture above, the environment is controlled by the algorithm and tunes/observes the control system/machine through an interface, while the users control/monitor the optimization flow through a graphical user interface (GUI) or a command line interface (CLI).

Algorithms, environments, and interfaces in Badger are all managed through a plugin system, and could be developed and maintained separately. The application interfaces (API) for creating the plugins are very straightforward and simple, yet abstractive enough to handle various situations.

Badger offers 3 modes to satisfy different user groups:

  • GUI mode, for ACR operators, enable them to perform regular optimization tasks with one click
  • CLI mode, for the command line lovers or the situation without a screen, configure and run the whole optimization in one line efficiently
  • API mode, for the algorithm developers, use the environments provided by Badger without the troubles to configure them

Important Concepts

As shown in the Badger schematic plot above, there are several terms/concepts in Badger, and their meaning are a little different with regard to their general definitions. Let's briefly go through the terms/concepts in Badger in the following sections.

Routine

An optimization setup in Badger is called a routine. A routine contains all the information needed to perform the optimization:

  • The optimization algorithm and its hyperparameters
  • The environment on which the optimization would be performed
  • The configuration of the optimization, such as variables, objectives, and constraints

To run an optimization in Badger, the users need to define the routine. Badger provides several ways to easily compose the routine, so no worries, you'll not have to write it by hands:)

Interface

An interface in Badger is a piece of code that talks to the underlying control system/machine. It communicates to the control system to:

  • Set a process variable (PVs) to some specific value
  • Get the value of a PV

An interface is also responsible to perform the configuration needed for communicating with the control system, and the configuration can be customized by passing a params dictionary to the interface.

The concept of interface was introduced to Badger for better code reuse. You don't have to copy-n-paste the same fundamental code again and again when coding your optimization problems for the same underlying control system. Now you could simply ask Badger to use the same interface, and focus more on the higher level logic of the problem.

tip

Interfaces are optional in Badger -- an interface is not needed if the optimization problem is simple enough (say, analytical function) that you can directly shape it into an environment.

Environment

An environment is Badger's way to (partially) abstract an optimization problem. A typical optimization problem usually consists of the variables to tune, and the objectives to optimize. A Badger environment defines all the interested variables and observations of a control system/machine. An optimization problem can be specified by stating which variables in the environment are the variables to tune, and which observations are the objectives to optimize. Furthermore, one can define the constraints for the optimization by picking up some observation from the environment and giving it a threshold.

Take the following case as an example. Assume that we have an accelerator control system and we'd like to tune the quadupoles QUAD:1, QUAD:2 and minimize the horizontal beam size on a screen BSIZE:X. We also want to keep the vertical beam size BSIZE:Y below a certain value. To do this in Badger, we could define an environment that has variables:

  • QUAD:1
  • QUAD:2

And observations:

  • BSIZE:X
  • BSIZE:Y

Then define a routine config to specify details of the optimization problem, as will be mentioned in the next section.

tip

One environment could support multiple relevant optimization problems -- just put all the variables and observations to the environment, and use routine config to select which variables/observations to use for the optimization.

Routine Config

A routine config is the counterpart of optimization problem abstraction with regard to environment. An optimization problem can be fully defined by an environment with a routine config.

On top of the variables and observations provided by environment, routine config tells Badger which and how variables/observations are used as the tuning variables/objectives/constraints.

Use the example from the last section, the routine config for the problem could be:

Routine Config
variables:
- QUAD:1
- QUAD:2
objectives:
- BSIZE:X: MINIMIZE
constraints:
- BSIZE:Y:
- LESS_THAN
- 0.5

The reasons to divide the optimization problem definition into two parts (environment and routine config) are:

  • Better code reuse
  • Operations in ACR usually require slightly changing a routine frequently, so it's good to have an abstraction for the frequently changed configurations (routine config), to avoid messing with the optimization source code

Features

Plugin System

Extension System

Design Principles

Decouple algorithm and environment

Decouple backend and frontend

+ \ No newline at end of file diff --git a/index.html b/index.html index 4edba24..d531af3 100644 --- a/index.html +++ b/index.html @@ -6,13 +6,13 @@ Badger the Optimizer | Badger - +

Badger

The Missing Optimizer in ACR

Easy to Use

Badger was specifically designed for operators. You could re-run an optimization routine with just one command/click.

Fast to Extend

Badger can be extended through its plugin system. Shape your algorithm/problem into a plugin in 5 minutes.

Multiple Mode

Badger can be used as a library, a command line tool, or a GUI application. Use Badger the way you want.

- + \ No newline at end of file