How to generate solution file?

Hello,
I am using Cbc solver. I used the code mentioned below to generate .sol file at particular location:

m=Model(solver=CbcSolver(ResultFile=“E:/SolverFuncSolution.sol”)
It is generating .sol file but it is not solution. Its mathematical model. What is the reason?

Can you post the whole program?

Sorry I can’t. I checked CbcSolver blog. It’s mentioned that .sol file generation provision has been eliminated. There must be some alternative approach.

Next time you ask a question on this forum, please make sure you add a minimum context. Your question is coming out of nowhere and the code is incomplete.

2 Likes

Hello,
I do agree with you. Hope my explanation is quite clear. I just want to know the syntax for generating .sol file after solving a model with Cbc or Ipopt solver. For instance, we can write writeLP(m::Model,file::AbstractString) to generate .lp file for the model. What would be the right approach to generate solution file?

Hello,
Please check my code and it’s working.
m=Model(solver=CbcSolver())
filename=“Enter path of the file such as E:/filename”
file=open(filename,“w”)
write(file,“$m.sol”)

I would also request all of you to try the same
writeLP(m,filename)

Check two files. It is applicable for any linear mathematical model.

Your code is not a minimal working example: sol is not a field of m. Do you want the value of the objective function getvalue(m.obj) to be saved?

If you want an AMPL format .sol file, you need to use the AmplNLWriter package.

1 Like

Hello,
I do appreciate your attempt. We know it. Our object is to
generate entire solution file from a .lp file. It is a common feature of
CPLEX. Is there any such option in Cbc/Ipopt solver? I appreciate your
participation.

Thanks,

Your question has nothing to do with Julia then.

The Ipopt AMPL executable can take a .nl file as input and outputs a .sol file. The Cbc executable does similar, I think it can also read .lp or .mps files but again that isn’t a Julia question.

1 Like

Hello Tony,
Discussion should not be limited.Related topic
should be discussed for development. If possible try to incorporate such
issues as we are using Julia for different solvers. Solver packages should
effectively implement Julia. Am I correct? Well, be careful about intruders
with malcontent to your blog. I wish best to your development group.

Thanks and regards,