Opened 9 years ago

Closed 9 years ago

Last modified 3 years ago

#7270 closed enhancement (fixed)

numerical.MIP: named constraints and variables, methods, structure, etc

Reported by: ncohen Owned by: jkantor
Priority: major Milestone: sage-4.3
Component: numerical Keywords:
Cc: Merged in: sage-4.3.alpha1
Authors: Nathann Cohen Reviewers: Martin Albrecht
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by chapoton)

Hello everybody !!!

This is the last "fundamental" modification of class numerical.MIP. From now on, the methods' names should not change anymore, and the patches based upon this class should not have to be updated each time an update is sent for numerical.mip.

This patch changes mainly comports changes of structure in this class. Here is the list of what is includes :

  • The line
    from sage.numerical.mip import * 
    
    has been replaced by
    from sage.numerical.mip import MixedIntegerLinearProgram
    
    as asked in #7012
  • Private variables have been renamed with a '_' in front of their names. The user is not interested in them
    • x to _x
    • values to _values
    • all the variables defining the Linear Program ( variables types, bounds, name, objective, etc ) have been renamed. The new structure is easier to understand, and the code includes as a comment a Tree of these variables to explain it better.

  • The eq method has been added ( asked in #6913 )
  • Names in the Linear Program
    • Methods have been added to define names for :
      • The whole problem : set_problem_same
      • The objective function : set_objective_name
    • Methods have been modified to define names for :
      • The variables : new_variable now can take a name as part of its input
      • The constraints : similarly for add_constraint
  • A function _update_variables_name. The name of variables are only computed before the LP is written to a file. They are obviously useless in the solving process.
  • A function constraints to list the constraints of the LP.
  • Function write_mps and write_lp to export the problem to MPS and LP file format ( see the docstrings for more information )
  • Class MIPSolverException includes doctests of exceptions for GLPK ( CBC will follow )
  • Some comments have been added to the code to ease reviews :-)

Warnings :

  • To use this code you will need to have the new version of the GLPK spkg installed. It is available at ticket #7268.

Thank you for your help !!!

Nathann

Attachments (1)

trac_7270.patch (34.2 KB) - added by ncohen 9 years ago.

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by ncohen

comment:1 Changed 9 years ago by ncohen

  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 9 years ago by ncohen

  • Description modified (diff)

comment:3 Changed 9 years ago by ncohen

  • Description modified (diff)

comment:4 Changed 9 years ago by malb

  • Report Upstream set to N/A
  • Status changed from needs_review to positive_review

Looks good, positive review.

comment:5 Changed 9 years ago by mhansen

  • Authors set to Nathann Cohen
  • Merged in set to sage-4.3.alpha1
  • Resolution set to fixed
  • Reviewers set to Martin Albrecht
  • Status changed from positive_review to closed

I had to add a missing #optional on line 550.

comment:6 Changed 9 years ago by mvngu

  • Summary changed from numerical.MIP : named constraints and variables, methods, structure, etc ... to numerical.MIP: named constraints and variables, methods, structure, etc

comment:7 Changed 3 years ago by chapoton

  • Description modified (diff)
Note: See TracTickets for help on using tickets.