3 # Wrapper for custom remote provers on SystemOnTPTP
4 # Author: Fabian Immler, TU Muenchen
5 # Author: Jasmin Blanchette, TU Muenchen
11 use HTTP::Request::Common;
14 my $SystemOnTPTPFormReplyURL =
15 "http://www.cs.miami.edu/~tptp/cgi-bin/SystemOnTPTPFormReply";
20 "QuietFlag" => "-q01",
21 "SubmitButton" => "RunSelectedSystems",
22 "ProblemSource" => "UPLOAD",
23 "ForceSystem" => "-force",
26 #----Get format and transform options if specified
28 getopts("hws:t:c:",\%Options);
32 print("Usage: remote_atp [<options>] <file_name>\n");
34 print(" -h print this help\n");
35 print(" -w list available ATPs\n");
36 print(" -s<system> ATP to use\n");
37 print(" -t<time_limit> CPU time limit for ATP\n");
38 print(" -c<command> custom ATP invocation command\n");
39 print(" <file_name> TPTP problem file\n");
42 if (exists($Options{'h'})) {
46 #----What systems flag
47 if (exists($Options{'w'})) {
48 $URLParameters{"SubmitButton"} = "ListSystems";
49 delete($URLParameters{"ProblemSource"});
53 if (exists($Options{'x'})) {
54 $URLParameters{"X2TPTP"} = "-S";
59 if (exists($Options{'s'})) {
60 $System = $Options{'s'};
62 # use Vampire as default
63 $System = "Vampire---9.0";
65 $URLParameters{"System___$System"} = $System;
68 if (exists($Options{'t'})) {
69 $URLParameters{"TimeLimit___$System"} = $Options{'t'};
72 if (exists($Options{'c'})) {
73 $URLParameters{"Command___$System"} = $Options{'c'};
76 #----Get single file name
77 if (exists($URLParameters{"ProblemSource"})) {
78 if (scalar(@ARGV) >= 1) {
79 $URLParameters{"UPLOADProblem"} = [shift(@ARGV)];
81 print("Missing problem file\n");
88 my $Agent = LWP::UserAgent->new;
89 if (exists($Options{'t'})) {
90 # give server more time to respond
91 $Agent->timeout($Options{'t'} + 10);
93 my $Request = POST($SystemOnTPTPFormReplyURL,
94 Content_Type => 'form-data',Content => \%URLParameters);
95 my $Response = $Agent->request($Request);
97 #catch errors / failure
98 if(!$Response->is_success) {
99 print "HTTP-Error: " . $Response->message . "\n";
101 } elsif (exists($Options{'w'})) {
102 print $Response->content;
104 } elsif ($Response->content =~ /WARNING: (\S*) does not exist/) {
105 print "Specified system $1 does not exist\n";
108 print $Response->content;