forked from gamerlily/Cogstruction
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModefications documentation.tex
222 lines (125 loc) · 6.2 KB
/
Modefications documentation.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
\documentclass[12pt, letterpaper]{article}
% Language setting
% Replace `english' with e.g. `spanish' to change the document language
\usepackage[english]{babel}
% Set page size and margins
% Replace `letterpaper' with `a4paper' for UK/EU standard size
\usepackage[a4paper,top=2cm,bottom=2cm,left=1cm,right=1cm,marginparwidth=1.75cm]{geometry}
% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\title{Cogstruction modefications documentation}
\author{Lily Stejko}
\begin{document}
\maketitle
\begin{abstract}
Don't need one, just for taking notes.
\end{abstract}
\section{Learning algorithm weights}
\subsection{Original fitness function}
Shorthand reference for section
$SOF =$ standard\_obj\_fxn
\textbf{Inputs}
$iB_w =$ inv\_build\_weight $= 7000.0$\footnote[1]{The reason for giving the variables their starting weights is not known. The original author has abandoned the project and is not taking any questions about it at this time.}
$iF_w =$ inv\_flaggy\_weight $= 2000.0$\footnotemark[1]
$iE_w =$ inv\_exp\_weight $= 3.0$\footnotemark[1]
\textbf{Weights}
$B_w =$ build\_weight
$F_w =$ flaggy\_weight
$E_w =$ exp\_weight
\textbf{Object parameters}
$B_r =$ build\_rate
$F_r =$ flaggy\_rate
$E_r =$ exp\_mult
\subsubsection{Fitness function}
$SOF(B_w,F_w,E_w) = B_r*B_w+F_r*F_w+E_r*E_w$
\subsubsection{Calculating weights}
Using the following variables.
\textbf{Formula}
$\begin{bmatrix}
1 & 1 & 1\\
iB_w & -iF_w & 0.0\\
0.0 & iF_w & -iE_w
\end{bmatrix}
\begin{bmatrix}
B_w\\
F_w\\
E_w
\end{bmatrix}
=
\begin{bmatrix}
1\\
0\\
0
\end{bmatrix}$
\textbf{Linear algebra form}
$B_w+F_w+E_w = 1$ (Makes sure all values sum up to 1)
$iB_w*B_w-iF_w*F_w = 0$ (Scale lock the ratio between $B_w$ and $F_w$)
$iF_w*F_w-iE_w*E_w = 0$ (Scale Lock the ratio between $F_w$ and $E_w$)
\clearpage
\subsection{Alternative fitness function}
Shorthand reference for section
$F =$ Fitness Formula\
\textbf{Inputs}
The input weights are input at the ratio desired.
$B_{w_i} =$ input\_build\_weight
$F_{w_i} =$ input\_flaggy\_weight
$E_{w_i} =$ input\_exp\_weight
$Adj_v =$ adjust\_parameters\footnote{A bool value used to determine if the values of B\_r, F\_r, and E\_r should be adjusted to reflect their non-linear relationships to gear crafter levels.} \textit{(True by default)}
\textbf{Weights}
$B_w =$ build\_weight
$F_w =$ flaggy\_weight
$E_w =$ exp\_weight
\textbf{Object parameters}
$B_{r_c} =$ build\_rate for a given cog
$F_{r_c} =$ flaggy\_rate for a given cog
$E_{r_c} =$ exp\_mult for a given cog
$B_r =$ build\_rate for a cog array
$F_r =$ flaggy\_rate
$E_r =$ exp\_mult
$SQ_b =$ usable\_suares
\textbf{Constants and calculated variables}
$C =$ Construction Value
$Af =$ Affixes \textit{(5.5 for current best cogs, $5+50\%$ chance of a sixth)}
$Af_b =$ Base Affixes \textit{(5 for current best cogs)}
$Sn =$ Number of stats on a gear that an affix can be assigned to \textit{(Known const, 3)}
$b =$ Expected booster source ratio \textit{(assumed 2)\footnote{for simplicity, indicating that approximately $\frac{1}{2}$ of the expected value of the grid comes from cog base values}}
\subsubsection{Fitness function}
$F = B_w*\frac{Sn*B_r}{Af*SQ_b}+F_w*b\left(\frac{Sn*F_r}{Af*SQ_b*b}\right)^{1.25}+$
$E_w*b\left(\left(0.0003808514*\left(\frac{Sn*E_r}{Af*SQ_b*b}\right)^{3.968829}\right)+\left(\frac{Sn*E_r}{Af*SQ_b*b}\right)^{1.075056}+0.8517081\right)$
Applying the known values:
$F = B_w*\frac{3*B_r}{5.5*SQ_b}+F_w*2*\left(\frac{3*F_r}{11*SQ_b}\right)^{1.25}+$
$E_w*2*\left(\left(0.0003808514*\left(\frac{3*E_r}{11*SQ_b}\right)^{3.968829}\right)+\left(\frac{3*E_r}{11*SQ_b}\right)^{1.075056}+0.8517081\right)$
\subsubsection{Calculating weights}
$[B_w,F_w,E_w] = \frac{[B_{w_i}, F_{w_i}, E_{w_i}]}{B_{w_i} + F_{w_i} + E_{w_i}}$
\subsubsection{Fitness function derivation}
The "construction value" ($C$) is the base value that determines the power of an single Affix for a given gear type crafted at a given construction level. The formula to calculate the construction value at a given skill level is:
$C=\frac{\left(\left(\frac{level}{3}\right)+0.7\right)^{1.3+0.05*Af_b}}{4} + 3^{Af_b-2}$
The actual bonus for a given affix can range from 40\% to 300\% of that value.
\textbf{Formulas for $B_r$, $F_r$, and $E_r$:}
$B_{r_c} = C$, the relationship is 1 to 1 (and therefor linear)
$F_{r_c} = C^{0.8}$, the relationship is not linear.
$E_{r_c} = C^{0.4}+LOG10(C)*10-5$, the relationship is not linear.
\textbf{The inverse formulas are:}
$C = B_{r_c}$
$C = F_{r_c}^{1.25}$
$C = b*388.428W\left(0.145974*\sqrt[25]{10^{E_{r_c}}}\right)^{\frac{5}{2}}$
The last formula contains a W which is too complex to use in practice but
$C = (0.0003808514*E_{r_c}^{3.968829})+E_{r_c}^{1.075056}+0.8517081$
is much faster to calculate and is a good approximation formula for realistic values.
\textbf{The cog array:}
Every cog array has the same number of cogs, $SQ_b$.
To get the average values of an average cog we take $\frac{[B_r,F_r,E_r]}{SQ_b}=\left[\frac{B_r}{SQ_b},\frac{F_r}{SQ_b},\frac{E_r}{SQ_b}\right]$
We can generally assume top level cogs for every cog, if the player is using lower level cogs, that's ok! This formula is just trying to get some way to bring $B_r$, $F_r$, and $E_r$ into an approximately consistent range.
To calculate the average affix, multiply by $\frac{Sn}{Af}$: $\left[\frac{Sn*B_r}{Af*SQ_b},\frac{Sn*F_r}{Af*SQ_b},\frac{Sn*E_r}{Af*SQ_b}\right]$
Since we assume that $\frac{1}{b}$ of the effect comes from a bonus:
$\left[\frac{Sn*B_r}{Af*SQ_b*b},\frac{Sn*F_r}{Af*SQ_b*b},\frac{Sn*E_r}{Af*SQ_b*b}\right]$
Applying the inverse formulas and reapplying b to the final result:
$\left[\frac{Sn*B_r}{Af*SQ_b},b\left(\frac{Sn*F_r}{Af*SQ_b*b}\right)^{1.25},b*388.428W\left(0.145974*\sqrt[25]{10^{\frac{Sn*E_r}{Af*SQ_b*b}}}\right)^{\frac{5}{2}}\right]$
Using the more efficient approximation of the last formula
$\begin{left}
\left[\frac{Sn*B_r}{Af*SQ_b},b\left(\frac{Sn*F_r}{Af*SQ_b*b}\right)^{1.25},b\left(\left(0.0003808514*\left(\frac{Sn*E_r}{Af*SQ_b*b}\right)^{3.968829}\right)+\left(\frac{Sn*E_r}{Af*SQ_b*b}\right)^{1.075056}+0.8517081\right)\right]
\end{left}$
These can now be multiplied by $\left[B_w,F_w,E_w\right]$ and the result can be summed.
\end{document}