1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""Regenerate `cresc4.nl` (gh #524).
CRESC4 is a CUTE problem (Ph. Toint, June 1993, after J.P. Rasson): find the
smallest-area crescent containing a set of points in the plane. Transcribed
from CUTEst `mastsif/CRESC4.SIF`, which is the authority for the model, the
bounds and the start point.
python3 cresc4.py cresc4.nl
Needs only Pyomo (its `.nl` writer is native — no AMPL involved).
Why this file is committed alongside the `.nl`: the fixture's whole value is
that it is a faithful transcription of a real published problem rather than a
shape built to reproduce a symptom, and that claim is only checkable if the
transcription is readable. See `dev-notes/issue-524-cresc4-steenbrf.md`.
Geometry, in the SIF's parametrisation:
circle 1: center (v1, w1), radius r1 = a*d + r
circle 2: center (v1, w1) + a*d*(cos t, sin t), radius r2 = d + r
Every data point must lie inside circle 2 (`is2`) and outside circle 1
(`os1`); the objective is the crescent's area — circle 2 minus the lens where
the two overlap — which is the SIF's `SC` element, transcribed term for term
below. The known optimum is 0.8718976 (LOQO, SNOPT and Ipopt-MA57 all agree;
the SIF header records 0.87189692).
ENCODING WARNING. POUNCE's verdict on this problem depends on the surface
encoding, which is the point of gh #524: with the constraints declared
`is2`-first and the radius term written on the right-hand side (what this file
emits) POUNCE on defaults reports local infeasibility, and declaring `os1`
first or folding the radius into the constraint body flips it back to a clean
solve. Six of the twelve encodings tried fail. Changing the declaration order
or the `<=` form below therefore changes what the fixture tests.
"""
#: The four data points to be enclosed (SIF `X1..X4` / `Y1..Y4`).
=
=
# Bounds and initial values are the SIF's BOUNDS / START POINT blocks.
=
=
=
=
=
=
# --- SIF element SC: the crescent's area. ---
= + # radius of the enclosing circle
= * + # radius of the excluded circle
= * # distance between the two centers
= 2.0 * *
= 2.0 * *
= /
= - /
=
=
# inside circle 2
, =
return ** 2 + ** 2 <= ** 2
# outside circle 1
, =
return ** 2 + ** 2 >= ** 2
# Declaration order is load-bearing — see the ENCODING WARNING above.
=
=
return
=