int state) -> int { return state / (std::pow(2, NUM_RAYS)); };

    auto in_best_region = [](int state) -> bool {
	return int(state / (std::pow(2, NUM_RAYS))) == 4;
    };

    for (int state = 0; state < _num_states; ++state) {
	if (dangerous_state(state)) _R[state][EVADE] = 4;
	//if (in_best_region(state)) _R[state][EAT_PELLET] = 2;
	//_R[state][EAT_PELLET] = 3;
	//_R[state][GO_REGION + max_pellets_region(state)] = 2;
    }
}

int QLearning::randAction() { return _int_uni(_rng); }

int QLearning::randConstrainedAction(const std::vector<bool>& feasible_actions)
{
    int action;
    do {
	action = randAction();
    } while (!feasible_actions[action]);
    return action;
}

int QLearning::query(int prev_action, int inst_reward, int current_state,
		     int prev_state, const std::vector<bool>& feasible_actions)
{
    auto new_action = generateAction(current_state, feasible_actions, true);
    _Q[prev_state][prev_action] = inst_reward + _R[prev_state][prev_action] +
				  _gamma * _Q[current_state][new_action];

    return new_action;
}

void QLearning::queryDead()
{
    if (_prev_state!= -1 && _prev_action!= -1)
	_Q[_prev_state][_prev_action] = R_HAS_DIED;
    _prev_state = -1;
    _prev_action = -1;
}

int QLearning::generateAction(int current_state,
			      const std::vector<bool>& feasible_actions,
			      bool has_exploration)
{
    auto random_exploration = _real_uni(_rng) < _random_exploration_factor;
    if (has_exploration && random_exploration)
	return randConstrainedAction(feasible_actions);
    else
	return maxConstrainedElement(_Q[current_state], feasible_actions);
}

int QLearning::maxConstrainedElement(const std::vector<int>& v,
				     const std::vector<bool>& feasible_actions)
{
    int max_element = v[0];
    int max_element_i = 0;
    for (size_t i = 1; i < v.size(); ++i) {
	if (max_element < v[i] && feasible_actions[i]) {
	    max_element = v[i];
	    max_element_i = i;
	}
    }

    return max_element_i;
}

void QLearning::readQFromFile() { _csv.read(_Q, Q_FILE); }
breaking news
ACT workers return after smoke emergency
- From: AAP
- January 15, 2013
HUNDREDS of public servants have been allowed back into their office building in Canberra after being evacuated earlier on Tuesday.
Firefighters could not find the cause of smoke in the basement of the 22-storey Lovett Tower in Woden.
ACT Fire and Rescue crews are continuing the ventilate the basement.
The building was evacuated of its almost 600 workers at about 9am (AEDT).
The office tower houses the Department of Veterans' Affairs and Parks Australia.
‘That’s your idea of an easy question?’
A JOURNALIST in New Zealand had “an easy question” for the visiting Foreign Minister Julie Bishop. Or so she thought. If looks could kill...In episode fourteen, Kat and Samm begin a three-part look at the art giallo film, the more unconventional cousin to everyone’s favorite Italian horror genre, popularized by directors like Mario Bava and Dario Argento. This episode begins with a look at Tinto Brass’s Deadly Sweet (1967), with Jean-Louis Trintignant and Ewa Aulin as two young lovers trying to outrun a killer in swinging London. Trintignant and Aulin return for what is probably the only chicken-themed giallo, the totally bonkers Death Laid an Egg (1968), about murder and backstabbing in a poultry factory.
Also explored is Elio Petri’s gloomy, beautiful A Quiet Place in the Country (1968), starring the great Franco Nero as a painter who rents an abandoned villa that might be haunted by the ghost of a nymphomaniac countess who died during WWII. War themes also trickle into the completely insane In the Folds of the Flesh (1970), about a family living in a mansion on top of an Etruscan burial ground. They have a nasty habit of gruesomely dispatching anyone who tries to visit them. Finally, Kat and Samm also explore one of the only Soviet-set giallo films, Aldo Lado’s grim Short Night of the Glass Dolls (1971), about a man who wakes up paralyzed, on a slab at the morgue and must try to remember how he got there before it’s too late.
Also mentioned is the upcoming Arrow Blu-ray release of Andrzej Zuławski’s final film, Cosmos (2015), which is now available for pre-order; Samm provided two essays for the booklet. She was also on a recent episode of the podcast Tracks of the Damned, giving a commentary on Buñuel and Dali’s Un chien andalou (1929), as part of their first short horror film festival. Kat announced her upcoming book on the film Daughters of Darkness, which will be published as part of the Devil’s Advocates series by Auteur Publishing (more details to follow later).
We believe in purposeful brands.
That’s why we advise our clients to base their activities around the purpose of their brand and help target audiences touch and feel what the brand is about.
Research suggests that consumer decision making entails emotional drivers. We have created many purpose-driven and impactful brand activities for our major, market leading clients and won numerous international and European awards for these activities.
Among these were a project to launch life saving drones in a popular Central-European holiday spot, a campaign aiming for the digital inclusion of seniors, and a VR simulation to encourage safer driving.Thanks to the large maximum aperture, you can easily photograph in dark circumstances.
Thanks to the dust seals, the lens remains clean and clear.
The Sigma 14-24mm f/2.8 DG HSM Art Canon is a wide-angle lens with zoom for SLR cameras. You can use it to photograph vast landscapes and high buildings. When you zoom in, the lens has a range of 24mm for taking close-up photos. The lens has a fixed aperture of f/2.8, so your images stay sharp when you zoom in, even in situations with low light. The 3 FLD, 3 SLD, and aspheric elements in the lens prevent a soft haze on, and distortion of, your photos. Thanks to the splash-proof casing, the lens remains clean and clear, even in bad weather. This lens is suitable for Canon cameras with EF mount.
If you buy the Sigma 14-24mm f/2.8 DG HSM Art Canon, you'll receive 1 year extra...
If you buy the Sigma 14-24mm f/2.8 DG HSM Art Canon, you'll receive 1 year extra warranty from Sigma for free. You have until 8 weeks after the purchase date to register your promotional product for Sigma's promotion. Have a look at the promotional Terms and Conditions (PDF) for more information.What can we learn from the mobile app graveyard?News / Technology | OnlineBy PhocusWire | December 3, 2013Share This article was originally published on DEVICES: Take a look at the app charts on sites such as Appnostic and it quickly becomes clear that many travel apps have such low retention or download rates that many must be wondering "why bother?". Luckily, as mobile has soared, so has expertise in understanding why some apps work and others fail. Read more on at Smashing Magazine. Estimates put the number of mobile app downloads this year at somewhere between 56 and 82 billion. The average user downloads somewhere between 26 and 41 apps, with a smaller subset of those apps being used on a regular basis. Other numbers indicate that 95% of downloaded apps are abandoned within a month and 26% of apps are only used once. Why? And how do brands learn from such disappointment? Read more on at Smashing MagazineNB:Broken mobile image via Shutterstock.SERIES RECAP: Bitter magical healer Blackthorn makes a deal with a fey, the powerful Conmael, in order to escape the bowels of a foul prison. In exchange, she reluctantly vows to set aside her plans of vengeance against the man who destroyed her loved ones agrees to assist anyone who asks for her help, as magical healer or wise-