Posts

string (C)

Last edited: August 8, 2025

In C, string is an array of chars. C strings don’t track their length; each C string always end in an null-terminating character: \0. This is represents the zero byte.

There’s a built in function strlen which checks the length of a string without the null-terminating character. This function is O(n)!!!

String Pointer Syntax Sugar Synonyms

char str[6];

// these are equivalent
char *ptr = str;
char *ptr = &str[0];
char *ptr = &str; // DON'T DO THIS

// these are equivalent
char thirdLetter = str[3];
char thirdLetter = *(str + 3);

seven commandments of c strings

  1. if we create a string as char[], we can modify its characters because its memory lives in our stack instead of living in a global data segment
  2. we can’t set char[] as equaling to something, because its not strictly a pointer and instead it refers to an entire block of memory instead of a pointer to the first element (in a same vein, an array’s size is fixed and travels with the variable)
  3. if we pass char[] as a parameter, it is converted to a char *
  4. if we create a string with new string literal as char *thing = "thing", we can’t modify it because its on the global data segment
  5. we can set char * equaling to another value because its a pointer
  6. adding an offset to a c string gives a substring that’s places past the first character
  7. if we change characters in a string parameter, these changes will persist

passing strings around

Strings are passed as a pointer to their first character.

STRIPS-style planning

Last edited: August 8, 2025

This is a precursor to MDP planning:

  • states: conjunction of “fluents” (which are state)
  • actions: transition between fulents
  • transitions: deleting of older, changed parts of fluents, adding new parts

Planning Domain Definition Language

A LISP used to specify a STRIPS-style planning problem.

Hierarchical Task Network

  1. Decompose classical planning into a hierarchy of actions
  2. Leverage High level actions to generate a coarse plan
  3. Refine to smaller problems

Strong Free Will

Last edited: August 8, 2025

Reading Notes

Strong Free Will vs. Weak Free Will — “will” and “bells inequality” is a demonstration of indeterminism/randomness between particles — but indeterminism and randomness a demonstration of will.

That if humans have free will, it should be spawened from the indeterminism of elementary particles

It asserts, roughly, that if indeed we humans have free will, then elementary particles already have their own small share of this valuable commodity.

strong induction

Last edited: August 8, 2025

proof by induction but assuming that all \(k < n\) is given.

structure learning

Last edited: August 8, 2025

We learn a Bayes Net grphical structure by following Bayes rule:

\begin{align} P(G|D) &\propto P(D|G) P(G) \\ &= P(G) \int P(D | \theta, G) P(\theta|G) d\theta \\ &= P(G) \prod_{i=1}^{n} \prod_{j=1}^{q_{i}} \frac{\Gamma(\alpha_{i,j,0})}{\Gamma(\alpha_{i,j,0} + m_{i,j,0})} \prod_{k=1}^{r_{i}} \frac{\Gamma(\alpha_{i,j,k} + m_{i,j,k})}{\Gamma(\alpha_{i,j,k})} \end{align}

where, we define: \(\alpha_{i,j,0} = \sum_{k} \alpha_{i,j,k}\).

The actual integration process is not provided, but mostly uninteresting. See Beta Distribution for a flavour of how it came about.

This is hard. We are multiply many gammas together, which is computationally lame. So instead, we use