Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network simplex options missing in CPLEX MP #251

Open
4er4er4er opened this issue Feb 10, 2025 · 2 comments
Open

Network simplex options missing in CPLEX MP #251

4er4er4er opened this issue Feb 10, 2025 · 2 comments
Assignees

Comments

@4er4er4er
Copy link
Contributor

ASL's "netopt" is described in the option listing as

alg:network (network, netopt)
       Solve (substructure of) (MIP node) LPs by network simplex method.

whereas it should correspond to the listing for the ASL version:

netopt                 0 means never invoke the network optimizer.
                       1 (default) means invoke the network optimizer
                         only if the model had node and arc declarations.
                       2 means always invoke the network optimizer
                         (unless there are integer variables); the network
                         optimizer may be able to find and exploit an
                         embedded network.
                       3 is similar to 2, but sets CPLEX's LPMethod
                         to CPX_ALG_NET rather than explicitly invoking
                         the network optimizer.  This might make a
                         difference if CPLEX's presolve makes relevant
                         reductions.

ASL's other network simplex options -- all the other ones that begin with "net" -- are missing from the MP implementation.

(This was reported by a user who upgraded CPLEX and could no longer use netopt=2 and netfind=2 except by switching to cplexasl.)

@glebbelov
Copy link
Contributor

glebbelov commented Feb 11, 2025

MP does not read node/arc declarations from the NL model currently. Thus, the network structure is not known and the network optimizer cannot be called in general; only CPX_ALG_NET can be used with the usual LP solver. To achieve best network simplex performance, presolve=0 in cplex might be needed.

MP's netopt (no value) equals ASL's netopt=3. @4er4er4er do we need ASL-compatible values, e.g., for netopt only? @mapgccv Why has netopt no values, along with alg:primal, alg:barrier, etc? (They are primalopt, baropt in ASL by the way.)

netfind should be easy to add.

@4er4er4er
Copy link
Contributor Author

It seems to be more complicated than I thought. When there are node and arc definitions, the output from CPLEX (with default settings) suggests that it received a network structure from ASL. But when there are no node and arc definitions -- as in multi.mod + multi.dat from the book -- netopt 2 activates the network extractor in CPLEX, which looks for a network structure as specified by netfind:

ampl: model multi.mod;
ampl: data multi.dat;
ampl: option solver cplexasl;
ampl: option cplex_options 'netopt 2 netfind 2';
ampl: solve;

Presolve eliminates 7 constraints and 3 variables.
Adjusted problem:
60 variables, all linear
44 constraints, all linear; 165 nonzeros
	29 equality constraints
	15 inequality constraints
1 linear objective; 60 nonzeros.

CPLEX 22.1.1.0: netopt 2
netfind 2

CPLEX 22.1.1.0: optimal solution; objective 199500
Network extractor found 36 nodes and 75 arcs.
46 network simplex iterations.
24 dual simplex iterations (0 in phase I)
ampl: 

It would be interesting to make a version of this model using node and arc definitions for Supply and Demand, plus subject-to definitions for the Multi constraints, and see what happens with various netopt and netfind settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants