Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/nwbarendregt/AdaptNormThresh
12 June 2025, 11:23:22 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 2878a3d9f5a3b9b89a0084a897bef3414e9de4a2
    No releases to show
  • bbb89f8
  • /
  • Figure 2 -- Known Reward Thresholds
  • /
  • RC_Threshold_Motifs.m
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:dbc58be789e64a49de25a8a6342ac72c3a3d9a4f
origin badgedirectory badge Iframe embedding
swh:1:dir:c289392a1a31e5d3a4f39269e7a145198df6d2ce
origin badgerevision badge
swh:1:rev:2878a3d9f5a3b9b89a0084a897bef3414e9de4a2
origin badgesnapshot badge
swh:1:snp:a568cc5cff39965992895669038ed8c43a59eedd
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 2878a3d9f5a3b9b89a0084a897bef3414e9de4a2 authored by nwbarendregt on 03 May 2022, 15:08:29 UTC
Add files via upload
Tip revision: 2878a3d
RC_Threshold_Motifs.m
% RC_Threshold_Motifs.m
% Script used to generate data for Fig. 1C in Barendregt et al., 2022.

clear

% Define simulation parameters:
T = 5; dt = 0.005;  t_i = 1;
dg = 0.001;
m = 5; c = @(t) 1;

% Define pre- and post-change rewards:
R_1 = linspace(1,10); R_2 = linspace(1,10);

% Pre-allocate threshold classification matrix and threshold storage:
type = NaN(length(R_1),length(R_2));
thresh = NaN(length(R_1),length(R_2),T/5/dt+1);

for i = 1:length(R_1)
    type_i = NaN(1,length(R_2));
    thresh_i = NaN(length(R_2),201);
    for j = 1:length(R_2)
        
        % Construct reward timeseries:
        R = NaN(1,T/dt+1); R(1:100) = R_1(i); R(101:end) = R_2(j);

        % Calculate normative thresholds using Bellman's equation:
        theta = RC_Bellmans(T,dt,t_i,dg,m,c,R); theta = theta(1:(T/5/dt+1));
        thresh_i(j,:) = theta;

        % Classify threshold motif:
        if theta(1)==0
            type_i(j) = 1; % Motif vi (trival thresholds)
        elseif sum(diff(theta)==0)==(length(theta)-1)
            type_i(j) = 5; % Motif iii
        elseif (sum(diff(theta)<=0)==(length(theta)-1))
            type_i(j) = 2; % Motif v
        elseif (sum(theta(1:100)==Inf)==100 && sum(diff(theta(101:end))==0)==(length(theta(101:end))-1))
            type_i(j) = 3; % Motif i
        else
            type_i(j) = 4; % Motif ii and iv
        end
    end
    type(i,:) = type_i;
    thresh(i,:,:) = thresh_i;
end

save('RC_Threshold_Motifs.mat');

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API