Opened 3 years ago

#20362 new enhancement

MIP backends: Make variable type consistent between add_variable, set_variable_type (with deprecation)

Reported by: mkoeppe Owned by:
Priority: major Milestone: sage-7.2
Component: numerical Keywords: lp
Cc: dimpase, vdelecroix, jdemeyer Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Status quo:

  • add_variable uses 3 logical switches binary=False, continuous=False, integer=False (see #20324 regarding their defaulting behavior)
  • this matches the methods is_variable_continuous etc.
  • set_variable_type expresses the same thing using values 1, 0, -1.

Proposal (from #20354 discussion):

  • add_variable there should take a variable_type parameter, defaulting to 'continuous', with other possible values 'binary', 'integer'.
  • possibly deprecate the 3 switches
  • set_variable_type should take the same variable_type values 'continuous', 'binary', 'integer'.
  • definitely deprecate values 1, 0, -1.

There are similar idiosyncrasies elsewhere in the backend interface (should be made separate tickets)

  • Minimization is expressed as maximization=False in the constructor; as set_sense(-1); is queried by is_maximization
  • ...

Change History (0)

Note: See TracTickets for help on using tickets.