Skip to content

Update README.md

Update README.md #78

Workflow file for this run

name: CLASS.DB
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Verify SIF files and CLASSF.DB consistency
runs-on: ubuntu-latest
steps:
- name: Checkout SIFDecode
uses: actions/checkout@v4
- name: Download the CUTEst NLP test set
shell: bash
run: |
cd $GITHUB_WORKSPACE/../
git clone https://github.com/ralna/SIF.git
- name: Check entries in CLASSF.DB and SIF files
shell: bash
run: |
cd $GITHUB_WORKSPACE/../SIF
# Read the CLASSF.DB file and store the problem names in an array
mapfile -t db_problems < <(awk '{print $1}' CLASSF.DB)
# Initialize counters for missing files and missing DB entries
missing_sif_count=0
missing_db_count=0
# Collect all available problems from:
# *.SIF
# *.SIF.bz2
declare -A sif_problems
shopt -s nullglob
for file in *.SIF; do
sif_problems["${file%.SIF}"]=1
done
for file in *.SIF.bz2; do
sif_problems["${file%.SIF.bz2}"]=1
done
# Check that every SIF/SIF.bz2 file is listed in CLASSF.DB
for problem_name in "${!sif_problems[@]}"; do
if [[ " ${db_problems[*]} " != *" ${problem_name} "* ]]; then
echo "${problem_name} is ABSENT from CLASSF.DB"
missing_db_count=$((missing_db_count + 1))
fi
done
# Check that every CLASSF.DB entry has either:
# problem.SIF
# problem.SIF.bz2
for problem in "${db_problems[@]}"; do
if [[ ! -f "${problem}.SIF" && ! -f "${problem}.SIF.bz2" ]]; then
echo "SIF file for ${problem} is MISSING"
missing_sif_count=$((missing_sif_count + 1))
fi
done
echo "Total number of SIF files without DB entries: ${missing_db_count}"
echo "Total number of DB entries without SIF files: ${missing_sif_count}"
if [ "${missing_db_count}" -ne 0 ] || [ "${missing_sif_count}" -ne 0 ]; then
echo "Error: Mismatch between CLASSF.DB entries and SIF files"
exit 1
fi