CN114817131A - Method, system, equipment and storage medium for processing optimization problem description file - Google Patents

Method, system, equipment and storage medium for processing optimization problem description file Download PDF

Info

Publication number
CN114817131A
CN114817131A CN202210257291.7A CN202210257291A CN114817131A CN 114817131 A CN114817131 A CN 114817131A CN 202210257291 A CN202210257291 A CN 202210257291A CN 114817131 A CN114817131 A CN 114817131A
Authority
CN
China
Prior art keywords
optimization problem
file
format
description file
problem description
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210257291.7A
Other languages
Chinese (zh)
Inventor
郑皓天
梁峻滔
李金龙
梁奕涵
方明阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
University of Science and Technology of China USTC
Original Assignee
University of Science and Technology of China USTC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by University of Science and Technology of China USTC filed Critical University of Science and Technology of China USTC
Priority to CN202210257291.7A priority Critical patent/CN114817131A/en
Publication of CN114817131A publication Critical patent/CN114817131A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a processing method, a system, equipment and a storage medium for an optimization problem description file, which can convert the current common optimization problem description file into a uniform standardized format, for a developer, the most time consuming work is to exchange data files among different systems (possibly supporting different file formats), if the same data can be described by a plurality of files but the files are incompatible with each other, the complexity of data exchange is greatly reduced by converting the data files into the uniform standardized format for storage, the data can be read by different programs, the software developer can concentrate on using the same file to display and arrange the data, and the change of the data can not cause the change of the original file, thereby being convenient for maintenance. In addition, by using a unified normalized format, the solver only needs to provide one set of interfaces and one set of data structures to deal with different kinds of optimization problems, so that the complexity of the solver structure is reduced.

Description

