-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgamsinstwin.sh
executable file
·104 lines (87 loc) · 2.07 KB
/
gamsinstwin.sh
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# Copyright (C) 2011 GAMS Development and others
# All Rights Reserved.
# This file is distributed under the Eclipse Public License.
#
# Author: Michael Bussieck, Stefan Vigerske
gamspath="$1"
if test -z "$gamspath" ; then
echo "Need to get path of GAMS system as first argument."
exit 1
fi
gmscmp=${gamspath}/gmscmpNT.txt
gmscmporig="${gmscmp}.orig"
gmscmpbak="${gmscmp}.bak"
if ! test -r "$gmscmp" ;
then
echo "File $gmscmp not found or not readable, cannot edit."
exit 1
fi
if ! test -e "gamsworhp.exe"
then
echo "Solver binary gamsworhp.exe not found, cannot install."
exit 1
fi
echo "Adding or updating entry for WORHP into $gmscmp."
# keep backup of original gmscmpun.txt file
if ! test -r "$gmscmporig"
then
cp "$gmscmp" "$gmscmporig"
fi
# keep backup of current gmscmpun.txt file
cp -f "$gmscmp" "$gmscmpbak"
awk '
BEGIN {
fileType = 111;
dictType = 5;
licCodes = "0001020304";
defaultOkFlag = 1;
hiddenFlag = 0;
scriptCmd = "gmswornt.cmd";
execCmd = "gmswornx.exe";
written["WORHP"] = 0;
libid["WORHP"] = "wor";
dicttype["WORHP"] = 5;
modeltypes["WORHP"] = "LP RMIP QCP RMIQCP NLP DNLP RMINLP CNS";
startBlock = 0;
}
function writeConfig(solverID) {
print solverID, fileType, dicttype[solverID], licCodes, defaultOkFlag, hiddenFlag, "1", modeltypes[solverID];
print scriptCmd;
print execCmd;
written[solverID] = 1;
}
(/^\*/ || /^ *$/) { print $0 }
/^DEFAULTS/ {
for( solverID in written )
if( !written[solverID] )
{
writeConfig(solverID)
print "";
}
print;
next;
}
!(/^*/ || /^ *$/) {
if( startBlock < 0 )
{
startBlock++;
next;
}
if( $1 in written && !written[$1] )
{
writeConfig($1)
startBlock = -($7+1);
next;
}
print;
}
' "$gmscmpbak" > "$gmscmp"
cat > "${gamspath}/gmswornt.cmd" <<EOF
@echo off
gmswornx.exe "%~4"
if not %errorlevel% == 0 echo err: solver rc %errorlevel% 1>&2
EOF
chmod +x "${gamspath}/gmswornt.cmd"
cp gamsworhp.exe "${gamspath}/gmswornx.exe"
cp $2/bin32/libworhp.dll "${gamspath}"