VOLANO versions 2.13.2, 2.13.3, and 2.13.4 contain applets whose time-stamping certificate expired on Monday, March 16, 2020, at midnight (00:00) Pacific Daylight Time. VOLANO version 2.13.5 contains applets whose time-stamping certificate expires on Sunday, December 12, 2021 at 11:00 PM (23:00) Pacific Standard Time.
A new VOLANO version 2.13.6 is available with applets that have valid certificates until Thursday, August 1, 2030, at 16:59:59 Pacific Daylight Time. If you are a current customer, please send me an e-mail for information on how to download the build of the VOLANO chat server that is customized for your Web site.
The VOLANO chat server is now open-source software! For more information, see the new source code repository on GitHub.
An update to the VOLANO chat software is available as a full version 2.13 package and as an upgrade from version 2.12. This update includes signed applets compatible with the latest security changes in the Java 8 Plug-in from Oracle.
The VOLANO chat applets in this version must request all permissions on the end user's computer to be able to make a network socket connection back to the chat server. The applets actually require just one permission, called SocketPermission, but Java applets are unable to request the specific permissions they need. Applets can choose only between running with no permissions, called sandbox, or running with unrestricted access, called all-permissions.
Following the recommendations of Oracle, the use of the applets is restricted by host name or domain name. This change removes the requirement for a server license key based on the server's IP address. Instead of your server's IP address, simply provide your server's host name or domain name along with a list of host names or domain names where you want to restrict the applet from being embedded, if any. You'll receive you a custom build of the VOLANO chat software to match your settings. Please send an e-mail to request a custom build of the software for your system.
To receive your custom build, provide the code base host name or domain name of your VOLANO applets, along with a list of host names or domain names for the applets' document base. You can restrict the code base and document base to specific host names, like www.example.com, or to any host of the domain name, like *.example.com. For example, if you currently deploy the applets with HTML like the following:
<applet codebase="http://www.example.com/vcclient" ...> ... </applet>
then the code base host name would be www.example.com, while the code base domain name would be example.com.
You can find the list of Web sites you have authorized to embed the VOLANO chat applets from your server, called the applet's document base, in your permitted referrer file (conf/referrers-allow.txt
).
The Java 8 Plug-in released on March 18, 2014, no longer allows a Java applet running in the restricted sandbox to make a network connection back to the server from which it came.
The change is described in Java Rich Internet Applications Enhancement in JDK 8 where it states, "For sandbox RIAs, SocketPermissions
for the origin host is no longer granted."
Oracle made this change at the last minute, even after the JDK 8 Final Release Candidate was posted for testing on January 23, 2014. The change breaks a feature of Java applets that has worked for 18 years. I'm working on a solution to the problem or an alternative that bypasses the problem altogether.
Meanwhile, the VOLANO chat software version 2.12 works fine with Java 7, and Java 7 is still being provided to end users at www.java.com. You may want to add a note for your users that the VOLANO chat applets work only with Java 7 and do not work with Java 8. For those users who have both Java 7 and Java 8 installed, you can mark the applet to load only with Java 7 by adding the Java version string to the applet parameters, like this:
<applet codebase="." archive="COM/volano/VolanoChat.jar" code="COM.volano.VolanoChat.class" width="500" height="60"> <param name="java_version" value="1.7*"> <param name="permissions" value="sandbox"> ... <param name="text" value="english.txt"> </applet>
Details of the java_version
parameter are explained in the Java Runtime Environment Version Selection page.
The final release of Java 8 was posted for developers at the Java SE Downloads page. For end users running applets with the Java Plug-in, the latest available release is Java 7 Update 55, available at the Java.com Web site. In a comment to his blog post, Mark Reinhold, Chief Architect of the Java Platform Group at Oracle, says, "We're very conservative with java.com auto-updates. We'll switch that over to JDK 8 in a few months." So we should have until June 2014 before end users start to receive the Java 8 update automatically.
An update to the VOLANO chat software is available for download as a full version 2.12 package and as an upgrade to version 2.11. This update includes signed applets compatible with the latest security changes in Java 7 Update 51 being released on January 14, 2014.
The update will work with license keys for the VOLANO chat server at version 2.5 or later. If you have an earlier version of the VOLANO chat server, please contact me for a more recent license.
An update to the VOLANO chat software is available as a full version 2.11 package and as a patch to version 2.10. This version works around the bug in Oracle Java 7 that disables the enter and return keys on Mac OS X.
The Oracle Java 7 Plug-in on Mac OS X disables the enter and return keys in the text field of the chat room window. As a result, Mac users who upgrade to Java 7 are unable to send messages in the chat room. There is a work-around that I will post soon in an update to the VOLANO chat software. I expect to complete the changes in the next few days and have a full version and upgrade version available for download next week.
Included in the text box below is the bug report I submitted to Oracle.
— John Neffenger