Method, system, equipment and storage medium for processing optimization problem description file
Technical Field
The invention relates to the technical field of software engineering, in particular to a method, a system, equipment and a storage medium for processing an optimization problem description file.
Background
The existing description file specifications of various common optimization problems mainly include IBM CPLEX (R) LP, MPS, OPB, WBO, PIP, CNF and the like.
There are many existing mathematical software for solving mathematical programming problems (optimization problems), such as SCIP, CRAN, etc., but the optimization problems are of different kinds, and it is a common practice to implement a reader for each type of problem, so as to read information of an input file in a specified format, and then deliver the information to a solving tool for solving, and the process is shown in fig. 1.
The disadvantage of the flow shown in fig. 1 is that a complete function solver suite (suite) is excessively cumbersome (a reader with many solvers attached thereto), and a solver (solver) also needs to provide different interfaces and data structures for different readers to store information obtained from problem description files of a specified type, and if the same problem is described by multiple different files, operations such as algorithm matching and the like need to be performed in the solver according to different file types, which is relatively complicated; therefore, these types of optimization problem description files, which are common at present, have great limitations:
1) the described optimization problems are limited in types/single, one file type can only describe one type of optimization problems, and the method is not friendly to designing a solving tool for uniformly solving various optimization problems.
2) The information is redundant, and some information in the file format can be obtained by program analysis and is not required to be written out by a user.
3) Part of the file (e.g.,. cnf) is complex or too abstract in syntax and has poor readability.
Disclosure of Invention
The invention aims to provide a processing method, a system, equipment and a storage medium for optimization problem description files, which can convert the common optimization problem description files into a uniform standardized format, so that the optimization problem description files are easier to read, more convenient to record and more convenient to debug, and even the data sharing between different systems and different programs is simpler.
The purpose of the invention is realized by the following technical scheme:
an optimization problem description file processing method comprises the following steps:
according to the format of the optimization problem description file to be processed, reading the file content by using a corresponding reader;
and separating the read file contents to obtain different types of data information, and filling the separated data information into the description file in the standardized format according to the types to obtain the optimization problem description file in the standardized format.
An optimization problem description file processing system, comprising:
the file reading module is used for describing a file format according to the optimization problem to be processed and reading the file content by using a corresponding reader;
and the conversion module is used for separating the read file contents to obtain different types of data information, and filling the separated data information into the description file in the standardized format according to the types to obtain the optimization problem description file in the standardized format.
A processing device, comprising: one or more processors; a memory for storing one or more programs;
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the aforementioned methods.
A readable storage medium, storing a computer program which, when executed by a processor, implements the aforementioned method.
It can be seen from the above technical solutions provided by the present invention that these types of optimization problem description files, which are common at present, can be converted into a unified standardized format, for a developer, the most time consuming work is to exchange data files between different systems (which may support different file formats), if the same type of data can be described by multiple files but the files are incompatible with each other, converting the data files into the unified standardized format for storage will greatly reduce the complexity when exchanging data, and also enable the data to be read by different programs, and also enable a software developer to concentrate on using the same type of file for the display and layout of the data, and ensure that the data change will not cause the change of the original file, thereby facilitating maintenance. In addition, by using a unified normalized format, the solver only needs to provide one set of interfaces and one set of data structures to deal with different kinds of optimization problems, so that the complexity of the solver structure is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a flowchart for reading and solving description files of these types of optimization problems, which are commonly used at present and provided in the background art of the present invention;
fig. 2 is a schematic diagram illustrating file reading and conversion in an optimization problem description file processing method according to an embodiment of the present invention;
FIG. 3 is a schematic processing diagram of an optimization problem description file for a normalized format according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating the contents of an optimization problem description file in a converted normalized format according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating normalized solution results provided by an embodiment of the present invention;
fig. 6 is a schematic diagram illustrating a CNF format description corresponding to an optimization problem provided in the embodiment of the present invention;
FIG. 7 is a schematic diagram of a possible description scheme provided by an embodiment of the present invention;
fig. 8 is a schematic diagram of a description scheme provided by an embodiment of the present invention after retaining one line and one sub-formula features of the CNF format;
fig. 9 is a schematic diagram of an optimization problem description result obtained by converting the above optimization problem described in the OPB format into a normalized format according to an embodiment of the present invention;
fig. 10 is a schematic diagram of an optimization problem description result obtained by converting the above optimization problem described in the WBO format into a normalized format according to an embodiment of the present invention;
fig. 11 is a schematic diagram illustrating an optimization problem description result obtained by converting the above optimization problem described in the PIP format into a normalized format according to an embodiment of the present invention;
FIG. 12 is a diagram illustrating the MPS format description result of the linear programming problem according to an embodiment of the present invention;
FIG. 13 is a diagram illustrating a normalized format description result of a linear programming problem according to an embodiment of the present invention;
fig. 14 is a schematic diagram of a processing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
The terms that may be used herein are first described as follows:
the terms "comprising," "including," "containing," "having," or other similar terms of meaning should be construed as non-exclusive inclusions. For example: including a feature (e.g., material, component, ingredient, carrier, formulation, material, dimension, part, component, mechanism, device, step, process, method, reaction condition, processing condition, parameter, algorithm, signal, data, product, or article, etc.) that is not specifically recited, should be interpreted to include not only the specifically recited feature but also other features not specifically recited and known in the art.
The following describes a processing scheme of an optimization problem description file provided by the present invention in detail. Details which are not described in detail in the embodiments of the invention belong to the prior art which is known to the person skilled in the art. Those not specifically mentioned in the examples of the present invention were carried out according to the conventional conditions in the art or conditions suggested by the manufacturer. The reagents or instruments used in the examples of the present invention are not specified by manufacturers, and are all conventional products available by commercial purchase.
Example one
As shown in fig. 2, a method for processing an optimization problem description file mainly includes the following steps:
1. and according to the format of the optimization problem description file to be processed, reading the file content by using a corresponding reader.
As shown in fig. 2, the format of the optimization problem description file to be processed includes: the LP, MPS, OPB, WBO, PIP and CNF formats, which are some types of optimization problem description files commonly used in the related art, can also be applied to the optimization problem description files in other formats.
2. And separating the read file contents to obtain different types of data information, and filling the separated data information into the description file in the standardized format according to the types to obtain the optimization problem description file in the standardized format.
In the embodiment of the present invention, the optimization problem description file in the standardized format includes five items of data information that are sequentially set: the optimization problem to be processed describes file format types, objective functions, constraint conditions, variable value ranges and annotations. And the separated data information of each part is contrasted and filled into the description file with the standardized format through a conversion module.
Then, the optimization problem description file in the normalized format can be input to a solver to obtain a solution result. It should be noted that the tool for implementing the file format conversion is not bound to the solver, so that the solver is prevented from becoming a large suite.
Referring also to fig. 2, LP, PIP, OPB, WBO, CNF, etc. are description specifications of some optimization problems that exist at present, and. LP,. PIP,. OPB,. WBO,. CNF are their corresponding file format suffix names, where LP is used to describe the linear programming problem, PIP is used to describe the polynomial mixed integer problem, OPB is used to describe the pseudo-boolean problem, WBO is used to describe the weighted boolean optimization problem, and CNF is used to describe the boolean satisfiable formula problem. The sop (standard Optimization project) is an Optimization problem description file in a standardized format provided by the invention, and the suffix name of the sop is sop, so that all types of Optimization problems can be described by using a unified specification. It should be noted that fig. 2 only provides some examples of file formats in consideration of image space, and actually, other more file formats can be supported.
Compared with the existing scheme shown in FIG. 1, the invention unifies all types of conversion modules, which can reduce the coding difficulty of solver codes and the time for matching algorithms. After the conversion module provided by the invention is used, the solver only needs one interface connected with the conversion module.
As shown in fig. 3, the related file format conversion method is denoted as SOPC (SOP-Based Converter), and when solving various optimization problems, the existing various optimization problem file formats can be converted into SOP formats through SOPC, and then processed by a solver (solver); of course, if the optimization problem required to be solved is described by the sop format, the conversion module can directly deliver the file to a solver for processing; in addition, bidirectional interconversion of various file formats can be realized through the SOPC, namely, all parts of data information in the sop format are contrastingly filled into a target file format required to be converted.
Referring also to fig. 3, the solver inputs an optimization problem description file in a normalized format (. sop format file), and the contents mainly include:
1) question type (keyword probtype, specifying File type keyword)
2) The objective function (may default; keywords Objective, max/min)
3) Constraint (keyword Subject to)
4) Variable value range (keywords, General, BInary, etc.)
5) Note (Single line notes begin with # and only support single line notes)
The optimization problem description file in the normalized format is expressed by using a mathematical language as much as possible.
Taking the LP file format as an example, the block is divided by using keywords and indentation, and the transformed optimization problem description file in the normalized format is shown in fig. 4.
The solver outputs the normalized solution result (Output) shown in fig. 5 after internal calculation, with the suffix name of.out.
The scheme of the embodiment of the invention mainly has the following beneficial effects:
1) the file format conversion scheme described above can separate data from lp, rlp, cnf, etc. files. The data can be stored in the sop file besides the file to be processed, so that a software developer can concentrate on using the same file (namely sop) to well display and layout the data, the original file is not required to be changed when the data is changed, and the maintenance is convenient.
2) The file format conversion scheme described above may be used to exchange data. The data stored in the computer system and the database system has various forms, the most time-consuming work for developers is to exchange data among different systems (possibly supporting different file formats), if the same problem (or data) can be described by multiple files but the files are not compatible with each other, the complexity of exchanging the data is greatly reduced by converting the data into the sop format for storage, and the data can be read by different programs.
3) The file format conversion scheme described above may be used to share data. sop data is stored in a plain text format, so that the sop data is easier to read, more convenient to record and debug, and even the data sharing among different systems and different programs is simpler.
4) The SOP file can make full use of the data. The SOP file format is software, hardware and application independent (i.e., platform independent), and data can be utilized by more users and devices, not just limited to processes that can only read files in some specific formats. Other clients and applications may handle the sop file as a data source, and like the operations database, the data of the sop file may be handled by a variety of "readers".
5) In the future, a format converter centered on the sop file may be used to create a new language. Creating new languages based on data or languages in a certain format is precedent; for example, both WAP and WML languages are developed from XML. WML (Wireless Markup Language) is a tool for identifying Internet programs running on handheld devices, such as mobile phones, and adopts the standard of XML.
In order to fully show the effect of the optimization problem description file in the normalized format in the above scheme of the present invention, several types of optimization problem description files that are common at present and the content of the optimization problem description file in the normalized format provided by the present invention are explained below.
Example optimization problem: (x1 OR (NOT x3)) AND (x2 OR x3 OR (NOT x1))
1. CNF format.
As shown in fig. 6, for the CNF format description corresponding to the optimization problem, p in the CNF format shown in fig. 6 starts with a problem line, the first number after CNF represents the number of variables, and the second number represents the number of divisor, specifically: and p is followed by a constraint, the number which is NOT 0 represents the name of the variable, the number which is preceded by a "-" sign represents the negation, namely "NOT", and each constraint is ended by 0, as can be seen from the content shown in FIG. 6, the readability is poor, and the number of the variables and the number of the constraints can be completely resolved by the conjunctive normal form.
Since the sat problem described by the cnf file is originally a conjunctive normal form, the conjunctive normal form is directly used to describe the problem in the sop format.
Fig. 7 to 8 show a possible scheme and a scheme after retaining the characteristics of one line and one sub-formula of the CNF format, respectively.
Taking fig. 7 as an example, the cnf format problem shown in fig. 6 represents:
(x(1)OR(NOT x(3)))
AND
(x(2)OR x(3)OR(NOT x(1)))
then, in sop, OR becomes +, AND becomes, AND the end result is fig. 7, i.e., the conjunctive normal form of the problem, which is done to facilitate the description of the problem.
2. The OPB format.
In this format, it is not necessary to specify the values "# variable", "# constraint", "# product", etc. in the file, and the parser may determine that the product between the variables needs to be connected by a power, and the power is expressed by a power, as shown in fig. 9, so as to convert the optimization problem described in the OPB format into the optimization problem description result in the normalized format.
3. WBO format.
In this format, the soft constraint is preceded by "[ T ]", with T being the cost. As shown in fig. 10, the above optimization problem described in the WBO format is converted into an optimization problem description result in the normalized format.
4. PIP format.
As shown in fig. 11, the above optimization problem described in the PIP format is converted into an optimization problem description result in the normalized format.
5. MPS format versus normalized format.
For the following linear programming problem:
max x 1 +2x 2 +3x 3 +x 4
Figure BDA0003549200690000071
fig. 12 to 13 show the description of the MPS format and the description result of the normalized format, respectively.
As can be seen from comparing fig. 12 to fig. 13, for the same optimization problem, the input process of the user can be greatly simplified and the user experience can be optimized by using the normalized format description provided by the present invention.
Example two
The present invention further provides an optimization problem description file processing system, which is implemented mainly based on the method provided in the foregoing embodiment, and also refer to fig. 2, where the system mainly includes:
the file reading module is used for describing a file format according to the optimization problem to be processed and reading the file content by using a corresponding reader;
and the conversion module is used for separating the read file contents to obtain different types of data information, and filling the separated data information into the description file in the standardized format according to the types to obtain the optimization problem description file in the standardized format.
In the embodiment of the present invention, the optimization problem description file in the standardized format includes five items of data information that are sequentially set: the optimization problem to be processed describes file format types, objective functions, constraint conditions, variable value ranges and annotations.
In the embodiment of the invention, the format of the optimization problem description file to be processed comprises the following steps: LP, MPS, OPB, WBO, PIP, and CNF formats.
In the embodiment of the present invention, the system further includes: and the solver inputs the optimization problem description file in the standardized format and outputs a solving result.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to perform all or part of the above described functions.
EXAMPLE III
The present invention also provides a processing apparatus, as shown in fig. 14, which mainly includes: one or more processors; a memory for storing one or more programs; wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods provided by the foregoing embodiments.
Further, the processing device further comprises at least one input device and at least one output device; in the processing device, a processor, a memory, an input device and an output device are connected through a bus.
In the embodiment of the present invention, the specific types of the memory, the input device, and the output device are not limited; for example:
the input device can be a touch screen, an image acquisition device, a physical button or a mouse and the like;
the output device may be a display terminal;
the Memory may be a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as a disk Memory.
Example four
The present invention also provides a readable storage medium storing a computer program which, when executed by a processor, implements the method provided by the foregoing embodiments.
The readable storage medium in the embodiment of the present invention may be provided in the foregoing processing device as a computer readable storage medium, for example, as a memory in the processing device. The readable storage medium may be various media that can store program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An optimization problem description file processing method is characterized by comprising the following steps:
according to the format of the optimization problem description file to be processed, reading the file content by using a corresponding reader;
and separating the read file contents to obtain different types of data information, and filling the separated data information into the description file in the standardized format according to the types to obtain the optimization problem description file in the standardized format.
2. The method as claimed in claim 1, wherein the optimization problem description file in the standardized format comprises five items of data information sequentially set: the optimization problem to be processed describes file format types, objective functions, constraint conditions, variable value ranges and annotations.
3. The method of claim 1, wherein the format of the optimization problem description file to be processed comprises: LP, MPS, OPB, WBO, PIP, and CNF formats.
4. The method of claim 1, further comprising: and inputting the optimization problem description file in the standardized format into a solver to obtain a solution result.
5. An optimization problem description file processing system, comprising:
the file reading module is used for describing a file format according to the optimization problem to be processed and reading the file content by using a corresponding reader;
and the conversion module is used for separating the read file contents to obtain different types of data information, and filling the separated data information into the description file in the standardized format according to the types to obtain the optimization problem description file in the standardized format.
6. The system of claim 5, wherein the optimization problem description file in the standardized format comprises five items of data information arranged in sequence: the optimization problem to be processed describes file format types, objective functions, constraint conditions, variable value ranges and annotations.
7. The optimization problem description file processing system according to claim 5, wherein the format of the optimization problem description file to be processed comprises: LP, MPS, OPB, WBO, PIP, and CNF formats.
8. The optimization problem solution-oriented profile processing system of claim 5, further comprising: and the solver inputs the optimization problem description file in the standardized format and outputs a solving result.
9. A processing device, comprising: one or more processors; a memory for storing one or more programs;
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-4.
10. A readable storage medium, storing a computer program, characterized in that the computer program, when being executed by a processor, carries out the method according to any one of claims 1 to 4.
CN202210257291.7A 2022-03-16 2022-03-16 Method, system, equipment and storage medium for processing optimization problem description file Pending CN114817131A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210257291.7A CN114817131A (en) 2022-03-16 2022-03-16 Method, system, equipment and storage medium for processing optimization problem description file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210257291.7A CN114817131A (en) 2022-03-16 2022-03-16 Method, system, equipment and storage medium for processing optimization problem description file

