coin-or / Ipopt

COIN-OR Interior Point Optimizer IPOPT
https://coin-or.github.io/Ipopt
Other
1.41k stars 281 forks source link

How can I set start point with command line? #732

Closed rlacjfjin closed 9 months ago

rlacjfjin commented 9 months ago

As title, now I have a problem file, named as my_model.nl and I can know the initial (part) solution of the model, in julia I can use set_start_value() function to do it, but now I want to use command line in wondws powershell. Is there any method to do it?

Thanks.

svigerske commented 9 months ago

When running Ipopt on an .nl file, it reads the starting point from the .nl file. There is no mechanism to read a separate file. So I would suggest you modify the program that created the .nl file to write a different starting point.

But if you don't mind changing the code, then this is the place where Ipopt's AMPL interface passes the starting point from the .nl file to Ipopt: https://github.com/coin-or/Ipopt/blob/1723adc0299b8c7b4b3f19b8f845fd4dad149a18/src/Apps/AmplSolver/AmplTNLP.cpp#L516-L520 You could modify this to read a point from a file, I suppose.

rlacjfjin commented 9 months ago

I don't really know much about the specification of the nl file, and I only know that the initial value information is included in the nl file through your reply! My current nl file is exported from julia's JuMP; Do you know how to convert an NL file to an MPS file? I know the model is bilinear model, and it can be written as mps or lp file. Or can you suggest a relevant link to the NL file specification? By the way, I try julia JuMP to convert nl file to mps file, such as : model = read_from_file("my_model.nl") write_to_file(model,"my_model.mps") It has some errors: MathOptInterface.UnsupportedAttribute{MathOptInterface.NLPBlock}: Attribute MathOptInterface.NLPBlock() is not supported by the model.

Thanks.

svigerske commented 9 months ago

The standard reference for the nl file format is https://ampl.github.io/nlwrite.pdf

I would use SCIP to read an nl and write a MPS or LP file. It may have the same problem as Julia, though, where it doesn't immediately recognize that the nonlinear part is quadratic. Doing a presolve, with option presolving/maxrounds=0, and writing the presolved problem may work, though.

rlacjfjin commented 9 months ago

Ok, Then I try to presolve using scip with option presolving/maxrounds=0, there are such informations: image is it means that my original problem is infeasible?

And I still write my presolved problem with mps file: image there are some warning, but it seems can solved, and the feasible solution is same as the orginal problem.

rlacjfjin commented 9 months ago

I think my original model has some numerical problems. are you interested in this issue with my original problem? I can share my problem. Thanks

svigerske commented 9 months ago

is it means that my original problem is infeasible?

No, it only means that the initial point in the .nl file is not feasible, but this is ok.

there are some warning, but it seems can solved, and the feasible solution is same as the orginal problem.

you may want to check the mps carefully. maybe it skipped printing some constraints

are you interested in this issue with my original problem?

not so much

rlacjfjin commented 9 months ago

Thanks for your help.