Skip to content

Commit

Permalink
added cutest_classification following a request
Browse files Browse the repository at this point in the history
corrected C interfaces so that strings and arrays of strings work properly
  • Loading branch information
dalekopera committed Sep 29, 2024
1 parent bd1b94e commit ac3f0d1
Show file tree
Hide file tree
Showing 27 changed files with 656 additions and 53 deletions.
Binary file added doc/pdf/cutest_classification.pdf
Binary file not shown.
49 changes: 29 additions & 20 deletions include/cutest.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Boolean logicals provided, August 21 2013
* fortran intent(in) variables defined as const, Dec 2 2015
*
* this version 2024-08-27
* this version 2024-09-29
*
* ======================================================================
*/
Expand Down Expand Up @@ -91,6 +91,7 @@ typedef int ipc_;
#define ONE 1e0
#define CUTE_INF 1e20 /* 'infinity' in CUTEst interface */
#define FSTRING_LEN 10 /* Length of Fortran strings */
#define FCSTRING_LEN 30 /* Length of Fortran classification string */

/* AIX does not append underscore to Fortran subroutine names */
#ifdef _AIX
Expand Down Expand Up @@ -118,7 +119,7 @@ typedef struct VarTypes {
#define CUTEST_udimsh FUNDERSCORE(cutest_udimsh)
#define CUTEST_udimse FUNDERSCORE(cutest_udimse)
#define CUTEST_uvartype FUNDERSCORE(cutest_uvartype)
#define CUTEST_unames FUNDERSCORE(cutest_unames)
#define CUTEST_unames FUNDERSCORE(cutest_cint_unames)
#define CUTEST_ureport FUNDERSCORE(cutest_ureport)

#define CUTEST_cdimen FUNDERSCORE(cutest_cdimen)
Expand All @@ -131,13 +132,13 @@ typedef struct VarTypes {
#define CUTEST_cdimse FUNDERSCORE(cutest_cdimse)
#define CUTEST_cstats FUNDERSCORE(cutest_cstats)
#define CUTEST_cvartype FUNDERSCORE(cutest_cvartype)
#define CUTEST_cnames FUNDERSCORE(cutest_cnames)
#define CUTEST_cnames FUNDERSCORE(cutest_cint_cnames)
#define CUTEST_creport FUNDERSCORE(cutest_creport)

#define CUTEST_connames FUNDERSCORE(cutest_connames)
#define CUTEST_pname FUNDERSCORE(cutest_pname)
#define CUTEST_probname FUNDERSCORE(cutest_probname)
#define CUTEST_varnames FUNDERSCORE(cutest_varnames)
#define CUTEST_classification FUNDERSCORE(cutest_cint_classification)
#define CUTEST_connames FUNDERSCORE(cutest_cint_connames)
#define CUTEST_pname FUNDERSCORE(cutest_cint_pname)
#define CUTEST_probname FUNDERSCORE(cutest_cint_probname)
#define CUTEST_varnames FUNDERSCORE(cutest_cint_varnames)

#define CUTEST_ufn FUNDERSCORE(cutest_ufn)
#define CUTEST_ugr FUNDERSCORE(cutest_ugr)
Expand Down Expand Up @@ -210,7 +211,7 @@ typedef struct VarTypes {
#define CUTEST_udimsh_s FUNDERSCORE(cutest_udimsh_s)
#define CUTEST_udimse_s FUNDERSCORE(cutest_udimse_s)
#define CUTEST_uvartype_s FUNDERSCORE(cutest_uvartype_s)
#define CUTEST_unames_s FUNDERSCORE(cutest_unames_s)
#define CUTEST_unames_s FUNDERSCORE(cutest_cint_unames_s)
#define CUTEST_ureport_s FUNDERSCORE(cutest_ureport_s)

#define CUTEST_cdimen_s FUNDERSCORE(cutest_cdimen_s)
Expand All @@ -223,13 +224,14 @@ typedef struct VarTypes {
#define CUTEST_cdimse_s FUNDERSCORE(cutest_cdimse_s)
#define CUTEST_cstats_s FUNDERSCORE(cutest_cstats_s)
#define CUTEST_cvartype_s FUNDERSCORE(cutest_cvartype_s)
#define CUTEST_cnames_s FUNDERSCORE(cutest_cnames_s)
#define CUTEST_cnames_s FUNDERSCORE(cutest_cint_cnames_s)
#define CUTEST_creport_s FUNDERSCORE(cutest_creport_s)

#define CUTEST_connames_s FUNDERSCORE(cutest_connames_s)
#define CUTEST_pname_s FUNDERSCORE(cutest_pname_s)
#define CUTEST_probname_s FUNDERSCORE(cutest_probname_s)
#define CUTEST_varnames_s FUNDERSCORE(cutest_varnames_s)
#define CUTEST_classification_s FUNDERSCORE(cutest_cint_classification_s)
#define CUTEST_connames_s FUNDERSCORE(cutest_cint_connames_s)
#define CUTEST_pname_s FUNDERSCORE(cutest_cint_pname_s)
#define CUTEST_probname_s FUNDERSCORE(cutest_cint_probname_s)
#define CUTEST_varnames_s FUNDERSCORE(cutest_cint_varnames_s)

#define CUTEST_ufn_s FUNDERSCORE(cutest_ufn_s)
#define CUTEST_ugr_s FUNDERSCORE(cutest_ugr_s)
Expand Down Expand Up @@ -345,6 +347,8 @@ void CUTEST_creport ( integer *status, doublereal *calls, doublereal *time );

void CUTEST_connames( integer *status, const integer *m, char *gname );
void CUTEST_pname ( integer *status, const integer *funit, char *pname );
void CUTEST_classification ( integer *status, const integer *funit,
char *classification );
void CUTEST_probname( integer *status, char *pname );
void CUTEST_varnames( integer *status, const integer *n, char *vname );

Expand Down Expand Up @@ -598,6 +602,8 @@ void CUTEST_creport_s ( integer *status, real *calls, real *time );

void CUTEST_connames_s( integer *status, const integer *m, char *gname );
void CUTEST_pname_s ( integer *status, const integer *funit, char *pname );
void CUTEST_classification_s ( integer *status, const integer *funit,
char *classification );
void CUTEST_probname_s( integer *status, char *pname );
void CUTEST_varnames_s( integer *status, const integer *n, char *vname );

Expand Down Expand Up @@ -814,7 +820,7 @@ void FORTRAN_close_s( const integer *funit, integer *ierr );
#define CUTEST_udimsh_q FUNDERSCORE(cutest_udimsh_q)
#define CUTEST_udimse_q FUNDERSCORE(cutest_udimse_q)
#define CUTEST_uvartype_q FUNDERSCORE(cutest_uvartype_q)
#define CUTEST_unames_q FUNDERSCORE(cutest_unames_q)
#define CUTEST_unames_q FUNDERSCORE(cutest_cint_unames_q)
#define CUTEST_ureport_q FUNDERSCORE(cutest_ureport_q)

#define CUTEST_cdimen_q FUNDERSCORE(cutest_cdimen_q)
Expand All @@ -827,13 +833,14 @@ void FORTRAN_close_s( const integer *funit, integer *ierr );
#define CUTEST_cdimse_q FUNDERSCORE(cutest_cdimse_q)
#define CUTEST_cstats_q FUNDERSCORE(cutest_cstats_q)
#define CUTEST_cvartype_q FUNDERSCORE(cutest_cvartype_q)
#define CUTEST_cnames_q FUNDERSCORE(cutest_cnames_q)
#define CUTEST_cnames_q FUNDERSCORE(cutest_cint_cnames_q)
#define CUTEST_creport_q FUNDERSCORE(cutest_creport_q)

#define CUTEST_connames_q FUNDERSCORE(cutest_connames_q)
#define CUTEST_pname_q FUNDERSCORE(cutest_pname_q)
#define CUTEST_probname_q FUNDERSCORE(cutest_probname_q)
#define CUTEST_varnames_q FUNDERSCORE(cutest_varnames_q)
#define CUTEST_classification_q FUNDERSCORE(cutest_cint_classification_q)
#define CUTEST_connames_q FUNDERSCORE(cutest_cint_connames_q)
#define CUTEST_pname_q FUNDERSCORE(cutest_cint_pname_q)
#define CUTEST_probname_q FUNDERSCORE(cutest_cint_probname_q)
#define CUTEST_varnames_q FUNDERSCORE(cutest_cint_varnames_q)

#define CUTEST_ufn_q FUNDERSCORE(cutest_ufn_q)
#define CUTEST_ugr_q FUNDERSCORE(cutest_ugr_q)
Expand Down Expand Up @@ -944,6 +951,8 @@ void CUTEST_creport_q ( integer *status, quadreal *calls, quadreal *time );

void CUTEST_connames_q( integer *status, const integer *m, char *gname );
void CUTEST_pname_q ( integer *status, const integer *funit, char *pname );
void CUTEST_classification_q ( integer *status, const integer *funit,
char *classification );
void CUTEST_probname_q( integer *status, char *pname );
void CUTEST_varnames_q( integer *status, const integer *n, char *vname );

Expand Down
8 changes: 8 additions & 0 deletions include/cutest_routines_double.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
#define CUTEST_Cint_uhprod_r CUTEST_Cint_uhprod
#define CUTEST_Cint_uofg_r CUTEST_Cint_uofg
#define CUTEST_Cint_ushprod_r CUTEST_Cint_ushprod
#define CUTEST_Cint_classification_r CUTEST_Cint_classification
#define CUTEST_Cint_pname_r CUTEST_Cint_pname
#define CUTEST_Cint_unames_r CUTEST_Cint_unames
#define CUTEST_Cint_cnames_r CUTEST_Cint_cnames
#define CUTEST_Cint_probname_r CUTEST_Cint_probname
#define CUTEST_Cint_varnames_r CUTEST_Cint_varnames
#define CUTEST_Cint_connames_r CUTEST_Cint_connames
#define CUTEST_cisgrp_r CUTEST_cisgrp
#define CUTEST_cisgrp_threaded_r CUTEST_cisgrp_threaded
#define CUTEST_cisgrp_threadsafe_r CUTEST_cisgrp_threadsafe
Expand Down Expand Up @@ -202,6 +209,7 @@
#define CUTEST_initialize_thread_r CUTEST_initialize_thread
#define CUTEST_LQP_create_r CUTEST_LQP_create
#define CUTEST_newthread_threadsafe_r CUTEST_newthread_threadsafe
#define CUTEST_classification_r CUTEST_classification
#define CUTEST_pname_r CUTEST_pname
#define CUTEST_problem_setup_r CUTEST_problem_setup
#define CUTEST_problem_terminate_r CUTEST_problem_terminate
Expand Down
8 changes: 8 additions & 0 deletions include/cutest_routines_quadruple.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
#define CUTEST_Cint_uhprod_r CUTEST_Cint_uhprod_q
#define CUTEST_Cint_uofg_r CUTEST_Cint_uofg_q
#define CUTEST_Cint_ushprod_r CUTEST_Cint_ushprod_q
#define CUTEST_Cint_classification_r CUTEST_Cint_classification_q
#define CUTEST_Cint_pname_r CUTEST_Cint_pname_q
#define CUTEST_Cint_unames_r CUTEST_Cint_unames_q
#define CUTEST_Cint_cnames_r CUTEST_Cint_cnames_q
#define CUTEST_Cint_probname_r CUTEST_Cint_probname_q
#define CUTEST_Cint_varnames_r CUTEST_Cint_varnames_q
#define CUTEST_Cint_connames_r CUTEST_Cint_connames_q
#define CUTEST_cisgrp_r CUTEST_cisgrp_q
#define CUTEST_cisgrp_threaded_r CUTEST_cisgrp_threaded_q
#define CUTEST_cisgrp_threadsafe_r CUTEST_cisgrp_threadsafe_q
Expand Down Expand Up @@ -202,6 +209,7 @@
#define CUTEST_initialize_thread_r CUTEST_initialize_thread_q
#define CUTEST_LQP_create_r CUTEST_LQP_create_q
#define CUTEST_newthread_threadsafe_r CUTEST_newthread_threadsafe_q
#define CUTEST_classification_r CUTEST_classification_q
#define CUTEST_pname_r CUTEST_pname_q
#define CUTEST_problem_qetup_r CUTEST_problem_qetup_q
#define CUTEST_problem_terminate_r CUTEST_problem_terminate_q
Expand Down
8 changes: 8 additions & 0 deletions include/cutest_routines_single.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
#define CUTEST_Cint_uhprod_r CUTEST_Cint_uhprod_s
#define CUTEST_Cint_uofg_r CUTEST_Cint_uofg_s
#define CUTEST_Cint_ushprod_r CUTEST_Cint_ushprod_s
#define CUTEST_Cint_classification_r CUTEST_Cint_classification_s
#define CUTEST_Cint_pname_r CUTEST_Cint_pname_s
#define CUTEST_Cint_unames_r CUTEST_Cint_unames_s
#define CUTEST_Cint_cnames_r CUTEST_Cint_cnames_s
#define CUTEST_Cint_probname_r CUTEST_Cint_probname_s
#define CUTEST_Cint_varnames_r CUTEST_Cint_varnames_s
#define CUTEST_Cint_connames_r CUTEST_Cint_connames_s
#define CUTEST_cisgrp_r CUTEST_cisgrp_s
#define CUTEST_cisgrp_threaded_r CUTEST_cisgrp_threaded_s
#define CUTEST_cisgrp_threadsafe_r CUTEST_cisgrp_threadsafe_s
Expand Down Expand Up @@ -202,6 +209,7 @@
#define CUTEST_initialize_thread_r CUTEST_initialize_thread_s
#define CUTEST_LQP_create_r CUTEST_LQP_create_s
#define CUTEST_newthread_threadsafe_r CUTEST_newthread_threadsafe_s
#define CUTEST_classification_r CUTEST_classification_s
#define CUTEST_pname_r CUTEST_pname_s
#define CUTEST_problem_setup_r CUTEST_problem_setup_s
#define CUTEST_problem_terminate_r CUTEST_problem_terminate_s
Expand Down
107 changes: 107 additions & 0 deletions man/man3/cutest_classification.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
'\" e @(#)cutest_classification v2.2 09/2024;
.TH cutest_classification 3M "29 Sep 2024" "CUTEst user documentation" "CUTEst user documentation"
.SH NAME
CUTEST_classification \- CUTEst tool to obtain the name of the problem directly
from OUTSDIF.d.
.SH SYNOPSIS
.HP 1i
CALL CUTEST_classification( status, input, classification )

.HP 1i
For real rather than double precision arguments, instead

.HP 1i
CALL CUTEST_classification_s( ... )

.HP 1i
and for quadruple precision arguments, when available,

.HP 1i
CALL CUTEST_classification_q( ... )

.SH DESCRIPTION
The CUTEST_classification subroutine obtains the classification string by
interogating the datafile OUTSDIF.d that was created by the script
\fIsifdecoder\fP when decoding a SIF file. The SIF file must also be
present in the directory containing the OUTSDIF.d file. Problems are
classified according to the scheme described in

.Bd
https://ralna.github.io/SIFDecode/html/classification/ .
.Ed

The problem under consideration
is to minimize or maximize an objective function
.EQ
f(x)
.EN
over all
.EQ
x
.EN
\(mo
.EQ
R sup n
.EN
subject to
general equations
.EQ
c sub i (x) ~=~ 0,
.EN
.EQ
~(i
.EN
\(mo
.EQ
{ 1 ,..., m sub E } ),
.EN
general inequalities
.EQ
c sub i sup l ~<=~ c sub i (x) ~<=~ c sub i sup u,
.EN
.EQ
~(i
.EN
\(mo
.EQ
{ m sub E + 1 ,..., m }),
.EN
and simple bounds
.EQ
x sup l ~<=~ x ~<=~ x sup u.
.EN
The objective function is group-partially separable and
all constraint functions are partially separable.

.LP
.SH ARGUMENTS
The arguments of CUTEST_classification are as follows
.TP 5
.B status \fP[out] - integer
the outputr status: 0 for a succesful call, -1 if the SIF file is
absent, -2 for a read error.
.TP
.B input \fP[in] - integer
the unit number for the decoded data; the unit from which OUTSDIF.d is read,
.TP
.B classification \fP[out] - character
a 30-character string containing the SIF classification of the problem.
.LP
.SH AUTHORS
I. Bongartz, A.R. Conn, N.I.M. Gould, D. Orban and Ph.L. Toint
.SH "SEE ALSO"
\fICUTEst: a Constrained and Unconstrained Testing
Environment with safe threads\fP,
N.I.M. Gould, D. Orban and Ph.L. Toint,
Computational Optimization and Applications \fB60\fP:3, pp.545-557, 2014.

\fICUTEr (and SifDec): A Constrained and Unconstrained Testing
Environment, revisited\fP,
N.I.M. Gould, D. Orban and Ph.L. Toint,
ACM TOMS, \fB29\fP:4, pp.373-394, 2003.

\fICUTE: Constrained and Unconstrained Testing Environment\fP,
I. Bongartz, A.R. Conn, N.I.M. Gould and Ph.L. Toint,
ACM TOMS, \fB21\fP:1, pp.123-160, 1995.

cutest_probname(3M), sifdecoder(1).
2 changes: 1 addition & 1 deletion man/man3/cutest_pname.3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'\" e @(#)cutest_pname v1.1 04/2014;
.TH cutest_udimen 3M "3 Apr 2014" "CUTEst user documentation" "CUTEst user documentation"
.TH cutest_pname 3M "3 Apr 2014" "CUTEst user documentation" "CUTEst user documentation"
.SH NAME
CUTEST_pname \- CUTEst tool to obtain the name of the problem directly
from OUTSDIF.d.
Expand Down
3 changes: 2 additions & 1 deletion man/man3/makedocs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
# cutest_csjprod \
# cutest_cterminate \
# cutest_cvartype \
# cutest_classification \
# cutest_pname \
# cutest_probname \
# cutest_timings \
Expand Down Expand Up @@ -271,7 +272,7 @@
#foreach pack ( cutest_ureport cutest_ureport_threaded \
# cutest_creport cutest_creport_threaded )

foreach pack ( cutest_ccf cutest_ccf_threaded )
foreach pack ( cutest_classification )

echo " " $pack
echo " .. making pdf"
Expand Down
3 changes: 1 addition & 2 deletions src/genc/genc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ extern "C" { /* To prevent C++ compilers from mangling symbols */
rp_ genc( rp_ dummy )
{

printf( "\n\tThis is the generic C solver" );
printf( "\n\thooked to CUTEst." );
printf( "\n\tThis is the generic C solver hooked to CUTEst." );
printf( "\n\tThe magic number is 41.9999995555555\n" );
return 41.9999995555555;

Expand Down
Loading

0 comments on commit ac3f0d1

Please sign in to comment.