Publications (1)

Publication Number Publication Date
CN114817131A true CN114817131A (en) 2022-07-29

Family

ID=82529371

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210257291.7A Pending CN114817131A (en) 2022-03-16 2022-03-16 Method, system, equipment and storage medium for processing optimization problem description file

Country Status (1)

Country Link
CN (1) CN114817131A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115796405A (en) * 2023-02-03 2023-03-14 阿里巴巴达摩院(杭州)科技有限公司 Solution report generation method for optimization model and computing equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115796405A (en) * 2023-02-03 2023-03-14 阿里巴巴达摩院(杭州)科技有限公司 Solution report generation method for optimization model and computing equipment

Similar Documents

Publication Publication Date Title
US20190155874A1 (en) Markup language system, method, and computer program product
US7249328B1 (en) Tree view for reusable data markup language
Feijs et al. Formal specification and design
US7650355B1 (en) Reusable macro markup language
US7512875B2 (en) Chart view for reusable data markup language
US7159185B1 (en) Function objects
US7571151B1 (en) Data analysis tool for analyzing data stored in multiple text files
US20020184266A1 (en) Universal file format for products that allows both parametric and textual searching
CN110489087B (en) Method, device, medium and electronic equipment for generating fractal structure
WO2006102512A2 (en) Change control management of xml documents
JP5377818B2 (en) Method and system for sequentially accessing a compiled schema
US10055468B2 (en) Access to data collections by a computational system
JP5044942B2 (en) System and method for determining acceptance status in document analysis
US8775392B1 (en) Revision control and configuration management
EP3296864A1 (en) Storing and retrieving documentation
CN114817131A (en) Method, system, equipment and storage medium for processing optimization problem description file
CN109740130B (en) Method and device for generating file
US7315980B2 (en) Method and apparatus for generating electronic document definitions
CN111897778B (en) Computer file merging method, device and system
Le Zou et al. On synchronizing with web service evolution
US9262383B2 (en) System, method, and computer program product for processing a markup document
Heyer et al. CLARIN-D: an IT-based research infrastructure for the humanities and social sciences
JPH07334528A (en) Term dictionary management device
Lynch et al. Analyzing and Normalizing Illinois Digital Heritage Hub Type Metadata
CN116702712A (en) Word task book conversion method and device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination