orloge


Nameorloge JSON
Version 0.17.2 PyPI version JSON
download
home_pagehttps://github.com/pchtsp/orloge
SummaryOR log extractor
upload_time2021-09-08 09:49:24
maintainerFranco Peschiera
docs_urlNone
authorFranco Peschiera
requires_python
license
keywords mathematical optimization solver log parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ## Orloge
[![Build Status](https://travis-ci.org/pchtsp/orloge.svg?branch=master)](https://travis-ci.org/pchtsp/orloge)


## What and why

The idea of this project is to permit a fast and easy parsing of the log files from different solvers, specifically 'operations research' (OR) logs.

There exist bigger, and more robust libraries. In particular, [IPET](https://github.com/GregorCH/ipet/). The trouble I had was that it deals with too many benchmarking and GUI things and I wanted something simple I could modify and build on top.

In any case, a lot of the ideas and parsing strings were obtained or adapted from IPET, to whom I am graceful.

The supported solvers for the time being are: GUROBI, CPLEX and CBC. Specially the two first ones.

## How

The basic idea is just to provide a unique interface function like the following:

    import orloge as ol
    ol.get_info_solver(path_to_solver_log, solver_name)

This returns a python dictionary with a lot of information from the log (see *Examples* below).

## Installation

    pip install orloge

or, for the development version:

    pip install https://github.com/pchtsp/orloge/archive/master.zip

## Testing

Run the command 

    python -m unittest test

 if the output says OK, all tests were passed.

## Reference

### Main parameters

The most common parameters to extract are: `best_bound`, `best_solution` and `time`. These three parameters are obtained at the end of the solving process and summarize the best relaxed objective value obtained, the best integer objective value obtained and the time it took to do the solving.

### Cuts

The cuts information can be accessed by the `cuts_info` key. It offers the best known bound after the cut phase has ended, the best solution (if any) after the cuts and the number of cuts made of each type.

### Matrix

There are two matrices that are provided. The `matrix` key returns the number of variables, constraints and non-zero values before the pre-processing of the solver. The `matrix_post` key returns these same values after the pre-processing has been done.

### Progress

The `progress` key returns a raw pandas Dataframe with the all the progress information the solver gives. Including the times, the gap, the best bound, the best solution, the iterations, nodes, among other. This table can vary in number of columns between solvers but the names of the columns are normalized so as to have the same name for the same information.

### Status

The status is given in several ways. First, a raw string extraction is returned in `status`. Then, a normalized one using codes is given via `sol_code` and `status_code` keys. `sol_code` gives information about the quality of the solution obtained. `status_code` gives details about the status of the solver after finishing (mainly, the reason it stopped).

### Other

There is also information about the pre-solving phase, the first bound and the first solution. Also, there's information about the time it took to solve the root node.

## Examples

    import orloge as ol
    ol.get_info_solver('tests/data/cbc298-app1-2.out', 'CBC')

Would produce the following:

    {'best_bound': -96.111283,
     'best_solution': None,
     'cut_info': {'best_bound': -210.09571,
                  'best_solution': 1e+50,
                  'cuts': None,
                  'time': None},
     'first_relaxed': -210.09571,
     'first_solution': 1e+50,
     'gap': None,
     'matrix': {'constraints': 53467, 'nonzeros': 199175, 'variables': 26871},
     'matrix_post': {'constraints': 26555, 'nonzeros': 195875, 'variables': 13265},
     'nodes': 31867,
     'presolve': None,
     'progress':       
     Node NodesLeft BestInteger CutsBestBound     Time
    0        0         1       1e+50    -210.09571    32.83
    1      100        11       1e+50    -210.09571   124.49
    ..     ...       ...         ...           ...      ...
    [319 rows x 5 columns],
     'rootTime': None,
     'sol_code': 0,
     'solver': 'CBC',
     'status': 'Stopped on time limit',
     'status_code': -4,
     'time': 7132.49,
     'version': '2.9.8'}

And another example, this time using GUROBI:

    import orloge as ol
    ol.get_info_solver('tests/data/gurobi700-app1-2.out', 'GUROBI')

Creates the following output:

    {'best_bound': -41.0,
     'best_solution': -41.0,
     'cut_info': {'best_bound': -167.97894,
                  'best_solution': -41.0,
                  'cuts': {'Clique': 1,
                           'Gomory': 16,
                           'Implied bound': 23,
                           'MIR': 22},
                  'time': 21.0},
     'first_relaxed': -178.94318,
     'first_solution': -41.0,
     'gap': 0.0,
     'matrix': {'constraints': 53467, 'nonzeros': 199175, 'variables': 26871},
     'matrix_post': {'constraints': 35616, 'nonzeros': 149085, 'variables': 22010},
     'nodes': 526.0,
     'presolve': {'cols': 4861, 'rows': 17851, 'time': 3.4},
     'progress':    
     Node NodesLeft   Objective Depth ...  CutsBestBound    Gap ItpNode Time
    0     0         0  -178.94318     0 ...     -178.94318   336%    None   4s
    1     0         0  -171.91701     0 ...     -171.91701   319%    None  15s
    2     0         0  -170.97660     0 ...     -170.97660   317%    None  15s
    [26 rows x 10 columns],
     'rootTime': 0.7,
     'sol_code': 1,
     'solver': 'GUROBI',
     'status': 'Optimal solution found',
     'status_code': 1,
     'time': 46.67,
     'version': '7.0.0'}

Parsing the complete progress table helps anyone who later wants to analyze the raw solution process. I've tried to use the status codes and solution codes present in [PuLP](https://github.com/coin-or/pulp).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pchtsp/orloge",
    "name": "orloge",
    "maintainer": "Franco Peschiera",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "pchtsp@gmail.com",
    "keywords": "Mathematical Optimization solver log parser",
    "author": "Franco Peschiera",
    "author_email": "pchtsp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/73/42/4df880442737ce17ebe9e0ce5d491b3af1b69c7c54387e6b5be2e25023f5/orloge-0.17.2.tar.gz",
    "platform": "",
    "description": "## Orloge\n[![Build Status](https://travis-ci.org/pchtsp/orloge.svg?branch=master)](https://travis-ci.org/pchtsp/orloge)\n\n\n## What and why\n\nThe idea of this project is to permit a fast and easy parsing of the log files from different solvers, specifically 'operations research' (OR) logs.\n\nThere exist bigger, and more robust libraries. In particular, [IPET](https://github.com/GregorCH/ipet/). The trouble I had was that it deals with too many benchmarking and GUI things and I wanted something simple I could modify and build on top.\n\nIn any case, a lot of the ideas and parsing strings were obtained or adapted from IPET, to whom I am graceful.\n\nThe supported solvers for the time being are: GUROBI, CPLEX and CBC. Specially the two first ones.\n\n## How\n\nThe basic idea is just to provide a unique interface function like the following:\n\n    import orloge as ol\n    ol.get_info_solver(path_to_solver_log, solver_name)\n\nThis returns a python dictionary with a lot of information from the log (see *Examples* below).\n\n## Installation\n\n    pip install orloge\n\nor, for the development version:\n\n    pip install https://github.com/pchtsp/orloge/archive/master.zip\n\n## Testing\n\nRun the command \n\n    python -m unittest test\n\n if the output says OK, all tests were passed.\n\n## Reference\n\n### Main parameters\n\nThe most common parameters to extract are: `best_bound`, `best_solution` and `time`. These three parameters are obtained at the end of the solving process and summarize the best relaxed objective value obtained, the best integer objective value obtained and the time it took to do the solving.\n\n### Cuts\n\nThe cuts information can be accessed by the `cuts_info` key. It offers the best known bound after the cut phase has ended, the best solution (if any) after the cuts and the number of cuts made of each type.\n\n### Matrix\n\nThere are two matrices that are provided. The `matrix` key returns the number of variables, constraints and non-zero values before the pre-processing of the solver. The `matrix_post` key returns these same values after the pre-processing has been done.\n\n### Progress\n\nThe `progress` key returns a raw pandas Dataframe with the all the progress information the solver gives. Including the times, the gap, the best bound, the best solution, the iterations, nodes, among other. This table can vary in number of columns between solvers but the names of the columns are normalized so as to have the same name for the same information.\n\n### Status\n\nThe status is given in several ways. First, a raw string extraction is returned in `status`. Then, a normalized one using codes is given via `sol_code` and `status_code` keys. `sol_code` gives information about the quality of the solution obtained. `status_code` gives details about the status of the solver after finishing (mainly, the reason it stopped).\n\n### Other\n\nThere is also information about the pre-solving phase, the first bound and the first solution. Also, there's information about the time it took to solve the root node.\n\n## Examples\n\n    import orloge as ol\n    ol.get_info_solver('tests/data/cbc298-app1-2.out', 'CBC')\n\nWould produce the following:\n\n    {'best_bound': -96.111283,\n     'best_solution': None,\n     'cut_info': {'best_bound': -210.09571,\n                  'best_solution': 1e+50,\n                  'cuts': None,\n                  'time': None},\n     'first_relaxed': -210.09571,\n     'first_solution': 1e+50,\n     'gap': None,\n     'matrix': {'constraints': 53467, 'nonzeros': 199175, 'variables': 26871},\n     'matrix_post': {'constraints': 26555, 'nonzeros': 195875, 'variables': 13265},\n     'nodes': 31867,\n     'presolve': None,\n     'progress':       \n     Node NodesLeft BestInteger CutsBestBound     Time\n    0        0         1       1e+50    -210.09571    32.83\n    1      100        11       1e+50    -210.09571   124.49\n    ..     ...       ...         ...           ...      ...\n    [319 rows x 5 columns],\n     'rootTime': None,\n     'sol_code': 0,\n     'solver': 'CBC',\n     'status': 'Stopped on time limit',\n     'status_code': -4,\n     'time': 7132.49,\n     'version': '2.9.8'}\n\nAnd another example, this time using GUROBI:\n\n    import orloge as ol\n    ol.get_info_solver('tests/data/gurobi700-app1-2.out', 'GUROBI')\n\nCreates the following output:\n\n    {'best_bound': -41.0,\n     'best_solution': -41.0,\n     'cut_info': {'best_bound': -167.97894,\n                  'best_solution': -41.0,\n                  'cuts': {'Clique': 1,\n                           'Gomory': 16,\n                           'Implied bound': 23,\n                           'MIR': 22},\n                  'time': 21.0},\n     'first_relaxed': -178.94318,\n     'first_solution': -41.0,\n     'gap': 0.0,\n     'matrix': {'constraints': 53467, 'nonzeros': 199175, 'variables': 26871},\n     'matrix_post': {'constraints': 35616, 'nonzeros': 149085, 'variables': 22010},\n     'nodes': 526.0,\n     'presolve': {'cols': 4861, 'rows': 17851, 'time': 3.4},\n     'progress':    \n     Node NodesLeft   Objective Depth ...  CutsBestBound    Gap ItpNode Time\n    0     0         0  -178.94318     0 ...     -178.94318   336%    None   4s\n    1     0         0  -171.91701     0 ...     -171.91701   319%    None  15s\n    2     0         0  -170.97660     0 ...     -170.97660   317%    None  15s\n    [26 rows x 10 columns],\n     'rootTime': 0.7,\n     'sol_code': 1,\n     'solver': 'GUROBI',\n     'status': 'Optimal solution found',\n     'status_code': 1,\n     'time': 46.67,\n     'version': '7.0.0'}\n\nParsing the complete progress table helps anyone who later wants to analyze the raw solution process. I've tried to use the status codes and solution codes present in [PuLP](https://github.com/coin-or/pulp).\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "OR log extractor",
    "version": "0.17.2",
    "project_urls": {
        "Download": "https://github.com/pchtsp/orloge/archive/master.zip",
        "Homepage": "https://github.com/pchtsp/orloge"
    },
    "split_keywords": [
        "mathematical",
        "optimization",
        "solver",
        "log",
        "parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91921307fc6cd85edc51d95f3c6b4ceb999f50569522abf90551eab6d93b2d2a",
                "md5": "8b717a7dbdc74af0e5ca8d633d9e09b8",
                "sha256": "d3310d814cd574a906354a1f9ad8370c45c897b934eb4affff54ccbe0056b287"
            },
            "downloads": -1,
            "filename": "orloge-0.17.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8b717a7dbdc74af0e5ca8d633d9e09b8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11816,
            "upload_time": "2021-09-08T09:49:23",
            "upload_time_iso_8601": "2021-09-08T09:49:23.492062Z",
            "url": "https://files.pythonhosted.org/packages/91/92/1307fc6cd85edc51d95f3c6b4ceb999f50569522abf90551eab6d93b2d2a/orloge-0.17.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73424df880442737ce17ebe9e0ce5d491b3af1b69c7c54387e6b5be2e25023f5",
                "md5": "e20646bc5b1542e5331467956286b6a1",
                "sha256": "e44cb97e3fae5411b095e994fcb9f555d674003f48851166c92104123cc46e33"
            },
            "downloads": -1,
            "filename": "orloge-0.17.2.tar.gz",
            "has_sig": false,
            "md5_digest": "e20646bc5b1542e5331467956286b6a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12929,
            "upload_time": "2021-09-08T09:49:24",
            "upload_time_iso_8601": "2021-09-08T09:49:24.781252Z",
            "url": "https://files.pythonhosted.org/packages/73/42/4df880442737ce17ebe9e0ce5d491b3af1b69c7c54387e6b5be2e25023f5/orloge-0.17.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-09-08 09:49:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pchtsp",
    "github_project": "orloge",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "orloge"
}
        
Elapsed time: 0.23335s