Custom and modified event hooks available within the defined realm. A list of default TTT hooks is available here but note that they may have been modified (see below).
NOTE: When using a hook with multiple return values, you must return a non-nil
value for all properties up to the one(s) you are modifying or the hook results will be ignored entirely.
For example, if there is a hook that returns three parameters: first
, second
, and third
and you want to modify the second
parameter you must return the first
parameter as non-nil
as well, like this: return first, newSecond
. Any return parameters after second
can be omitted and the default value will be used.
NOTE: Be careful that you only return from a hook when you absolutely want to change something. Due to the way GMod hooks work, whichever hook instance returns first causes the remaining hook instances to be completely skipped. This is useful for certain hooks when you want to stop a behavior from happening, but it can also accidentally cause functionality to break because its code is completely ignored.
Called when a player opens the body search dialog. Used to add new buttons to the dialog.
Realm: Client
Added in: 1.8.3
Parameters:
prop_ragdoll
representing a player's body being searchedtrue
if not provided.
Called when a player is making a footstep. Used to determine if the player's footstep sound should be stopped.
Realm: Client and Server
Added in: 1.2.7
Parameters:
Return: Whether or not the given player's footstep sounds should be stopped (Defaults to false
).
Modified to allow changing the defusal result via the new return value.
Realm: Server
Added in: 1.5.14
Parameters:
Return:
Changed was_traitor
parameter to be true
for any member of the traitor team, rather than just the traitor role.
Realm: Server
Added in: 1.0.5
Parameters:
Return: Whether or not the given player should be able to identify the given corpse (Defaults to false
).
Called before a player is killed because their lover (as set by Cupid's arrows) has been killed. Allows developers to prevent the player from being killed.
Realm: Server
Added in: 1.8.2
Parameters:
Return: If ply
should not be killed, return true
. Otherwise do not return anything.
Called before the name and role of a player's killer is shown to the victim. Used to change the death message reason, killer name, and/or killer role.
Realm: Server
Added in: 1.5.14
Parameters:
water
, suicide
, prop
, burned
, fell
, or ply
)reason
is ply
)reason
is ply
)Return:
ROLE_NONE
to hide the attacker's role from the victim
Called before the event text for the "round finished" event is rendered in the end-of-round summary's Events tab.
Realm: Client
Added in: 1.2.7
Parameters:
id
- The event identifier (always EVENT_FINISH
)t
- The time when this event occurredwin
- The win condition identifierReturn: Text to show in events list at the end of the round
Called before the event icon for the "round finished" event is rendered in the end-of-round summary's Events tab. Used to change the mouseover text for the icon.
Realm: Client
Added in: 1.2.7
Parameters:
id
- The event identifier (always EVENT_FINISH
)t
- The time when this event occurredwin
- The win condition identifierrole
placeholder in the translation stringReturn:
Allows creation of new tabs for the equipment (shop) menu.
Realm: Client
Added in: 1.0.0
Parameters:
Return: If true
, the equipment window will show even if the player doesn't have any of the default tabs. (Added in 1.7.3)
Called after player information such as role, health, and ammo and equipment information such as radar cooldown and disguiser activation are drawn on the screen. Used to write additional persistent text on the screen for player reference.
Realm: Client
Added in: 1.3.1
Parameters:
labelY = labelY + (20 * #activeLabels)
. Be sure to insert an entry when you add your own label so other addons can space appropriately. (Added in 1.6.11)
Called when an informant has scanned additional information from a target player.
Realm: Server
Added in: 1.6.16
Parameters:
Called before a player is rewarded with karma. Used to block a player's karma reward.
Realm: Server
Added in: 1.2.7
Parameters:
Return: Whether or not the given player should be prevented from being rewarded with karma (Defaults to false
).
Called before a player's karma effect is decided. Used to determine if a player should be penalized or rewarded.
Realm: Server
Added in: 1.2.7
Parameters:
Return: true
if the attacker should be penalized or false
if they should not. If you have no opinion (e.g. let other logic determine this) then don't return anything at all.

Realm: Server
Added in: 1.6.16
Parameters:
Called when a paladin heals a target.
Realm: Server
Added in: 1.6.16
Parameters:
Called when a parasite respawns.
Realm: Server
Added in: 1.8.2
Parameters:
Called for each player who is alive during the Think
hook.
Realm: Client
Added in: 1.3.1
Parameters:
Called for each player who is alive during the Tick
hook.
Realm: Server
Added in: 1.2.7
Parameters:
Called after a player's role has changed.
Realm: Client and Server
Added in: 1.2.7
Parameters:
Called after a player's role has been changed by a weapon or item.
Realm: Server
Added in: 1.6.16
Parameters:
Called before a player is spawned for a round. Also used when reviving a player (via a defib, zombie conversion, etc.).
Realm: Server
Added in: 1.2.7
Parameters:
Called after a player uses a health station. Added should_reduce
parameter which is not present in vanilla TTT.
Realm: Server
Added in: 1.0.0
Parameters:
Called before the round win results message is printed to the top-right corner of the screen. Can be used to print a replacement message for custom win types that this would not normally handle.
Realm: Server
Added in: 1.0.14
Parameters:
Return: true
if the default print messages should be skipped (Defaults to false
).
Called before a target's radar ping is rendered, allowing the color and whether the ping should be shown to be changed.
Realm: Client
Added in: 1.2.3
Parameters:
pos
- The target's positionrole
- The target's role, if anywas_beggar
- If the target was a beggar but was converted to another rolewas_bodysnatcher
- If the target was a bodysnatcher but was converted to another rolekiller_clown_active
- whether the target is a Clown that has been activatedsid64
- The SteamID64 value of the targettgt
to change what is displayed with the radar ping
nick
- A string value that will be shown under the radar ping circlet
- A time number value that will be calculated as the difference from "now" and shown in the "##:##" formatReturn:
Called after non-player radar points are rendered and before players are rendered. Used for rendering custom non-player radar points.

Realm: Server
Added in: 1.4.8
Parameters:
Return:
Called before a player awarded credits for a traitor being killed.
Realm: Server
Added in: 1.4.8
Parameters:
Return: true
to prevent the given player from being awarded credits
Called before a player is awarded credits for killing an opponent.
Realm: Server
Added in: 1.4.8
Parameters:
Return:
Called before all traitors are awarded credits for a non-traitor being killed.
Realm: Server
Added in: 1.4.8
Parameters:
Return:
Called before a player awarded credits for a non-traitor being killed.
Realm: Server
Added in: 1.4.8
Parameters:
Return: true
to prevent the given player from being awarded credits
Called before a player's role start-of-round popup message is displayed, allowing the parameters to be added to.
Realm: Client
Added in: 1.2.7
Parameters:
Return:
Called before a player's role start-of-round popup message is displayed, allowing the target translation string to be changed.
Realm: Client
Added in: 1.5.11
Parameters:
Return:
Called after all roles and role modifications have been loaded.
Realm: Client
Added in: 1.5.3
Called after an external role has been registered.
Realm: Client
Added in: 1.5.3
Parameters:
Called after the role weapons configuration is loaded.
Realm: Client and Server
Added in: 1.6.17
Called after a role weapon configuration is changed for a specific role and weapon.
Realm: Client and Server
Added in: 1.6.17
Parameters:
WEPS.BuyableWeapons
WEPS.ExcludeWeapons
WEPS.BypassRandomWeapons
Called before a player's row in the scoreboard (tab menu) is shown, allowing the name to be changed.
Realm: Client
Added in: 1.1.9
Parameters:
Return:
Called before a player's row in the scoreboard (tab menu) is shown, allowing the colors and icon to be changed.
Realm: Client
Added in: 1.1.9
Parameters:
Return:
Called before each round summary screen is shown with the winning team. Used to add roles to the secondary win display (e.g. AND THE OLD MAN WINS).
Realm: Client
Added in: 1.4.1
Parameters:
Called before the round summary screen is shown. Used to modify the color, position, and icon for a player.
Realm: Client
Added in: 1.1.5
Parameters:
Return:
Called multiple times before the round end screen is shown with the winning team. For each tab of the round end screen that shows the winning team, this hook is first called with WIN_INNOCENT
to get the default value and then called with the actual winning team. Return a new win title object to override what would normally be shown on the round end screen. This should be used by roles to customize what is shown on the round summary screen.
Realm: Client
Added in: 1.0.14
Parameters:
Return:
txt
Called multiple times before the round end screen is shown with the winning team. For each tab of the round end screen that shows the winning team this is called with the winning team. Return a new win title object to override what would normally be shown on the round end screen. This should be used by external addons to change the look of the round summary screen, not by roles to set their custom win titles. For a role's custom win title, use TTTScoringWinTitle
instead.
Realm: Client
Added in: 1.7.3
Parameters:
Return:
txt
Called before players are randomly assigned roles. If a player is assigned a role during this hook, they will not be randomly assigned one later.
Realm: Server
Added in: 1.0.0
Parameters:
Called before players are assigned a detective role, allowing the available roles and their weights (how many times they appear in the table) to be manipulated.
Realm: Server
Added in: 1.2.3
Parameters:
Called before players are assigned a independent role, allowing the available roles and their weights (how many times they appear in the table) to be manipulated.
Realm: Server
Added in: 1.2.3
Parameters:
Called before players are assigned an innocent role, allowing the available roles and their weights (how many times they appear in the table) to be manipulated.
Realm: Server
Added in: 1.2.3
Parameters:
Called before players are assigned a jester role, allowing the available roles and their weights (how many times they appear in the table) to be manipulated.
Realm: Server
Added in: 1.2.3
Parameters:
Called before players are assigned a monster role, allowing the available roles and their weights (how many times they appear in the table) to be manipulated.
Realm: Server
Added in: 1.2.3
Parameters:
Called before players are assigned a traitor role, allowing the available roles and their weights (how many times they appear in the table) to be manipulated.
Realm: Server
Added in: 1.2.3
Parameters:
Called after each section of the help menu's Config tab has been created, allowing developers to add controls to that section.
Realm: Client
Added in: 1.7.3
Parameters:
Called after the Config tab of the help menu has been created, allowing developers to add sections to it.
Realm: Client
Added in: 1.7.3
Parameters:
Called for each role, allowing developers to add a configuration section for it.
Realm: Client
Added in: 1.7.3
Parameters:
Return:
true
to add this role config section to the dialog. If you have no opinion (e.g. let other logic determine this) then don't return anything at all.
Called when a player buys a random item from the shop.

Realm: Server
Added in: 1.6.16
Parameters:
Called when a player who is being shown a role-specific spectator HUD presses a button, allowing the hook to intercept that button press and perform specific logic if necessary.
Realm: Server
Added in: 1.3.1
Parameters:
Return:
Called when a player should be shown a role-specific spectator HUD, allowing that role's logic to render the HUD as needed.
Realm: Client
Added in: 1.3.1
Parameters:
Called when determining what speed the player should be moving at.
NOTE: This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.
Realm: Client and Server
Added in: 1.0.0
Parameters:
Called when determining if a player is sprinting. Allows overriding of which directional key needs to be pressed for sprinting to start.
NOTE: This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.
Realm: Client and Server
Added in: 1.0.0 on Client and 1.8.8 on Server
Parameters:
Return: The IN_* enum value representing the key that must be pressed in addition to IN_SPEED
to start sprinting. If none provided, default of IN_FORWARD
will be used.
Called after a player's sprint stamina is reduced. Used to adjust the player's new stamina amount.
NOTE: This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.
Realm: Client and Server
Added in: 1.0.2 on Client and 1.8.8 on Server
Parameters:
Return: The stamina value to assign to the player. If none is provided, the player's stamina will not be changed.
Called before a player's sprint stamina is recovered. Used to adjust how fast the player's stamina will recover.
NOTE: This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.
Realm: Client and Server
Added in: 1.3.6 on Client and 1.8.8 on Server
Parameters:
Return: The stamina recovery rate to assign to the player. If none is provided, the player's default stamina recovery rate will be used.
Called when a player starts or stops sprinting.
NOTE: This represents the change in player speed, not the change in the Sprinting
player variable.
NOTE: This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.
Realm: Client and Server
Added in: 1.8.8
Parameters:
.
Realm: Client
Added in: 1.2.7
Parameters:
COLOR_BLACK
).vmt
file for the particle. (Defaults to "particle/snow.vmt"
)Vector(0, 0, 30)
)Return:
Called when the server is syncing generated event IDs to the client.
Realm: Client
Added in: 1.4.6
Called when the server is syncing convars to global variables for client access.
Realm: Server
Added in: 1.2.7
Called when the server is syncing generated win IDs to the client.
Realm: Client
Added in: 1.4.6
Called before a player's overhead icon is shown, allowing you to block it.
Realm: Client
Added in: 1.3.5
Parameters:
Return: true
to stop this information from being rendered
Called before a player's target information (name, health, hint text, karma, and ring) are shown, allowing you to block it.
Realm: Client
Added in: 1.3.5
Parameters:
Return: true
to stop this information from being rendered
Called before a player's heath status (shown when you look at a player) is rendered.
Realm: Client
Added in: 1.2.5
Parameters:
Return:
false
to not show text at all
Called before an entity's hint label (shown when you look at an entity) is rendered.
Realm: Client
Added in: 1.2.5
Parameters:
Return:
false
to not show text at all
Called before an entity's hint text (shown when you look at an entity) is rendered.
Realm: Client
Added in: 1.2.5
Parameters:
ent:IsPlayer()
if neededReturn:
false
to not show text at alltext
. Return false
or nothing to not show secondary text at allsecondary_text
. If not provided, clr
value will be used instead (Added in 1.6.17)
Called before a player's karma status text (shown when you look at a player) is rendered.
Realm: Client
Added in: 1.2.5
Parameters:
Return:
false
to not show text at all
Called before player Target ID icon (over their head) is rendered to determine if the "KILL" icon should be shown.
Realm: Client
Added in: 1.1.9
Parameters:
Return: true
if the kill icon should be shown or false
if not. Returning nothing or a non-boolean value will default to the given showKillIcon value.
Called before a player's name (shown when you look at a player) is rendered.
Realm: Client
Added in: 1.2.5
Parameters:
Return:
false
to not show text at all
Called before an entity's Target ID ring (shown when you look at an entity) is rendered.
Realm: Client
Added in: 1.2.3
Parameters:
ent:IsPlayer()
if neededReturn:
false
if you don't want to override the color. NOTE: For some reason colors that are near-black do not render so try a lighter color if you are having trouble
Called before player Target ID icon (over their head) is rendered allowing changing the icon and color shown.
Realm: Client
Added in: 1.1.9
Parameters:
Return:
false
to stop the icon from being renderedtrue
, a "sprite_{ROLESHORTNAME}_noz.vmt" file must exist and if noZ is false
, a "sprite_{ROLESHORTNAME}.vmt" file must exist
Called before player Target ID text (shown when you look at a player) is rendered.
Realm: Client
Added in: 1.1.9
Parameters:
ent:IsPlayer()
if neededReturn:
false
to not show text at allfalse
to not show text at all
Called before a ragdoll's name (shown when you look at a ragdoll) is rendered.
Realm: Client
Added in: 1.2.5
Parameters:
Return:
false
to not show text at all
Called when a turncoat's team is changed
Realm: Server
Added in: 1.6.16
Parameters:
Called before a role's tutorial page is rendered. This can be used to allow a page to be shown when it normally would not be because the role is disabled. Useful for situations like showing the Zombie tutorial page when the Mad Scientist is enabled (because the Mad Scientist creates Zombies).
Realm: Client
Added in: 1.2.7
Parameters:
Return: true
to show this page when it normally would not be
Called before a role's tutorial page is rendered. This can be used to render a completely custom page with information about a role.
Realm: Client
Added in: 1.2.7
Parameters:
Return: true
to tell the tutorial page to use the content set in this hook rather than calling the TTTTutorialRoleText
hook
Called after a role's tutorial page is rendered. This can be used to provide additional data to show for a role.
Realm: Client
Added in: 1.5.3
Parameters:
Called before a role's tutorial page is rendered. This can be used to provide the text to show for a role.
Realm: Client
Added in: 1.2.7
Parameters:
Return: The string value to show on the tutorial page for this role. Can be HTML and will be rendered within a <div>
Called before a role's tutorial page is rendered but after TTTTutorialRoleText
is called. This can be used to provide additional text to show for a role.
Realm: Client
Added in: 1.5.3
Parameters:
</div>
tag, meaning additional HTML can be appended to the end without worrying about proper structure.
Return: The full string value to show on the tutorial page for this role. Should not include the closing </div>
tag as this is appended automatically.
Called after globals are synced but but before role colors and strings are set. Can be used to update role states (team membership) and role weapon (buyable, loadout, etc.) states based on configurations.
Realm: Client and Server
Added in: 1.2.7
Called after a vampire eats a body.
Realm: Server
Added in: 1.6.16
Parameters:
Called when a vampire starts or ends their invisibility.
Realm: Server
Added in: 1.6.16
Parameters:
Called after the TTTCheckForWins
has already been called, allowing for an addon to block a win. Used for roles like the clown and the drunk to have them activate when the round would normally end the first time.
Realm: Server
Added in: 1.3.1
Parameters:
Called after a win condition has been set and right before the round eds. Used for roles like the old man that perform some logic before the end of the round without changing the outcome.
Realm: Server
Added in: 1.3.1
Parameters:


Old Flash Walkarounds
[S] Act 4
[S] Past Karkat: Wake Up.
[S] John: Enter Village.
[S] Kanaya: Return to the core.
[S] Equius: Seek the highbl00d.
launch
[s] Past Karkat: Wake Up.
Javascript Required!
Original page:


FAQ
Rental Policy
Privacy Policy
Terms & Conditions
1. General; Rental Not Purchase; Adult Agreement Required.
This Agreement contains all the terms and conditions governing Your rental of Products from The Mercer Club,
Inc. via themercerclubnyc.com website from time to time. You agree that Your general use of our Website,
other than rental orders as set forth in this Agreement, is subject in all respects to our Website Terms and
Conditions of Use available at Terms & Conditions and Privacy Policy at Privacy, as such terms may
change from time to time. No other terms or conditions (preprinted or otherwise) shall have any force or
effect. You agree and acknowledge that You are renting the Products and that ownership of the Products
remains with The Mercer Club, Inc. at all times.
Our Products may be rented for use by individuals under 18 years of age, but rentals are made only to
adults who must provide credit card information which must be approved by our merchant and processing
agent. If You are under 18 years of age, You may accept these terms and conditions and order Products only
with involvement and approval of Your parent or legal guardian. We currently and generally limit the
number of articles of clothing that can be rented by You and our other customers to TWO (2) at any time.
Your purchase of a subscription provides you one (1) or two (2) articles of clothing per order, quantities
of each as defined by your membership plan, that can be in your possession at any given time until the
rental period of three (3) days is over so long as you continue to make RECURRING payments for your
membership each month.
2. Rental Fees; Credit Card Authorizations; Cancellations.
The rental fee (“Rental Fee”) for the Products will be the monthly rental fee (as defined on the website for
your specific membership) PLUS any insurance or shipping charges listed on the website in connection with
your membership.
Upon Your order, You hereby authorize us to charge your credit card for the
Rental Fee and / or monthly subscription fee on a RECURRING basis whereby your card will be automatically
charged thirty days from the commencement of your membership. We will charge Your credit card the amount of
the Rental Fee immediately upon Your rental order or checkout where you confirm and submit – “Check Out”.
In addition, at the time of Your order of a Product, You hereby authorize The Mercer Club, Inc. to charge
Your credit card for the ORIGINAL RETAIL VALUE of that Product (when new) as set forth, plus any applicable
sales taxes (“Retail Value”); provided that we will only charge the Retail Value in the circumstances set
forth in Section 4 below.
Rental Fees exclude all federal, state and local taxes, fees, customs,
duties, levies and other governmental assessments, all of which shall be paid by You directly or, if paid by
The Mercer Club, Inc., shall be reimbursed by You to The Mercer Club, Inc. in connection with Your order for
the rental.
You may cancel your membership at any time prior to the renewal of your membership to
The Mercer Club to avoid being charged for another month. Canceling account post renewal date will result in
your account being charged for an entire month of The Mercer Club membership. Once you cancel your
membership, you are responsible for submitting to the U.S. Postal Service (USPS) through Priority Mail any
outstanding articles of clothing or accessories in your possession within THREE (3) CALENDAR DAYS. Failure
to do so will result in you being charged for the entire value of the Product, which at that point will be
yours to keep.
3. The Mercer Club Offering.
a. Delivery
All deliveries will be made as per The Mercer Club delivery and mailing schedules. Sometimes The Mercer
Club Products may appear slightly different in color and style than the photos displayed on our website.
Our liability to you for not meeting your satisfaction is limited to refund of a maximum of one month’s
rental fee divided by 4 (excluding insurance and any relevant delivery charges) as determined by us. See
Section 5(b) below.
b. Guarantees
Return of Unworn Products Due to Size. If Your Product does not fit You, then You may return the
Product(s) to us by simply mailing to us using the pre-paid label and inform us via email or phone that
you are returning the Product(s) in conformance with the return procedures in Section 4(b) below (a
“Sizing Return”). Unless you are completely dissatisfied with your garments, no refund will be issued
and another Product will be mailed to you automatically.
c. Cleaning
All Products will be professionally cleaned and delivered ready to wear for each consumer. We tumble
wash and / or dry clean and inspect each product with the utmost care, but use of the product is at your
own risk and The Mercer Club, Inc. shall not be held liable for any health-related complaints associated
with a product rented from our site.
d. Return Packaging
With delivery of the Product, we will provide You with a pre-paid, pre-addressed envelope or box as
well as instructions for Your use in returning the Products to The Mercer Club, Inc. (“Return
Packaging”).
e. Services
On our Website, we offer various Services to assist You in selecting a Product. Our Services are
provided “AS IS” without guarantee as to results.
4. Your Commitments to Us; Payment of Retail Value.
a. Receipt of the Products
Upon shipment, You bear responsibility for the Product(s). In the event that an unsecure shipping
address is provided, The Mercer Club, Inc. does not bear liability for Products left unattended.
Furthermore, You acknowledge that providing anything other than a secure shipping address may result in
delivery delays and additional delivery fees for which The Mercer Club, Inc. is not to be held liable,
but You will be held liable.
b. Use of the Products
You agree to treat the Products with great care, and return it in the same condition as was delivered
to you. You are completely responsible for loss, destruction or damage to the Products due to theft,
disappearance, fire, stains or any other cause, other than normal wear and tear. Normal wear and tear
encompasses minor stains, missing beads, stuck zippers or other minor damage covered by the subscription
price you paid in order to rent the Product. If You return a Product that is damaged beyond normal wear
and tear, then You agree that we shall charge You, and You shall pay, for repairing or replacing the
Product, as determined in our discretion, as advertised on our site OR explained to you in the package
delivered to you.
c. Payment of Retail Value
You agree to treat the Products with great care, and return it in the same condition as was delivered
to you. You are completely responsible for loss, destruction or damage to the Products due to theft,
disappearance, fire, stains or any other cause, other than normal wear and tear.
-
Collections: If You do not pay the amounts You owe us when due, then we may institute collection
procedures. You agree to pay our costs of collection, including without limitation reasonable attorneys’
fees.
- Removal: We reserve the right to terminate your right to be a member of The Mercer
Club at any time in the event of Your breach of this Agreement or for no reason or any other reason in
our discretion.
d. Email
We will use the preferences and orders You provide on our Website to send You e-mails and other
marketing materials for other Products. You may opt out of receiving those e-mails by clicking on the
links provided at the bottom of those e-mails when available.
e. Limited Warranty
The limited warranties set forth in Section 3 apply only to You, may be acted upon only by You, and may
not be assigned, sold or transferred to any third party. No warranties are granted other than as set
forth in Section 3. Our warranty herein shall not apply to any matters arising from violation of Your
commitments set forth in Section 4 of this Agreement.
f. Remedies
Your sole and exclusive remedy and The Mercer Club, Inc.’s sole and exclusive liability for a breach of
The Mercer Club, Inc.’s limited warranty shall be, at The Mercer Club, Inc.’s option, The Mercer Club,
Inc.’s use of its commercially reasonable efforts to replace the non-conforming Product in a timely
manner or a refund of Your Rental Fee (excluding insurance and delivery charges).
g.
5. Limitation of Liability.
a. No Indirect Damages.
IN NO EVENT SHALL THE MERCER CLUB, INC.  LE
TOTE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR LOSSES.
b. Limited Direct Damages.

6. Miscellaneous.
This Agreement constitutes the entire agreement between You and The Mercer Club, Inc. with respect to the
subject matter hereof and is the final, complete, and exclusive statement of the terms of the Agreement,
superseding all prior written and oral agreements, understandings and undertakings with respect to the
subject matter hereof. Modifications may be made only by The Mercer Club, Inc. We reserve the right to
terminate or amend this Agreement at any time for any or no reason, effective upon notice to You of such
termination or amendment. The waiver of any term or condition or any breach thereof shall not affect any
other term of condition of this Agreement. The Agreement shall be governed by and construed in accordance
with the laws of the State of New York, excluding its conflicts of laws principles. You shall not assign
this Agreement without The Mercer Club, Inc.’s prior written consent. Termination of this Agreement will not
relieve.
Sections 1, 2, 3, 4, 5, 6 and 7 shall survive this termination of this Agreement
according to their terms. If any provision of this Agreement shall be held illegal, unenforceable, or in
conflict with any law of any authority having jurisdiction over this Agreement, the validity of the
remaining portions or provisions hereof shall remain in full force and effect. The Mercer Club, Inc. shall
not be liable for failure to perform any of its obligations hereunder by reason that are beyond its
reasonable control, including, without limitation, fire, earthquake, interruptions in supply, other natural
disaster, war embargo, and/or riots or acts of terrorism.
NEWSLETTER SIGN-UP
SIGN-UP FOR NEWSLETTER


ModalButtonComponent
ModalButtonComponent can be attached to a button-like element to open a modal dialog box.
ModalButtonComponentOptions
| Option | Type | Description | Default |
|---|---|---|---|
| modalOpenAttr | {string} | Attr name used on the button to determine which modal to open. | data-modal-open |
| modalIdAttr | {string} | Attr name used to identify which element to grab the modal contents from. The first child element of that parent element that matches the modal id will be placed into the modal of the modal when opened. | data-modal-id |
| enableHashHistory | {boolean} | If enabled, opening a modal dialog will push a hash url to html5 history. When opening a new page with a #hash in the url, the modal will automatically open. | false |
| onOpen | {function} | A callback function that's called when the modal is opened. | false |
| onClose | {function} | A callback function that's called when the modal is closed. | false |
Example
Press the button below to open the "foo" modal dialog.
This is the contents of "foo" modal.
HTML
<button class="modal-button" data-modal-open="foo">Open "foo" modal</button>

This is the contents of "foo" modal.

SASS
@import 'airkit2/modal/modal'
.foo
background-color: #fff
left: 50%
padding: 80px 120px
position: absolute
top: 50%
transform: translateX(-50%) translateY(-50%)
JavaScript
import {Registry} from 'airkit2';
import {ModalButtonComponent} from 'airkit2/modal';
const app = new Registry();
const modalOptions = {enableHashHistory: true};
app.register('modal-button', ModalButtonComponent, modalOptions);
document.addEventListener('DOMContentLoaded', () => {
app.run();
});


[gecode-users] AFC decay with global AFC in search engines
Kish Shen
kisshen at cisco.com
Fri May 23 04:12:51 CEST 2014
Hi Christian,
Thanks for this. I decided to change my code to ude INT_VAR_AFC_* with a
decay argument, and then I tried to rerun the test. However, I now get
a Gecode exception "AFC: Illegal decay factor" for a factor of 0.0 with
IntAFC afc(*solver, vars, 0.0);
while previously, I was able to set the decay factor to 0 with
afc_decay(0.0).
I assume this is because of a > vs >= test for the valid value. Should
this be changed? It seems 0 should be a legal value (even if it is not
too sensible).
On a related note, from the description in the MPG, I assume there is
only a single AFC decay factor, so setting the decay factor with
IntAFC afc(*solver, vars, decay)
will also change the "global" decay factor, i.e. the one obtained by
afc_decay(). Is this correct?
Cheers,
Kish
More information about the users
mailing list


This is a Pac-Man inspired project for testing screen bounds.
This is a project for testing mouse events and updating the DOM.
This is a project for testing API calls and updating the DOM.
Personal project to practice ReactJS.
This was our final project for Module 2.


Start And Manage A Book Club With This App
by Emily PriceBook clubs are one of the things that are notoriously hard to manage.
Sure, if you’re lucky you have a group of friends who are all always available on the same day to meet and all have the exact same taste in books so picking your next one is an easy proposition. More than likely; however, you have friends with crazy schedules that can make finding a mutual day to meet a nightmare, and finding your next book sometimes involves deliberating the options so long that you probably could have just read all the choices.
Bookclubz is an app that can help.
The service has been available online for a while but launched an app for iOS and Android last week. With it, you can create a group for your book club, send invites for the meeting (and collect RSVPs so you know how many people are coming), and poll members about when the next meeting should take place or what you should read next.
Once your group finishes a book, you can rate it within the app. You can also see all the books your book club has read in the past, in case you’re trying to make a recommendation to a friend and can’t remember, as well as see what other book clubs are reading around the country, should you need a little inspiration.
The site and app are free to use and can be a great resource to keep everything organised, especially if your group is on the larger side.


--- layout: page title: About ---
I am currently a second-year M.Sc. student in Computer Science at Carleton University, supervised by Dr. Tony White. My study is focused on machine learning and my thesis topic is Graph-based Convolutional Network (GCN).
Click here to view my resume


Welcome!
Welcome to the official Natick High School Computer Science Club frontpage! We are the members of this club, which is a community of people passionate about coding at Natick High School: located in Natick, MA. The club helps coders come together to design meaningful projects and support other students in learning to code. To find out more about us, check out our About Us page.


|
Let
Love Lead The Way
(Spice Girls) |
|
What
makes this world go round
Will the answer let her down She is so sweet and young And her life has just begun What does her future hold that's the story left unknown Will she make it through her days, let our love lead the way Part of me laughs (ooooh) Part of me cries Part of me wants to question why (question why) What good is their joy And why is there pain (ooh) No matter what we must go on Just keep the faith And let love lead the way Everthing will work out fine If you let love... love lead the way Sitting there all alone In the window of her room Watching the world go by Brings tears to her eyes All she sees is hurt and pain, she wants to break the chain She'll keep pressing everyday and she'll find her own sweet way Part of me laughs (..me laughs) Part of me cries (I cry) Part of me wants to question why (wants to question why) One day you're here (you're here) Next youne are go (you're gone) No matter what we must go on (I will go on) Just keep the faith (keep your faith) And let love lead the way (I know, I know, I know, ooh whoa..) You can be all that and still can be who you are You gotta know for sure that it isn't make believe You may feel weak but you are strong Don't you give up if... If you keep holding on, you'll never be wrong Just close your eyes cause it lies deep in your heart, yeah Part of me laughs Part of me cries (I cry) Part of me wants to question why (question...) One day you're here (you're here) Next you're are go (you're gone) No matter what we must go on (I will) Just keep the faith And let love lead the way (lead the way) Everthing will work out fine If you let love... love lead the way Love lead the way |


GreenlandFulfill your dream of visiting the Arctic Circle by taking a trip to Greenland, surely one of the best holiday destinations in the world.Greenland is the perfect place for a scenic boat trip that will take you across various icebergs and let you have a refreshing encounter with whales, walruses, and many more sea creatures. |
|
CappadociaThis marvelous city is known for its unique rock formations that have caves with ancient Islamic inscriptions. Mixed with the exotic culture and fascinating history of Turkey, this place is perfect for a romantic honeymoon, a trip with family, or even a solo backpacking adventure, making it one of the best places to visit in May outside India. |
|
LondonLondon is world-famous for its blissful summer weather, strict British guards that stand outside the revered Buckingham Palace, and the delicious fish and chips that will keep you coming back for more! There are plenty of reasons why it’s one of the best places to visit in May out of India, but it’s charming festivals like St. |
|
PragueLooking for some absolutely magical places to visit in May outside India? Well, Prague has everything to make that dream come true! From the melodiousness tunes of the Municipal House to the peace of the Spanish synagogue, everything in this city is worth visiting. |


Specification run results
Project: <<Change Name>>
Version: Unknown
Specifications summary:
Created on Thu Mar 12 15:14:20 PDT 2020 by Syed Riyaz
Total
Passed
Failed
Feature failures
Feature errors
Success rate
Total time
1
0
1
1
0
0.0%
1 minutes, 6.859 seconds
Specifications:
Name
Features
Failed
Errors
Skipped
Success rate
Time
specs.RegFinStatementSpec
1
1
0
0
0.0%
1 minutes, 6.859 seconds


Toggle navigation
♫
Home
Login / Register
About
Our Artists
Services
Gallery
Contact
♪
Information
Full Name:
Address:
Gender:
Male
Female
Birthday:
Class Type:
Vocals (8 Sessions)
Piano (8 Sessions)
Guitar (8 Sessions)
Music Whiz (3 - 5 yo)
Ballet Lessons
Dance Lessons
Swimming (8+, 12S)
Swimming (5-7, 12S)
Phone Number:
Picture:
Billing
Marrian Geronimo
Swimming (8+, 12S)
P 4, 500
Pool Fee
P 50
Total
P 4, 550
Submit
♪ © 2019 ♫
Joebert Celestial, Marrian Geronimo, Domingo Adduru, David Imperial


--- layout: post status: publish published: true title: 'The Emergence of Super Emilio 64 ' author: display_name: Luke Jett login: Luke email<EMAIL_ADDRESS>url: '' author_login: Luke author_email<EMAIL_ADDRESS>wordpress_id: 9646 wordpress_url: http://ivyenvy.com/?p=9646 date: '2014-04-09 07:43:09 +0000' date_gmt: '2014-04-09 12:43:09 +0000' categories: - Infield tags: - Juan Pierre - Emilio Bonafacio - Ricky Renteria comments: - id: 10596 author: James Whiting author_email: '' author_url: '' date: '2014-04-09 12:04:41 +0000' date_gmt: '2014-04-09 17:04:41 +0000' content: He keeps this up he will be traded at the end of the month ---
As the Cubs lost last night for a fifth time in their first seven games, everyone tries to find out what the bright spots of the season are so far. Sure the starting pitching has been fantastic, excluding Edwin Jackson's start last night, and the confidence being back for stars, like Anthony Rizzo and Starlin Castro,are fantastic starting points for a young season. But when looking up and down the Cubs lineup, one name stands out as a breakout star over the last week or so. And his new nickname is Super Emilio 64.
For those not recognizing that nickname, it is Cubs super utility man Emilio Bonifacio. The nickname stirs from "Super Mario 64", the old Nintendo game, but replaced with Emilio. The 64 stays because that is what number he is. It fits perfectly.
Bonifacio, acquired in February after the Royals released him, has gotten off to a scorching start. After a 3-5 performance last night, Bonifacio is leading the league with 17 hits and a .515 average. If those numbers don't impress you (they should) he has accumulated already 0.6 WAR prior to last nights game. His WAR last year with the Marlins and Royals last year? 0.6. Also, his OPS of 1.131 is in the top 10 in the National League.
The key to his early season success? Getting on base and having better plate discipline. His .556 OBP is tops in the NL and third in baseball. Also, his strikeout rate is down from his career average and his walk rate is up. Even without the base hits, he is still getting on base and causing havoc. He is a perfect 5/5 in stolen base attempts, which leads MLB, and gives the Cubs a productive top of the order hitter who can score runs, which he is near the top of the leader board in that category too.
Now, Bonifacio won't hit .515 for the entire year (wouldn't that be nice), but he does look very comfortable in the lead-off spot. Manager Rick Renteria has slotted Emilio in center field and second base just to get him in the lineup everyday. The Cubs haven't had a prototypical lead-off hitter since Juan Pierre back in 2006, and he led the league in hits that year. Now, am I saying Bonifacio will lead the league in hit? No. But he does bring an element to the Cubs offense that has been lacking the past couple years. If Bonifacio can hit around .280, steal 35-40 bags, and continue to get on base at a decent clip, he is going to have a big year. The Cubs lineup just has to drive him in.


So, we're all done!
Your certificates have been saved to the "
{}
" folder
amp templates
Share
Create Another
© Copyright 2019 LordGhostX - All Rights Reserved


{% load i18n %}
{% blocktrans with city=event.city %}Hello team {{ city }}!{% endblocktrans %}
{% trans "Congratulations on running your own Django Girls event! We're super proud and so so so happy for you :)" %}
{% trans "Numbers" %}
{% url 'admin:core_event_change' event.id as event_url %}
{% blocktrans trimmed with base_url=settings.BASE_URL %}
Whenever you have a little bit of time, we would be super grateful if you could fill out this form
to provide information how many people attended your workshop. This will help us show the global impact that Django Girls is having on the world! :)
{% endblocktrans %}
{% trans "Tell us how it went!" %}
{% trans "We’d love to hear from you more about the workshop: how it went? Have you enjoyed it? What was your favourite moment of it? We wanna hear *everything* :)" %}
{% trans "Share your experiences" %}
{% blocktrans %}If you want to write on your experience as an organizer or share with the community all the awesome things that happened during your event, you can write a post on our blog.  You can do it here.{% endblocktrans %}
{% trans "Upload your photos" %}
{% blocktrans %}If you would like to add photos from your event to our Flickr account, just let us know and we will provide you with information how to do it.{% endblocktrans %}
{% trans "Donation" %}
{% url 'donations:index' as donations_url %}
{% blocktrans trimmed with base_url=settings.BASE_URL %}
If you have any money leftover from your workshop, consider donating it to
Django Girls Foundation, a non-profit that supports organizers all over the world.
{% endblocktrans %}
{% trans "Discount in our store" %}
{% blocktrans trimmed with discount_code=settings.STORE_DISCOUNT_CODE %}
Use the code "{{ discount_code }}" to get a 15% discount on your order in our store. You can share this code with your coaches and attendees. All proceeds will go to Django Girls Foundation (non-profit organization).
{% endblocktrans %}
{% url 'organize:index' as organize_url %} {% blocktrans trimmed with base_url=settings.BASE_URL %} If you want to plan another event someday, don't hesitate to fill out the organizing form again. {% endblocktrans %}
{% trans "Thanks and congrats yet again, you're awesome!" %}
{% trans "Hugs, rainbows and sunshines!" %}
Django Girls


Don’t believe every worried thought you have. Worried thoughts are notoriously inaccurate. - Renee Jain
Feel the feeling but don’t become the emotion. Witness it. Allow it. Release it. - Crystal Andrus
If it comes, let it come. If it goes, it’s ok, let it go. Let things come and go.  - Germany Kent


Description:
Registers a C# background task for a time trigger event and adds the application to the lock screen. The background task runs every 15 mins provided the app is on the lock screen.
Register
Unregister
Unregistered
Progress:


{include file="father/header" /}
{include file="moblie/coursetest" /}
{include file="father/footer" /}


class: center, middle, inverse, title-slide # Lecture 4 ## Optimization ### Ivan Rudik ### AEM 7130 --- # Software and stuff Necessary things to do: - Install the QuantEcon Julia package - Install the Optim or NLOpt Julia packages --- # Optimization All econ problems are optimization problems -- - Min costs -- - Max PV E[welfare] --- # Optimization Some are harder than others: -- - Individual utility max: easy -- - Decentralized electricity market with nodal pricing and market power: hard -- - One input profit maximization problem: easy -- - N-input profit maximization with learning and forecasts: hard --- # Things we will do 1. Linear rootfinding 2. Non-linear rootfinding 3. Complementarity problems 4. Non-linear unconstrained maximization/minimization 5. Non-linear constrained maximization/minimization --- # Linear rootfinding How do we solve these? -- Consider a simple generic problem: `\(Ax = b\)` -- Invert `\(A\)` `\(x = A^{-1}b\)` -- ## THE END --- # Non-linear rootfinding With non-linear rootfinding problems we want to solve: `\(f(x) = 0, f:\mathbb{R}\rightarrow\mathbb{R}^n\)` -- What's a common rootfinding problem? -- Can we reframe a common economic problem as rootfinding? -- Yes! -- Fixed point problems are rootfinding problems: -- `\(g(x) = x \Rightarrow f(x) \equiv g(x) - x = 0\)` --- # Rootfinding with constraints Economic problems virtually always involve constraints -- These constraints may or may not be binding -- e.g. a firm profit max problem: a control vector `\(x\)` may be constrained to be `\(x \in [a,b]\)` -- This results in a complementarity problem: -- `\begin{align} x_i > a_i \Rightarrow f_i(x) \geq 0 \,\,\, \forall \, i=1,...,n \\ x_i < b_i \Rightarrow f_i(x) \leq 0 \,\,\, \forall \, i=1,...,n \end{align}` -- What do these equations mean? --- # Rootfinding with constraints `\begin{align} x_i > a_i \Rightarrow f_i(x) \geq 0 \,\,\, \forall \, i=1,...,n \\ x_i < b_i \Rightarrow f_i(x) \leq 0 \,\,\, \forall \, i=1,...,n \end{align}` If the constraints on `\(x_i\)` do not bind, `\(a_i < x_i < b_i\)`, then the first-order condition is precisely zero -- Suppose the upper bound binds, `\(x_i = b_i\)` -- Then `\(f_i(x) \geq 0\)` since `\(x_i > a_i\)`, but we can't guarantee that `\(f_i(x) = 0\)` because `\(f_i(x)\)` might still be increasing --- # Basic non-linear rootfinders: Bisection method What does the intermediate value theorem tell us? -- If a continuous real-valued function on a given interval takes on two values `\(a\)` and `\(b\)`, it achieves all values in the set `\([a,b]\)` somewhere in its domain -- How can this motivate an algorithm to find the root of a function? --- # Basic non-linear rootfinders: Bisection method If we have a continuous, 1 variable function that is positive at some value and negative at another, a root must fall in between those values -- We know a root exists by IVT, what's an efficient way to find it? -- Continually bisect the interval! -- .hi-blue[Write out the code to do it] --- # The bisection algorithm ```julia function bisection(f, lower_bound, upper_bound) tolerance = 1e-3 # tolerance for solution guess = 0.5*(upper_bound + lower_bound) # initial guess, bisect the interval difference = (upper_bound - lower_bound)/2 # initialize bound difference while difference > tolerance # loop until convergence println("Intermediate guess of $guess.") difference = difference/2 if sign(f(lower_bound)) == sign(f(guess)) # if the guess has the same sign as the lower bound lower_bound = guess # solution is in the upper half of the interval guess = guess + difference else # else the solution is in the lower half of the interval upper_bound = guess guess = guess - difference end end println("The root of f(x) is at $guess.") end; ``` --- # The bisection method ```julia f(x) = x^3 ``` ``` ## f (generic function with 1 method) ``` ```julia bisection(f, -4, 1) ``` ``` ## Intermediate guess of -1.5. ## Intermediate guess of -0.25. ## Intermediate guess of 0.375. ## Intermediate guess of 0.0625. ## Intermediate guess of -0.09375. ## Intermediate guess of -0.015625. ## Intermediate guess of 0.0234375. ## Intermediate guess of 0.00390625. ## Intermediate guess of -0.005859375. ## Intermediate guess of -0.0009765625. ## Intermediate guess of 0.00146484375. ## Intermediate guess of 0.000244140625. ## The root of f(x) is at -0.0003662109375. ``` --- # The bisection method ```julia g(x) = 3x^3 + 2x -4 ``` ``` ## g (generic function with 1 method) ``` ```julia bisection(g, -6, 4) ``` ``` ## Intermediate guess of -1.0. ## Intermediate guess of 1.5. ## Intermediate guess of 0.25. ## Intermediate guess of 0.875. ## Intermediate guess of 1.1875. ## Intermediate guess of 1.03125. ## Intermediate guess of 0.953125. ## Intermediate guess of 0.9140625. ## Intermediate guess of 0.89453125. ## Intermediate guess of 0.904296875. ## Intermediate guess of 0.8994140625. ## Intermediate guess of 0.90185546875. ## Intermediate guess of 0.900634765625. ## The root of f(x) is at 0.9012451171875. ``` --- ```julia h(x) = cos(x) ``` ``` ## h (generic function with 1 method) ``` ```julia bisection(h, -pi, pi) ``` ``` ## Intermediate guess of 0.0. ## Intermediate guess of -1.5707963267948966. ## Intermediate guess of -2.356194490192345. ## Intermediate guess of -1.9634954084936207. ## Intermediate guess of -1.7671458676442586. ## Intermediate guess of -1.6689710972195777. ## Intermediate guess of -1.6198837120072371. ## Intermediate guess of -1.595340019401067. ## Intermediate guess of -1.5830681730979819. ## Intermediate guess of -1.5769322499464393. ## Intermediate guess of -1.573864288370668. ## Intermediate guess of -1.5723303075827824. ## The root of f(x) is at -1.5715633171888395. ``` --- # The bisection method The bisection method works by continually bisecting the interval and only keeping the half interval with the zero until "convergence" 1. Select the midpoint of `\([a,b]\)`, `\((a+b)/2\)` 2. Zero must be in the lower or upper half 3. Check the sign of the midpoint, if it has the same sign as the lower bound a root must be the right subinterval 4. Select the midpoint of `\([(a+b)/2,b]\)`... --- # The bisection method The bisection method is incredibly robust: if a function `\(f\)` satisfies the IVT, it is .hi-blue[guaranteed to converge in a specific number of iterations] -- A root can be calculated to arbitrary precision `\(\epsilon\)` in a maximum of `\(log([b-a]/\epsilon)/log(2)\)` iterations Robustness comes with drawbacks: 1. It only works in one dimension 2. It is slow because it only uses information about the function's level --- # Function iteration Fixed points can be computed using function iteration -- Since we can recast fixed points as rootfinding problems we can use function iteration to find roots too -- .hi-blue[Code up a function iteration problem] --- # Function iteration Function iteration is pretty simple to implement ```julia function function_iteration(f, guess) tolerance = 1e-3 # tolerance for solution x_old = guess # initialize old x value x = 1e-10 # initialize current x difference = 1e10 # initialize bound difference @time while abs(difference) > tolerance # loop until convergence println("Intermediate guess of $x.") x = f(x_old) # new x = f(old x) difference = x - x_old x_old = x end println("The fixed point of f(x) is at $x.") end; ``` --- ```julia f(x) = x^(-0.5) ``` ``` ## f (generic function with 1 method) ``` ```julia function_iteration(f, 2.) ``` ``` ## Intermediate guess of 1.0e-10. ## Intermediate guess of 0.7071067811865475. ## Intermediate guess of 1.189207115002721. ## Intermediate guess of 0.9170040432046712. ## Intermediate guess of 1.044273782427414. ## Intermediate guess of 0.9785720620877. ## Intermediate guess of 1.0108892860517007. ## Intermediate guess of 0.9945994234836331. ## Intermediate guess of 1.0027112750502025. ## Intermediate guess of 0.9986471128909702. ## Intermediate guess of 1.0006771306930664. ## Intermediate guess of 0.9996616064962437. ## 0.002640 seconds (909 allocations: 237.169 KiB) ## The fixed point of f(x) is at 1.0001692397053021. ``` --- # Function iteration

 --- # Function iteration Function iteration can be quick, but is not always guaranteed to converge --- # Newton's method Newton's method and variants are the workhorses of solving n-dimensional non-linear problems -- What's the idea? -- Take a hard non-linear problem and replace it with a sequence of linear problems -- Under certain conditions the sequence of solutions will converge to the true solution --- # Newton's method Here's a graphical depiction of Newton's method:

 --- # Newton's method

 Start with an initial guess of the root at `\(x^{(0)}\)` -- Approximate the non-linear function with its first-order Taylor expansion about `\(x^{(0)}\)` -- This is just the tangent line at `\(x^0\)`, solve for the root of this linear approximation, call it `\(x^{(1)}\)` --- # Newton's method

 Repeat starting at `\(x^{(1)}\)` until we converge to `\(x^*\)` -- This can be applied to a function with an arbitrary number of dimensions --- # Newton's method Begin with some initial guess of the root vector `\(\mathbf{x^{(0)}}\)` -- Our new guess `\(\mathbf{x^{(k+1)}}\)` given some arbitrary point in the algorithm, `\(\mathbf{x^{(k)}}\)`, is obtained by approximating `\(f(\mathbf{x})\)` using a first-order Taylor expansion about `\(\mathbf{x^{(k)}}\)` and solving for `\(\mathbf{x}\)`: `\begin{gather} f(\mathbf{x}) \approx f(\mathbf{x^{(k)}}) + f'(\mathbf{x^{(k)}})(\mathbf{x^{(k+1)}}-\mathbf{x^{(k)}}) = 0 \notag \\ \Rightarrow \mathbf{x^{(k+1)}} = \mathbf{x^{(k)}} - \left[f'(\mathbf{x^{(k)}})\right]^{-1}f(\mathbf{x^{(k)}}) \notag \end{gather}` --- # Newton's method .hi-blue[Code up Newton's method] -- ```julia function newtons_method(f, f_prime, guess) diff = Inf # Initialize problem tol = 1e-5 x_old = guess x = 1e10 while abs(diff) > tol x = f(x_old) - f(x_old)/f_prime(x_old) # Root of linear approximation diff = x - x_old x_old = x end println("The root of f(x) is at $x.") end; ``` --- # Newton's method ```julia f(x) = x^3; f_prime(x) = 3x^2; newtons_method(f, f_prime, 1.) ``` ``` ## The root of f(x) is at 1.231347218094855e-6. ``` -- ```julia f(x) = sin(x); f_prime(x) = cos(x); newtons_method(f, f_prime, pi/4) ``` ``` ## The root of f(x) is at 5.941936124988917e-19. ``` --- # Newton's method Newton's method has nice properties regarding convergence and speed: If `\(f(x)\)` is continuously differentiable, the initial guess is "sufficiently close" to the root, and `\(f(x)\)` is invertible near the root, then Newton's method converges to the root -- What is "sufficiently close"? -- We need `\(f(x)\)` to be invertible so the algorithm above is well defined -- If `\(f'(x)\)` is ill-conditioned we can run into problems with rounding error --- # Quasi-Newton: Secant method We usually don't want to deal with analytic derivatives unless we have access to autodifferentiation -- Why? -- 1. Coding error / time 2. Can actually be slower to evaluate than finite differences for a nonlinear problem, see [Ken Judd's notes](http://ice.uchicago.edu/2008 presentations/Judd/Curse in Dallas.pdf) -- Alternative: finite differences instead of analytic derivatives -- Using our current root guess `\(x^{(k)}\)` and our previous root guess `\(x^{(k-1)}\)`: `\(f'(x^{(k)}) \approx \frac{f(x^{(k)})-f(x^{(k-1)})}{x^{(k)} - x^{(k-1)}}\)` --- # Quasi-Newton: Secant method Our new iteration rule then becomes -- `\(x^{(k+1)} = x^{(k)} - \frac{x^{(k)}-x^{(k-1)}}{f(x^{(k)})-f(x^{(k-1)})}f(x^{(k)})\)` -- Now we require two initial guesses so that we have an initial approximation of the derivative --- # Quasi-Newton: Secant method

 --- # Quasi-Newton: Broyden's method Broyden's method is the most widely used rootfinding method for n-dimensional problems -- It is a generalization of the secant method where have a sequence of guesses of the Jacobian at the root -- We must initially provide a guess of the root, `\(x^{(0)}\)`, but also a guess of the Jacobian, `\(A_{(0)}\)` --- # Quasi-Newton: Broyden's method Root guess update is the same as before but with our guess of the Jacobian substituted in for the actual Jacobian or the finite difference approximation `\(\mathbf{x^{(k+1)}} = \mathbf{x^{(k)}} - A_{(k)}^{-1} \, f(\mathbf{x^{(k)}}).\)` -- we still need to update `\(A_{(k)}\)`: we do this update is performed by making the smallest change, in terms of the Frobenius matrix norm, that satisfies what is called the *secant condition* (under determined if `\(n>1\)`): `\(f(\mathbf{x^{(k+1)}}) - f(\mathbf{x^{(k)}}) = A_{(k+1)}\left( \mathbf{x^{(k+1)}} - \mathbf{x^{(k)}} \right)\)` --- # Quasi-Newton: Broyden's method The updated differences in root guesses, and the function value at those root guesses, should align with our estimate of the Jacobian at that point -- `$$A_{(k+1)} = A_{(k)} + \\ \left[f(\mathbf{x^{(k+1)}}) - f(\mathbf{x^{(k)}}) - A_{(k+1)}\left( \mathbf{x^{(k+1)}} - \mathbf{x^{(k)}} \right)\right] \times \\ \frac{\mathbf{x^{(k+1)}} - \mathbf{x^{(k)}}}{(\mathbf{x^{(k+1)}} - \mathbf{x^{(k)}})^T(\mathbf{x^{(k+1)}} - \mathbf{x^{(k)}})}$$` --- # Accelerating Broyden Why update the Jacobian and then invert when we can just update an inverted Jacobian `\(B = A^{-1}\)` `\(B_{(k+1)} = B_{(k)} + \frac{[d^{(k)} - u^{(k)}]{d^{(k)}}^TB_{(k)}}{{d^{(k)}}^T u^{(k)}}\)` where `\(d^{(k)} = (\mathbf{x^{(k+1)}} - \mathbf{x^{(k)}})\)`, and `\(u^{(k)} = B_{(k)}\left[f(\mathbf{x^{(k+1)}})-f(\mathbf{x^{(k)}})\right]\)`. --- # Accelerating Broyden Broyden converges under relatively weak conditions: -- 1. `\(f\)` is continuously differentiable, 2. `\(x^{(0)}\)` is close to the root of `\(f\)` 3. `\(f'\)` is invertible around the root 4. `\(A_0\)` is sufficiently close to the Jacobian --- # Convergence speed Rootfinding algorithms will converge at different speeds in terms of the number of operations -- A sequence of iterates `\(x^{(k)}\)` is said to converge to `\(x^*\)` at a rate of order `\(p\)` if there is a constant `\(C\)` such that `\(||x^{(k+1)} - x^*|| \leq C||x^{(k)} - x^*||^p\)` for sufficiently large `\(k\)` --- # Convergence speed `\(||x^{(k+1)} - x^*|| \leq C||x^{(k)} - x^*||^p\)` If `\(C < 1\)` and `\(p = 1\)`, the rate of convergence is linear If `\(1 < p < 2\)`, convergence is superlinear, and if `\(p = 2\)` convergence is quadratic. The higher order the convergence rate, the faster it converges --- # Convergence speed How fast do the methods we've seen converge? -- - Bisection: linear rate with `\(C = 0.5\)` (kind of obvious once you see it) -- - Function iteration: linear rate with `\(C = ||f'(x^*)||\)` -- - Secant and Broyden: superlinear rate with `\(p \approx 1.62\)` -- - Newton: `\(p = 2\)` --- # Convergence speed Convergence rates only account for the number of .hi-blue[iterations] of the method The steps taken in a given iteration of each solution method may vary in computational cost because of differences in the number of arithmetic operations Although an algorithm may take more iterations to solve, each iteration may be solved faster and the overall algorithm takes less time --- # Convergence speed Ex: - Bisection method only requires a single function evaluation during each iteration - Function iteration only requires a single function evaluation during each iteration - Broyden's method requires both a function evaluation and matrix multiplication - Newton's method requires a function evaluation, a derivative evaluation, and solving a linear system -- Bisection and function iteration are usually slow Broyden's method can be faster than Newton's method if derivatives are costly to compute --- # Convergence speed Consider an example where `\(f(x) = x - \sqrt(x) = 0\)` What does convergence look like across our main approaches in terms of the `\(L^1-\)`norm if all guesses start at `\(x^{(0)} = 0.5\)`?

 --- # Complementarity problems: rootfinding Let: - `\(x\)` be an n-dimensional vector of some economic action - `\(a_i\)` denotes a lower bound on action `\(i\)`, and `\(b_i\)` denotes the upper bound on action `\(i\)` - `\(f_i(x)\)` denotes the marginal arbitrage profit of action `\(i\)` -- There are disequilibrium profit opportunities if 1. `\(x_i < b_i\)` and `\(f_i(x) > 0\)` (here we can increase profits by raising `\(x_i\)`) 2. `\(x_i > a_i\)` and `\(f_i(x) < 0\)` (we can increase profits by decreasing `\(x_i\)`) --- # Complementarity problems We obtain a no-arbitrage equilibrium if and only if `\(x\)` solves the complementary problem `\(CP(f,a,b)\)` -- We can write out the problem as finding a vector `\(x \in [a,b]\)` that solves `\begin{align} x_i > a_i \Rightarrow f_i(x) \geq 0 \,\,\, \forall i = 1,...,n \notag\\ x_i < b_i \Rightarrow f_i(x) \leq 0 \,\,\, \forall i = 1,...,n \notag \end{align}` -- At interior solution, the function be precisely be zero Corner solution at the upper bound `\(b_i\)` for `\(x_i\)` `\(\rightarrow\)` `\(f\)` must be increasing in direction `\(i\)` The opposite is true if we are at the lower bound --- # Complementarity problems Economic problems are complementarity problems where we are finding a root of a function (e.g. marginal profit) subject to some constraint (e.g. price floors) The Karush-Kuhn-Tucker theorem shows that `\(x\)` solves the constrained optimization problem if and only if it solves the complementarity problem --- # Complementarity problems .hi-blue[Example:] single commodity competitive spatial price equilibrium model - `\(n\)` regions of the world - excess demand for the commodity in region `\(i\)` is `\(E_i(p_i)\)` -- If no trade `\(\rightarrow\)` equilibrium condition is `\(E_i(p_i) = 0\)` in all regions of the world: a simple rootfinding problem -- Trade between regions has marginal transportation cost between regions `\(i\)` and `\(j\)` of `\(c_{ij}\)` - `\(x_{ij}\)`: the amount of the good shipped from region `\(i\)` to region `\(j\)` - capacity constraint: `\(b_{ij}\)` --- # Complementarity problems Marginal arbitrage profit from shipping a unit of the good from `\(i\)` to `\(j\)` is `\(p_j - p_i - c_{ij}\)` -- If it's positive: incentive to ship more goods to region `\(i\)` from region `\(j\)` If it's negative: incentive to decrease shipments -- At an equilibrium only if all the arbitrage opportunities are gone: for all region pairs `\(i\)` and `\(j\)` `\begin{gather} 0 \leq x_{ij} \leq b_{ij} \notag \\ x_{ij} > 0 \Rightarrow p_j - p_i - c_{ij} \geq 0 \notag \\ x_{ij} < b_{ij} \Rightarrow p_j - p_i - c_{ij} \leq 0 \notag \end{gather}` --- # Complementarity problems At an equilibrium only if all the arbitrage opportunities are gone: for all region pairs `\(i\)` and `\(j\)` `\begin{gather} 0 \leq x_{ij} \leq b_{ij} \notag \\ x_{ij} > 0 \Rightarrow p_j - p_i - c_{ij} \geq 0 \notag \\ x_{ij} < b_{ij} \Rightarrow p_j - p_i - c_{ij} \leq 0 \notag \end{gather}` --- # Complementarity problems How do we formulate this as a complementarity problem? -- Market clearing in each region `\(i\)` requires that net imports = excess demand -- `$$\sum_k [x_{ki} - x_{ik}] = E_i(p_i)$$` -- This implies that we can solve for the price in region `\(i\)`, `$$p_i = E_i^{-1}\left( \sum_k [x_{ki} - x_{ik}]\right)$$` --- # Complementarity problems Finally, if we define marginal arbitrage profit from shipping another unit from `\(i\)` to `\(j\)` as `$$f_{ij}(x) = E_j^{-1}\left( \sum_k[x_{kj} - x_{jk}] \right) - E_i^{-1}\left( \sum_k[x_{ki} - x_{ik}] \right) - c_{ij}$$` then `\(x\)` is an equilibrium vector of trade flows if and only if `\(x\)` solves `\(CP(f,0,b)\)` and `\(x\)`, `\(f\)`, and `\(b\)` are `\(n^2 \times 1\)` vectors Even this complex trade-equilibrium model can be reduced to a simple complementarity problem --- # Complementarity problems Decentralized models can generally be solved by reducing them to complementarity problems, e.g: 1. Competitive energy markets with cross-market cap and trade or capacity constraints 2. Federalism models 3. etc etc --- # Complementarity problems Four plots of marginal arbitrage profit `\(f_i(x)\)`, what is the equilibrium choice of `\(x\)`?

 --- # How do we solve them? A complementarity problem `\(CP(f, a, b)\)` can be re-framed as a rootfinding problem easily `$$\hat{f}(x) = min(max(f(x),a-x),b-x) = 0$$`

 --- # How do we solve them? We can then solve the problem with conventional rootfinding techniques or approximate this with a smooth function to make it easier on a rootfinder -- The workhorse solver for complementarity problems is the PATH solver: Julia wrapper can be found [here](https://github.com/chkwon/Complementarity.jl) --- # Maximization (minimization) methods How we solve maximization problems has many similarities to rootfinding and complementarity problems -- FOCs of an unconstrained maximization problem are just a rootfinding problem -- FOCs of a constrained maximization problem are just a complementarity problem -- I'll tend to frame problems as minimization problems because it is the convention the optimization literature -- We make two distinctions: -- **Local vs global:** are we finding an optimum in a local region, or globally? -- **Derivative-using vs derivative-free:** Do we want to use higher-order information? --- # Maximization (minimization) methods I'll focus on local solvers, common global solvers I won't cover: 1. Genetic algorithms 2. Simulated annealing 3. DIRECT 4. Sto-go --- # Derivative free optimization: Golden search Similar to bisection, **golden search** looks for a solution of a one-dimensional problem over smaller and smaller brackets -- If we have a continuous one dimensional function, `\(f(x)\)`, and we want to find a local minimum in some interval `\([a,b]\)` --- # Derivative free optimization: Golden search 1. Select points `\(x_1,x_2 \in [a,b]\)` where `\(x_2 > x_1\)` -- 2. If `\(f(x_1) < f(x_2)\)` replace `\([a,b]\)` with `\([a,x_2]\)`, else replace `\([a,b]\)` with `\([x_1,b]\)` -- 3. Repeat until convergence criterion is met -- Replace the endpoint of the interval next to the evaluated point with the highest value `\(\rightarrow\)` keep the lower evaluated point in the interval `\(\rightarrow\)` guarantees that a local minimum still exists --- # Derivative free optimization: Golden search How do we pick `\(x_1\)` and `\(x_2\)`? -- Achievable goal for selection process: - New interval is independent of whether the upper or lower bound is replaced - Only requires one function evaluation per iteration -- There's one algorithm that satisfies this --- # Derivative free optimization: Golden search Golden search algorithm for point selection: `\begin{gather} x_i = a + \alpha_i (b-a) \notag \\ \alpha_1 = \frac{3-\sqrt{5}}{2} \qquad \alpha_2 = \frac{\sqrt{5} - 1}{2} \end{gather}` -- The value of `\(\alpha_2\)` is called the golden ratio and is where the algorithm gets its name -- .hi-blue[Write out a golden search algorithm] --- # Golden search ```julia function golden_search(f, lower_bound, upper_bound) alpha_1 = (3 - sqrt(5))/2 # GS parameter 1 alpha_2 = (sqrt(5) - 1)/2 # GS parameter 2 tolerance = 1e-2 # tolerance for convergence difference = 1e10 while difference > tolerance x_1 = lower_bound + alpha_1*(upper_bound - lower_bound) # new x_1 x_2 = lower_bound + alpha_2*(upper_bound - lower_bound) # new x_2 if f(x_1) < f(x_2) # reset bounds upper_bound = x_2 else lower_bound = x_1 end difference = x_2 - x_1 end println("Minimum is at x = $((lower_bound+upper_bound)/2).") end; ``` -- ```julia f(x) = 2x^2 + 9x; golden_search(f, -10, 10) ``` ``` ## Minimum is at x = -2.2483173872886444. ``` --- # Nelder-Mead: Simplex Golden search is nice and simple but only works in one dimension There are several derivative free methods for minimization that work in multiple dimensions, the most commonly used one is .hi-blue[Nelder-Mead (NM)] -- NM works by first constructing a simplex: we evaluate the function at `\(n+1\)` points in an `\(n\)` dimensional problem It then manipulates the highest value point, similar to golden search --- # Nelder-Mead: Simplex There are six operations: -- - **Order:** order the value at the vertices of the simplex `\(f(x_1)\leq...\leq f(x_{n+1})\)` -- - **Centroid:** calculate `\(x_0\)`, the centroid of the non - `\(x_{n+1}\)` points -- - **Reflection:** reflect `\(x_{n+1}\)` through the opposite face of the simplex and evaluate the new point: `\(x_r = x_0 + \alpha(x_0 - x_{n+1})\)`, `\(\alpha > 0\)` - If this improves upon the second-highest (e.g. its lower) but is not the lowest value point, replace `\(x_{n+1}\)` with `\(x_r\)` and restart - If this is the lowest value point so far, go to step 4 - If `\(f(x_r) > f(x_n)\)` go to step 5 --- # Nelder-Mead: Simplex - **Expansion:** push the reflected point further in the same direction -- - **Contract:** Contract the highest value point toward the middle - Compute `\(x_c = x_0 + \gamma(x_0 - x_{n+1})\)`, `\(0 < \gamma \leq 0.5\)` - If `\(x_c\)` is better than the worst point replace `\(x_{n+1}\)` with `\(x_c\)` and restart - Else go to step 6 -- - **Shrink:** shrink the simplex toward the best point - Replace all points but the best one with `\(x_i = x_1 + \sigma(x_i - x_1)\)` -- Nelder-Mead is a pain to code efficiently (i.e. don't spend the time doing it yourself) but is in the `Optim.jl` package --- # Nelder-Mead: Simplex

 Nelder-Mead is commonly used but slow and unreliable, no real useful convergence properties, avoid using it --- # What is a solution? We typically want to find a global extremum, here a minimum, of our objective function `\(f\)` -- `\(x^*\)` is a global minimizer if `\(f(x^*) \leq f(x)\)` for all `\(x\)` over the domain of the function -- .hi-blue[Problem:] most algorithms are *local* minimizers that find a point `\(x^*\)` such that `\(f(x^*) \leq f(x)\)` for all `\(x \in N\)`, where `\(N\)` is a neighborhood of `\(x^*\)` -- Typically analytical problems are set up to have a unique minimum so any local solver can generally find the global optimum --- # What is a solution? Lots of problems have properties that don't satisfy the typical sufficiency conditions for a unique minimum (strictly decreasing and convex), like -- - Concave transitions - Games with multiple equilibria - Etc -- How do we find a local minimum? -- Do we need to evaluate every single point? --- # The general unconstrained approach Optimization algorithms typically have the following set up: 1. Start at some `\(x_0\)` 2. Work through a series of iterates `\(\{x_k\}_{k=1}^\infty\)` until we have "converged" with sufficient accuracy -- If the function is smooth, we can take advantage of that information about the function's shape to figure out which direction to move in next -- If `\(f\)` is twice continuously differentiable, we can use the gradient `\(\nabla f\)` and Hessian `\(\nabla^2 f\)` to figure out if `\(x^*\)` is a local minimizer --- # The general unconstrained approach Taylor's Theorem tells us that if `\(f\)` is twice differentiable, then there exists a `\(t \in (0,1)\)` such that `$$f(x^* + p) = f(x^*) + \nabla\,f(x^*)^T \, p + \frac{1}{2!}\,p^T\,\nabla^2\,f(x^*+tp)\,p$$` **This is an exact equality** -- From here we can prove the usual necessary and sufficient conditions for a local optimum --- # Two large classes of algorithms All modern algorithms have that general set up but may go about it in different ways -- Most modern optimization problems fall into one of two classes: 1. Line search 2. Trust region -- The relationship between these two approaches has a lot of similiarities to the relationship between the constrained problem and the dual Lagrange problem --- # Line search algorithms General idea: 1. Start at some current iterate `\(x_k\)` 2. Select a direction to move in `\(p_k\)` 3. Figure out how far along `\(p_k\)` to move --- # Line search algorithms How do we figure out how far to move? -- "Approximately" solve this problem to figure out the **step length** `\(\alpha\)` `$$\min_{\alpha > 0} f(x_k + \alpha p_k)$$` -- We are finding the distance to move, `\(\alpha\)` in direction `\(p_k\)` that minimizes our objective `\(f\)` --- # Line search algorithms Typically do not perform the full minimization problem since it is costly We only try a limited number of step lengths `\(\alpha\)` before picking the best one and moving onto our next iterate `\(x_{k+1}\)` -- **We still haven't answered, what direction `\(p_k\)` do we decide to move in?** --- # Line search: direction choice What's an obvious choice for `\(p_k\)`? -- The direction that yields the *steepest descent* -- `\(-\nabla \, f_k\)` is the direction that makes `\(f\)` decrease most rapidly, `\(k\)` indicates we are evaluating `\(f\)` at iteration `\(k\)` --- # Line search algorithms

 --- # Line search: steepest descent We can verify this is the direction of steepest descent by referring to Taylor's theorem -- For any direction `\(p\)` and step length `\(\alpha\)`, we have that `$$f(x_k + \alpha p) = f(x_k) + \alpha\,p^T\,\nabla\,f_k + \frac{1}{2!}\,\alpha^2p^T\,\nabla^2\,f(x_k+tp)\,p$$` -- The rate of change in `\(f\)` along `\(p\)` at `\(x_k\)` `\((\alpha = 0)\)` is `\(p^T \, \nabla\,f_k\)` --- # Line search: steepest descent The the unit vector of quickest descent solves `$$\min_p p^T\,\nabla\,f_k \,\,\,\,\, \text{subject to: }||p|| = 1$$` -- Re-express the objective as `\(\min_{\theta,p} ||p||\,||\nabla\,f_k||cos\,\theta\)`, where `\(\theta\)` is the angle between `\(p\)` and `\(\nabla\,f_k\)` -- The minimum is attained when `\(cos\,\theta = -1\)` and `\(p = -\frac{\nabla\,f_k}{||\nabla\,f_k||},\)` so the direction of steepest descent is simply `\(-\nabla\,f_k\)` --- # Line search: steepest descent The *steepest descent method* searches along this direction at every iteration `\(k\)` It may select the step length `\(\alpha_k\)` in several different ways A benefit of the algorithm is that we only require the gradient of the function, and no Hessian However it can be very slow --- # Line search: alternative directions We can always use search directions other than the steepest descent -- Any descent direction, i.e. one that is within `\(45^\circ\)` of `\(-\nabla\,f_k\)`, is *guaranteed* to produce a decrease in `\(f\)` as long as the step size is sufficiently small

 --- # Line search: alternative directions We can actually verify this with Taylor's theorem -- `$$f(x_k + \epsilon p_k) = f(x_k) + \epsilon\,p_k^T\,\nabla\,f_k + O(\epsilon^2)$$` -- If `\(p_k\)` is in a descending direction, `\(\theta_k\)` will be of an angle such that `\(cos\,\theta_k < 0\)` This gives us -- `$$p_k^T\,\nabla f_k = ||p_k||\,||\nabla\,f_k||cos\,\theta_k < 0$$` -- Therefore `\(f(x_k + \epsilon p_k) < f(x_k)\)` for positive but sufficiently small `\(\epsilon\)` -- **Is `\(-\nabla\,f_k\)` always the best search direction?** --- # Newton's method The most important search direction is not steepest descent but **Newton's direction** -- Newton's direction comes out of the second order Taylor series approximation to `\(f(x_k + p)\)` `$$f(x_k + p) \approx f_k + p^T\,\nabla\,f_k + \frac{1}{2!}\,p^T\,\nabla^2f_k\,p$$` Define this as `\(\mathbf{m_k(p)}\)` --- # Newton's method We find the Newton direction by selecting the vector `\(p\)` that minimizes `\(f(x_k + p)\)` -- This ends up being `$$p^N_k = -\frac{\nabla f_k}{\nabla^2 f_k}$$` --- # Newton's method -- This approximation to the function we are trying to solve has error of `\(O(||p||^3)\)`, so if `\(p\)` is small, the quadratic approximation is very accurate -- **Drawback:** requires explicit computation of the Hessian, `\(\nabla^2 \, f(x)\)` - Quasi-Newton solvers also exist (e.g. BFGS, L-BFGS, etc) --- # Trust region methods Trust region methods construct an approximating model, `\(m_k\)` whose behavior near the current iterate `\(x_k\)` is close to that of the actual function `\(f\)` -- We then search for a minimizer of `\(m_k\)` -- **Issue:** `\(m_k\)` may not represent `\(f\)` well when far away from the current iterate `\(x_k\)` -- **Solution:** Restrict the search for a minimizer to be within some region of `\(x_k\)`, called a .hi-blue[trust region] --- # Trust region methods Trust region problems can be formulated as `$$\min_p m_k(x_k + p)$$` where - `\(x_k+p \in \Gamma\)` - `\(\Gamma\)` is a ball defined by `\(||p||_2 \leq \Delta\)` - `\(\Delta\)` is called the trust region radius --- # Trust region Methods Typically the approximating model `\(m_k\)` is a quadratic function (i.e. a second-order Taylor approximation) `$$m_k(x_k + p) = f_k + p^T\,\nabla\,f_k + \frac{1}{2!}\,p^T\,B_k\,p$$` where `\(B_k\)` is the Hessian or an approximation to the Hessian

 --- # Line search vs trust region Whats the fundamental difference between line search and trust region? -- Line search first picks a direction then searches along that direction for the optimal step length Trust region first defines our step length via the trust region radius, then searches for the optimal direction --- # Line search vs trust region There is a special case of the trust region where if we set `\(B_k\)`, the approximate Hessian, to zero, the solution to the problem is `$$p_k = -\frac{\Delta_k \,\nabla \,f_k}{||\nabla\,f_k||}$$` This is just the steepest descent solution for the line search problem --- # Problem scaling The .hi-blue[scaling] of a problem matters for optimization performance -- A problem is .hi-blue[poorly scaled] if changes to `\(x\)` in a certain direction produce much bigger changes in `\(f\)` than changes to in `\(x\)` in another direction --

 --- # Problem scaling Ex: `\(f(x) = 10^9 x_1^2 + x_2^2\)` is poorly scaled -- This happens when things change at different rates: - Investment rates are between 0 and 1 - Consumption can be in trillions of dollars -- How do we solve this issue? -- Rescale the problem: put them in units that are generally within an order of magnitude of 1 - Investment rate in percentage terms: `\(0\%-100\%\)` - Consumption in units of trillion dollars instead of dollars --- # Constrained optimization How do we solve constrained optimization problems? -- Typically as a variant of unconstrained optimization techniques -- We will discuss three types of constrained optimization algorithms - Penalty methods - Active set methods - Interior point methods --- # Constrained optimization These are the algorithms in workhorse commercial solvers: KNITRO

 --- # Constrained optimization These are the algorithms in workhorse commercial solvers: KNITRO

 --- # Constrained optimization These are the algorithms in workhorse commercial solvers: fmincon/MATLAB

 --- # Constrained optimization: Penalty methods Suppose we wish to minimize some function subject to equality constraints (easily generalizes to inequality) `$$\min_x f(x) \,\,\, \text{subject to:} \,\, c_i(x) = 0$$` -- How does an algorithm know to not violate the constraint? -- One way is to introduce a **penalty function** into our objective and remove the constraint: `$$Q(x;\mu) = f(x) + \frac{\mu}{2} \sum_i c_i^2(x)$$` where `\(\mu\)` is the penalty parameter --- # Constrained optimization: Penalty methods `$$Q(x;\mu) = f(x) + \frac{\mu}{2} \sum_i c_i^2(x)$$` -- The second term increases the value of the function, bigger `\(\mu \rightarrow\)` bigger penalty from violating the constraint -- The penalty terms are smooth `\(\rightarrow\)` use unconstrained optimization techniques to solve the problem by searching for iterates of `\(x_k\)` --- # Constrained optimization: Penalty methods Also generally iterate on sequences of `\(\mu_k \rightarrow \infty\)` as `\(k \rightarrow \infty\)`, to require satisfying the constraints as we close in -- There are also augmented Lagrangian methods that take the quadratic penalty method and add in explicit estimates of Lagrange multipliers to help force binding constraints to bind precisely --- # Constrained optimization: Penalty method example Example: `$$\min x_1 + x_2 \,\,\,\,\,\text{ subject to: } \,\,\, x_1^2 + x_2^2 - 2 = 0$$` -- Solution is pretty easy to show to be `\((-1, -1)\)` -- The penalty method function `\(Q(x_1, x_2; \mu)\)` is `$$Q(x_1, x_2; \mu) = x_1 + x_2 + \frac{\mu}{2} (x_1^2 + x_2^2 - 2)^2$$` -- Let's ramp up `\(\mu\)` and see what happens to how the function looks --- # Constrained optimization: Penalty method example `\(\mu = 1\)`, solution is around `\((-1.1, -1.1)\)`

 --- # Constrained optimization: Penalty method example `\(\mu = 10\)`, solution is very close to `\((-1, -1)\)`, can easily see trough, and rapid value increase outside `\(x_1^2 + x_2^2 = 2\)`

 --- # Constrained optimization: Active set methods Active set methods encapsulate sequential quadratic programming (SQP) methods -- **Main idea:** 1. Replace the large non-linear constrained problem with a constrained quadratic programming problem 2. Use Newton's method to solve the sequence of simpler quadratic problems --- # Constrained optimization: Active set methods The Lagrangian is `$$L(x,\lambda) = f(x) - \lambda^T\,c(x)$$` -- Denote `\(A(x)^T\)` as the Jacobian of the constraints `$$A(x)^T = [\nabla\,c_1(x),...,\nabla\,c_m(x)]$$` --- # Constrained optimization: Active set methods The first-order conditions `\(F(x,\lambda)\)` can be written as, `\begin{gather} \nabla\,f(x) - A(x)^T\,\lambda = 0 \notag\\ c(x) = 0 \notag \end{gather}` Any solution to the equality constrained problem, where `\(A(x^*)\)` has full rank also satisfies the first-order necessary conditions -- Active set methods use Newton's method to find the solution `\((x^*, \lambda^*)\)` of `\(F(x,\lambda)\)` --- # Constrained optimization: Active set methods **Issue:** if we have many constraints, keeping track of all of them can be expensive -- **Main idea:** recognize that if an inequality constraint is not binding, or **active**, then it has no influence on the solution `\(\rightarrow\)` in the iteration procedure we can effectively ignore it -- Active set methods find ways to reduce the complexity of the optimization routine by selectively ignoring constraints that are not active (i.e. non-positive Lagrange multipliers) or close to being active --- # Constrained optimization: Interior point methods Interior point methods are also called barrier methods -- These are typically used for inequality constrained problems -- The name **interior point** comes from the algorithm traversing the domain along the interior of the inequality constraints -- **Issue:** how do we ensure we are on the interior of the feasible set? -- **Main idea:** impose a **barrier** to stop the solver from letting a constraint bind --- # Constrained optimization: Interior point methods Consider the following constrained optimization problem `\begin{gather} \min_{x} f(x) \notag\\ \text{subject to: } c_E(x) = 0, c_I(x) \geq 0 \end{gather}` -- Reformulate this problem as `\begin{gather} \min_{x,s} f(x) \notag\\ \text{subject to: } c_E(x) = 0, c_I(x) - s = 0, s \geq 0 \end{gather}` where `\(s\)` is a vector of slack variables for the constraints --- # Constrained optimization: Interior point methods Final step: introduce a **barrier function** to eliminate the inequality constraint, `\begin{gather} \min_{x,s} f(x) - \mu \sum_{i=1}^m log(s_i) \notag\\ \text{subject to: } c_E(x) = 0, c_I(x) - s = 0 \end{gather}` where `\(\mu\)` is a positive barrier parameter --- # Constrained optimization: Interior point methods The barrier function prevents the components of `\(s\)` from approaching zero by imposing a logarithmic barrier `\(\rightarrow\)` it maintains slack in the constraints -- Interior point methods solve a sequence of barrier problems until `\(\{\mu_k\}\)` converges to zero -- The solution to the barrier problem converges to that of the original problem --- # Best practices for optimization Plug in your guess, let the solver go, and you're done right? -- ## WRONG -- These algorithms are not guaranteed to always find even a local solution, you need to test and make sure you are converging correctly --- # Check exitflags: KNITRO-specific numbers here Exitflags tell you why the solver stopped, exit flags of 0 or -10X are generally good, anything else is bad -10X can indicate bad scaling, ill-conditioning, etc

 --- # Try alternative algorithms Optimization is approximately 53% art -- Not all algorithms are suited for every problem `\(\rightarrow\)` it is useful to check how different algorithms perform -- Interior-point is usually the default in constrained optimization solvers (low memory usage, fast), but try other algorithms and see if the solution generally remains the same --- # Be aware of tolerances Two main tolerances in optimization: 1. `ftol` is the tolerance for the change in the function value (absolute and relative) 2. `xtol` is the tolerance for the change in the input values (absolute and relative) -- What is a suitable tolerance? --- # Be aware of tolerances It depends -- Explore sensitivity to tolerance, typically pick a conservative (small) number - Defaults in solvers are usually `1e-6` --- # Be aware of tolerances May be a substantial tradeoff between accuracy of your solution and speed -- Common bad practice is to pick a larger tolerance (e.g. `1e-3`) so the problem "works" (e.g. so your big MLE converges) -- Issue is that 1e-3 might be pretty big for your problem if you haven't checked that your solution is not sensitive to the tolerance --- # Perturb your initial guesses **Initial guesses matter** -- Good ones can improve performance - e.g. initial guess for next iteration of coefficient estimates should be current iteration estimates -- Bad ones can give you terrible performance, or wrong answers if your problem isn't perfect - e.g. bad scaling, not well-conditioned, multiple equilibria


