3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-27 08:28:44 +00:00

add LP parser option to front-end and opt context

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-02-06 14:02:44 -08:00
parent 20fe08d80c
commit 43441d0fd5
8 changed files with 459 additions and 176 deletions

View file

@ -38,7 +38,7 @@ Revision History:
#include "util/env_params.h"
#include "shell/lp_frontend.h"
typedef enum { IN_UNSPECIFIED, IN_SMTLIB, IN_SMTLIB_2, IN_DATALOG, IN_DIMACS, IN_WCNF, IN_OPB, IN_Z3_LOG, IN_MPS } input_kind;
typedef enum { IN_UNSPECIFIED, IN_SMTLIB, IN_SMTLIB_2, IN_DATALOG, IN_DIMACS, IN_WCNF, IN_OPB, IN_LP, IN_Z3_LOG, IN_MPS } input_kind;
std::string g_aux_input_file;
char const * g_input_file = 0;
@ -71,10 +71,12 @@ void display_usage() {
std::cout << "]. (C) Copyright 2006-2016 Microsoft Corp.\n";
std::cout << "Usage: z3 [options] [-file:]file\n";
std::cout << "\nInput format:\n";
std::cout << " -smt use parser for SMT input format.\n";
std::cout << " -smt2 use parser for SMT 2 input format.\n";
std::cout << " -dl use parser for Datalog input format.\n";
std::cout << " -dimacs use parser for DIMACS input format.\n";
std::cout << " -wcnf use parser for Weighted CNF DIMACS input format.\n";
std::cout << " -opb use parser for PB optimization input format.\n";
std::cout << " -lp use parser for a modest subset of CPLEX LP input format.\n";
std::cout << " -log use parser for Z3 log input format.\n";
std::cout << " -in read formula from standard input.\n";
std::cout << "\nMiscellaneous:\n";
@ -188,9 +190,12 @@ void parse_cmd_line_args(int argc, char ** argv) {
else if (strcmp(opt_name, "wcnf") == 0) {
g_input_kind = IN_WCNF;
}
else if (strcmp(opt_name, "bpo") == 0) {
else if (strcmp(opt_name, "pbo") == 0) {
g_input_kind = IN_OPB;
}
else if (strcmp(opt_name, "lp") == 0) {
g_input_kind = IN_LP;
}
else if (strcmp(opt_name, "log") == 0) {
g_input_kind = IN_Z3_LOG;
}
@ -322,6 +327,9 @@ int STD_CALL main(int argc, char ** argv) {
else if (strcmp(ext, "opb") == 0) {
g_input_kind = IN_OPB;
}
else if (strcmp(ext, "lp") == 0) {
g_input_kind = IN_LP;
}
else if (strcmp(ext, "log") == 0) {
g_input_kind = IN_Z3_LOG;
}
@ -349,10 +357,13 @@ int STD_CALL main(int argc, char ** argv) {
return_value = read_dimacs(g_input_file);
break;
case IN_WCNF:
return_value = parse_opt(g_input_file, true);
return_value = parse_opt(g_input_file, wcnf_t);
break;
case IN_OPB:
return_value = parse_opt(g_input_file, false);
return_value = parse_opt(g_input_file, opb_t);
break;
case IN_LP:
return_value = parse_opt(g_input_file, lp_t);
break;
case IN_DATALOG:
read_datalog(g_input_file);