infeasible row in Cplex C++ - c++

I have a small question; I am solving MIP Model , coded on C++ and solving by Cplex solver. I remember that when I test the model with relatively smaller instances , it was giving me "infeasibility row …."; Now ,I test the same model on a large size instance and I get the infeasibility and it does not tell me which row causes infeasibility. How can I find the which parameter or constraint causes infeasibility ? While the larger instance is tested, the presolve is performed, may it cause the infeasibility? I googled about conflict refiner but could not find a small and clear example explaining how to invoke it ? I will be very happy, if you have any suggestions or ideas
Thank you

Another way to find where the infeasibility comes is to export your model as an LP file or similar, then try to solve it with the standalone cplex. It helps if you name your variables and constraints sensibly. Then you have all the interactive tools in cplex to help you find where the issues are.

in C++ you should have a look at FeasOpt
In the documentation see
CPLEX > User's Manual for CPLEX > Infeasibility and unboundedness
If you model in OPL you could call the relaxation from concert C++ APIs

Related

Accessing Pyomo user time with Neos

I teach an optimization course in which I use the Pyomo modeling language to solve problems. I also encourage students to compare solvers using Neos. However, I have not found a way to measure the computational time required to solve the problems.
To explain my point I have created this notebook in Colab (https://github.com/salvapineda/notebooks/blob/main/UserTimePyomoNeos.ipynb)
First, I solve a model using cbc without using NEOS. As you can see, the "Solver Information" includes the time required to solve the problem.
Then, I solve the same model using cbc through NEOS. However, the "Solver Information" does not include any time information.
Is there any way to access the computational time when I am solving Pyomo models in Neos?
Do you mean the breakdown of the computation time? The model in Colab on NEOS returns 0.00389 seconds.
Message: CBC 2.10.3 optimal, objective 3.49; 0 nodes, 2 iterations, 0.00389 seconds

Get marginal values (dual) for constraints in Pyomo MIP

I want to access dual variables for a MIP problem developed in python with Pyomo. To my understanding the dual is not created for MIP problems, but in my opinion there should be a work around for this.
This should be possible to use as a minimal working example, I'm using Gurobi myself.
I can see two possible solutions to this; 1. Fixing the binary/integer variables and resolve as LP and recreate the dual. 2. Getting dual only for the necessary constraints.
I've not been able to figure out a way to try the second method, for the first I've done something like:
m.solve() #solves the MIP problem
m.instance.x.fix() #fixing the binary variables (only have one in actual model)
m.instance.y.fix()
m.instance.z.fix()
m.instance.preprocess()
m.instance.dual = Suffix(direction=Suffix.IMPORT)
m.solve() #hopefully solving LP problem with dual
Let me know if anything is unclear or more information is needed, any help is appreciated.

Using Microsoft Solver Foundation to solve a linear programming task requiring thousands of data points

Using Microsoft Solver Foundation,I am trying to solve a linear program of the form Ax <= b where A is a matrix containing thousands of data points.
I know that I can new up a Model object and then use the AddConstraint method to add constraints in equation form. However putting those equations together where each contains thousands of variables is just not possible. I looked at the Model Class and can not find a way to just give it the matrix and other info.
How can I do this?
Thanks!
You can make A a parameter and bind data to it. Warning: Microsoft Solver Foundation has been discontinued a while ago, so you are advised to consider an alternative modeling system.

AR-HMM how to learn parameters

I am looking for a way either in python or C++ to learn the parameters of an AR-HMM model.
There are many package to do fitting and inference for HMM when emission probabilities are only conditional on the hidden state but I cannot seem to find one when emission probabilities are conditional on both the state and prior observations.
Available :
(source: tugraz.at)
Cannot find:
AR-HMM http://mayer.pro/files/HMM-web/HMM-ar.png
Does anyone know of such a package, the goal is to fit a regime switching AR(p) model. If it's possible to do regime switching ARMA(p,q) it's even better.
Python/Cpp preferred. Open source .

Cross Validation in libsvm

I'm using libsvm library in my project and have recently discovered that it provides out-of-the-box cross validation.
I'm checking the documentation and it says clearly that I have to call svm-train with -n switch to use CV feature
.
When I call it with -v switch I cannot get a model file which is needed by svm-predict.
Implementing Support Vector Machine from scratch is beyond the scope of my project, so I'd rather fix this one if it is broken or ask the community for support.
Can anybody help with that?
Here's the link to the library, implemented in C and C++, and here is the paper that describes how to use it.
Cause libsvm use cv only for parameter selection.
From libsvm FAQ:
Q: After doing cross validation, why there is no model file outputted ?
Cross validation is used for selecting good parameters. After finding them, you want to re-train the whole data without the -v option.
If you are going to use cv for estimating quality of classifier on your data you should implement external cross validation by splitting data, train on some part and test on other.
It's been a while since I used libsvm so I don't think I have the answer you're looking, but if you run the cross-validation and are satisfied with the results, running lib-svm with the same parameters without the -v will yield the same model.