dp-algorithm-for-informative-measurements

C++ code for figures in the journal article "A Dynamic Programming Algorithm for Finding an Optimal Sequence of Informative Measurements"

https://github.com/ploxley/dp-algorithm-for-informative-measurements

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: mdpi.com
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

C++ code for figures in the journal article "A Dynamic Programming Algorithm for Finding an Optimal Sequence of Informative Measurements"

Basic Info
  • Host: GitHub
  • Owner: ploxley
  • License: mit
  • Language: C++
  • Default Branch: main
  • Homepage:
  • Size: 9.77 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.md

Code for "A Dynamic Programming Algorithm for Finding an Optimal Sequence of Informative Measurements"
doi 10.3390/e25020251

This code reproduces the figures and tables in the journal article "A Dynamic Programming Algorithm for Finding an Optimal Sequence of Informative Measurements". To run this code requires a C/C++ compiler such as GCC. Download a snapshot of the repository's files as a zip file to your local computer, and then unpack the zip file. Reproducing the paper figures is done as follows.

Running the Code

All figure and table results can be obtained by editing the file main.cc on lines 7 to 10. Once this file has been edited, the code can be compiled by typing make on the command line (assuming a C++ compiler is available). To run the code, type ./main on the command line. Alternatively, an IDE can be used to build and run the code.

Reproducing the Figure and Table Results

Figure 3: In file main.cc make the following edits,

int N = 4;
int n = 3;
int rollout = 1;
xprime.set(1,1);

then compile and run the code as described.

The figure results are displayed on the terminal. The position of the ship is given by "S", a square that has been searched is denoted by an "X", and a square that has not yet been searched is denoted by an "O".

Other results displayed on the terminal include the current measurement (number of squares searched at the current stage), the final measurement sequence (given in each figure caption), and the sum of all measurements (number of squares searched over all stages). To be successful at finding the submarine, all squares minus one need to have been searched (it must be in the remaining unsearched square if it has not been found at the final stage).

The search can be chosen to be either a greedy search (rollout = 0), or a search using the rollout algorithm (rollout = 1) -- which is a particular method of approximate dynamic programming. Each measurement corresponds to a number of squares that have been searched by the ship using a regular sonar pattern.

Figure 4:

In file main.cc make the following edits,

int N = 3;
xprime.set(0,1);

then compile and run the code as described. Note the precise order of the search depends on the order the admissible controls are processed.

Figure 5:

In file main.cc make the following edits,

int N = 4;
xprime.set(0,0);

then compile and run the code as described.

Figure 6: In file main.cc make the following edits,

int N = 7;
int n = 4;
xprime.set(1,1);

then compile and run the code as described. Note that Figures 1 to 6 could instead use rollout = 0 since greedy search is optimal until n = 7.

Figure 7: In file main.cc make the following edits,

int N = 20;
int n = 7;
int rollout = 0;
xprime.set(1,0);

then compile and run the code as described. The last three grids correspond to Figure 7. Increasing to N = 27 shows the ship moving from left to right in an endless cycle without completing the search: greedy search is no longer optimal.

Figure 8: In file main.cc make the following edits,

int N = 23;
int rollout = 1;

then compile and run the code as described. In the terminal output count back six grids, then five, and then four. These three grids match Figure 8.

Table 2: In file main.cc edit n and N according to the values for "Grid Size" and "Number of Measurements" given in the table. You will need to compile and run the code for each row of the table. For example, for the last row of the table, the following edits

int N = 98;
int n = 14;
int rollout = 1;
xprime.set(1,0);

produce the terminal output: squares searched = 195 of 195. While setting rollout = 0 yields: "squares searched = 164 of 195". Results for these relatively small grids are still somewhat sensitive to the initial condition specified in xprime.set().

Owner

  • Login: ploxley
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: >-
  A Dynamic Programming Algorithm for Finding an Optimal
  Sequence of Informative Measurements
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: P.~N.
    family-names: Loxley
identifiers:
  - type: doi
    value: 10.3390/e25020251
repository-code: >-
  https://github.com/ploxley/DP-algorithm-for-informative-measurements
keywords:
  - Information Theory
  - Reinforcement Learning
  - Active Learning
  - Autonomous Agent
license: MIT
date-released: '2025-01-09'

GitHub Events

Total
  • Push event: 4
  • Create event: 2
Last Year
  • Push event: 4
  • Create event: 2