You can start to interact with Leon, don't be shy.
Use
↑
↓
to browse history;
↵
to submit;
alt + c to listen.


Installation¶
Using PIP:
pip install pycobb
From Source:
git clone https://github.com/ryan-byrne/pycobb
cd pycobb
python setup.py install
Quickstart¶
Let’s start by printing every pitch Clayton Kershaw threw in 2020.
This can be done in a python script:
import pycobb
pitches = pycobb.get(pitchers=['Clayton Kershaw'], years=[2020])
print(pitches)
Or directly from the command line:
pycobb -p "Clayton Kershaw" -y 2020 --print


---
order: 13
title: Necron
name: Scarab Conflict Necron
introduction:
|
forces:
- necron
using_the_army_list:
|
Scarab Conflict Necron formations come in three types, the first two are phalanxes and support formations. Each phalanx you include in the army allows you to field any three support formations. Although you can only take a support formation if you first take a phalanx, they are treated as separate independent formations during a battle and do not have to move around together. The third type of formation are Harvestor formations. A maximum of up to a third of the points available to the army may be spent on these formations.
Finally, Necron Individuals includes special characters, formations and objective options. Each individual may only be taken once by the army. The rules for using each individual are listed in the Notes
column.
The army list includes the following information:
Formation
: The name of the formation.
Units
: The core units that make up the formation.
Extras
: A Necron formation may include any of the extra units listed in the Extras
column. You may include any number of extra units in a formation unless it is specifically noted otherwise. All of the core and extra units in a formation count as being part of one formation. The different units may not move off on their own.
Cost
: The points value of the formation.
special_rules_text:
|
The _Implacable Advance_ rule applies to all Necron formations (see [_Implacable Advance_](#implacable-advance)) and the _Phase Out_ rule applies to certain formations (see [_Phase Out_](#phase-out)). Additionally, certain units and weapons have special abilities described in _Necron Technology_ (see [_Necron Technology_](#necron-technology)).
special_rules:
- scarab-conflict-necron-army-epic-tournament-special-rules
---
Scarab Conflict Necron armies have a strategy rating of 2. All other formations have an initiative rating of 1+, but receive modifiers depending on the action chosen when taking an action test (see Implacable Advance).
| (Up to one of each type of individual may be taken per army.) | ||
| Type | Notes | Cost |
|---|---|---|
| 0–1 Tomb Complex | The first objective the Necron player places on their own table edge functions both as a Portal and as an objective for the rules purposes. It may not be destroyed. Formations using the Portal should measure from the edge of the board as the formation’s starting point. | +75 points |
| Formation | Units | Extras | Cost |
|---|---|---|---|
| Infantry Phalanx | Six Necron Warriors and one Necron Lord character |
|
225 points |
| (Each phalanx you include in the army allows you to field any three support formations.) | |||
| Formation | Units | Extras | Cost |
|---|---|---|---|
| Armoued Phalanx | Six Obelisks | None | 300 points |
| Eques Maniple | Any six of the following units: Destroyers, Heavy Destroyers |
|
300 points |
| Monolith Maniple | One Monolith and two Obelisks |
|
200 points |
| Monolith Phalanx | Three Monoliths | Add up to three Obelisks for +50 points each | 275 points |
| Venator Maniple | Six Flayed Ones |
|
200 points |
| (Up to a third of the points available may be spent on these formations.) | |||
| Formation | Units | Cost | |
|---|---|---|---|
| 0–1 C’tan | One of the following units: The Deceiver, The Nightbringer | None | 300 points |
| 0–1 Harvester Engine | One of the following units: Abattoir, Æonic Orb | None | 600 points |
| 0–1 Spacecraft | One Scythe Class Harvester | None | 350 points |
| Pylon | One Pylon | None | 200 points |
| 0–2 Warbarque | One Warbarque | If a C’tan is not fielded then one Warbarque in the army may be given Supreme Commander for +50 points | 300 points |


Puzzle Not Found
Sorry, we couldn't find that puzzle. Do you have the right link?
Back to Home
{% include puzzle_body.html %}
{{ page.content | strip_html }}
{{ page.slug }}


This is paragraph 3d6851b2-269f-489e-96b3-a99bb283d893
This is text a9629350-3248-40d5-930c-f4b33c4e00f2 This is text 3027e75e-0270-44c9-b7a1-5483646c2f97