fico® xpress
898 TopicsHow can I use ODH for solving a MIP model using Xpress Python API?
Hi everyone, I want to play a bit with ODH for Xpress Solver. I did run ODH from the command line but now I want to integrate it in the whole pipeline of a Python program. What should I import? What are the functions/methods to use? Could you provide with a simple Python code snippet? Are there any example I could use to understand the minimum steps to launch ODH with the Xpress Solver? Thanks in advance!4Views0likes2CommentsHow to make cuts added in a preIntsol callback globally valid (root node) instead of local to the current subtree?
I'm using the Xpress Optimizer Java API (com.dashoptimization, Xpress 9.4) to solve a MIP with lazy constraints that are generated dynamically. My constraints are all globally valid — they are not local to any node. Current approach: I register a preIntsol callback (AbstractPreIntsolListener). When a candidate integer solution is found, I check it, and if it violates one of my lazy constraints I build the cut, presolve it, and add it with prob.addCut(). I've disabled dual reductions (setMIPDualReductions(0)) as required for lazy constraints. This works correctly, but as I understand it XPRSaddcuts activates the cut at the current node and its descendants only. When the search backtracks above that node, the cut is deactivated (kept in the pool, but no longer in the active LP). Because my cuts are globally valid, this is safe, but it's inefficient: the same infeasible integer solution can be rediscovered elsewhere in the tree, re-triggering my callback to re-derive cuts I already found. What I want: I'd like each generated cut to be treated as globally valid — effectively added at the root node — so it stays active throughout the whole branch-and-bound tree and is never re-derived. Is there a way to add a cut from within a callback and have it applied globally (root node), rather than only to the current node's subtree?3Views0likes2CommentsMIP solution status
Hello, I've been using code like this to get the solution status of a MIP: case getprobstat of XPRS_OPT: status:="Optimum found" XPRS_UNF: status:="Unfinished" XPRS_INF: status:="Infeasible" XPRS_UNB: status:="Unbounded" XPRS_OTH: status:="Failed" else status:="???" end-case I just discovered that there are also status codes like XPRS_MIP_INFEAS and other XPRS_MIP_*. Two of them look particularly useful: XPRS_MIP_SOLUTION and XPRS_MIP_NO_SOL_FOUND, since they offer additional information. How can these codes be used? Are they returned by getprobstat too? Are they used together with those in the code snippet above or these should not be mixed? Thank you, Miroslav5Views0likes3CommentsHow to improve Bestbound?
e.g. my optimal solution for this dataset is 116. it reaches 116 within 1000 seconds but bestbound is still close to 0. Optimization part: multiplier=ub_nal * (QUARTERS[-1] - 1) + 1# spread of coeficients less to fasten the convergence . if multiplier is smaller than this then can pick more lines with late start. if bigger then more gap. prob.setObjective( multiplier*line_used_ttl+new_line_num, sense=xp.minimize)# extreme cases #110+36=146 vs 165+36 prob.setControl({'maxtime': 2000})#2000/ 23% prob.setControl('cutstrategy', 3) # aggressive cuts prob.setControl('covercuts', 3) # max cover cuts at root prob.setControl('gomcuts', 2) # Gomory cuts at root prob.setControl('cutdepth', -1) # apply cuts at ALL tree depths (not just root) # replaces treecovcuts + treegomcuts prob.setControl('heursearcheffort',3) # heuriatic search effort prob.setControl('heuremphasis', 2) # hueristic branch and bound prob.setControl('HEURDIVERANDOMIZE',1)#heuristic uses priority weights on rows and columns to determine the order in which to e.g. round fractional columns, prob.setControl('nodeselection', 1) prob.setControl('presolve', 1) prob.setControl('presolvepasses', 10) prob.solve()0Views0likes4CommentsCan someone explain: Failed to initialize the compute server model, no license I 'm doing a base install on my work Windows 11 laptop for an evaluation. I may be misinformed, but the community lice
Screen shot of my error. I'm doing the "insight_python_example" found in: insight-developer-kit-5.17.0-win_x86_64\examples\insight\basic_apps\python\insight_python_example Are these example outdated? Did I miss a read me? It seems like it should work out of the box. It seems my xpauth.xpr is in the proper place (expressmp\bin) screen shot attached. https://www.fico.com/fico-xpress-optimization/docs/dms2020-02/installguide/dhtml/chapinst2_sec_secerrmsg.htmlImplementation of B&B with python
HI! I'm trying to implement a branc-and-bound solver by using the python interface of Xpress. I implemented a MINLP model, and I am trying to solve the linearization with the B&B algorithm. Even though there is quite a huge documentation, I am facing some problems; thus I have some questions: 1 - how is the cutoff updated throughout the algorithm? is there a way to get a message every time it changes? 1b- the cutoff rises to some value which should not be possible (the MINLP finds a smaller value than the bound of the MILP). Is it possible that it comes from the fact that I refused some LP solution because some constraints of the reformulation are violated? 2 - I wanted to get the information on the solution process by setting the control MIPLOG to 3, but I get only the logs in the first node. 3 - is there a way to print the list of the active nodes (I know I can get their numbers with the attirbute ACTIVENODES, but I would like to see the list to understand better the B&B tree)? 4 - the branching decision is a specific decision after the solution score function to get the "most violated" variable (I create the branches within the callback addChangeBranchObjectCallback ). However, in some cases, even though I set the new bounds (both with bo.addbounds and with bo.addrows) the branch is not created/updated. There are several children nodes in which is performed the same branching of the parent node (i.e., the bounds generated are not considered in the children). I can share the code (since showing here the logs probably do not help), in case let me know how. 5 - I saw that the problem has the attributes BRANCHVALUE and BRANCHVAR. I tried to use them insider the addChangeBranchObjectCallback but it didn't work. Can they be used only with default branching (e.g., the Xpress one). Some info on the version/parameters: I use Xpress 9.8, and I set PRESOLVE to 0 and THREADS to 1. Thanks a lot if you can help me! Best regards, Nicolò0Views0likes4CommentsProblem with Xpress installation: Module `mminsight' not found.
I attempted a new installation of Xpress and Insight on a Windows 11 PC. (Downloaded files yesterday.) xp9.8.0_win_x86_64_setup.exe and FICO_Xpress_Insight_5.16.1_Community_Edition_setup.exe installed successfully in their default directories. I opened a project in Workbench and tried to compile it - got error: Mosel: E-350: Module `mminsight' not found. Indeed, couldn't find mminsight.dso in either of the two installation directories. I found it in file insight-developer-kit-5.16.0-win_x86_64.zip but the installation instructions do not tell where to extract this file. Please advise. Thank you, MiroslavIs there a way to monitor the solver's progress or see intermediate updates.
Hello, I am working in Xpress IVE on an optimization model. Sometimes the problem size becomes large, and the solver takes a long time. During this time, I only see a blank screen with no indication of progress. Is there a way to monitor the solver's progress or see intermediate updates? Occasionally the software appears to hang, and I have to force-close it. Any guidance would be appreciated.A specific separation procedure, $(l,S)$ Inequalities, to solve the lot-sizing problem
Dear support team, I have tried to use a specific separation procedure, $(l, S)$ Inequalities, to solve the lot-sizing problem proposed in the references, like Algorithm and formulations for lot sizing problems by Laurence Wolsey. The compact formulation is very straightforward as it is an uncapacitated lot-sizing problem, known as LS-U. The compact formulation contains standard flow/inventory constraints together with a setup constraint. The objective is to minimize the costs of production rate, inventory holding, and setup time. $$ \sum_{j \in L \backslash S} x_{j} + \sum_{j \in S} d_{(j,l)} y_{j} \geq d_{(1,l)} $$ Based on the mentioned references, the above inequality was derived from the following: $$ \sum_{j \in S} x_{j} \leq \sum_{j \in S} d_{(j,l)} y_{j} + s_{l} $$ where, n stands for planning periods, 1<= l <= n, L={1,⋯,l} , and S subset of L. My first question is: How is the above first inequality actually derived from the second, and what is the benefit of such a rewritten form? From the implementation side, this link is the only one I have found so far. As this algorithm was implemented in the Mosel language, and I do not have any experience working with that, I was wondering if: Is it possible to translate the follwoing part of the code into its appropriate mathematical form? ! Generate the violated inequality if ds < D(p,1,l) - EPS then cut(ncut):= sum(t in 1..l) if(solprod(p,t)<(D(p,t,l)*solsetup(p,t))+EPS, produce(p,t), D(p,t,l)*setup(p,t)) - D(p,1,l) cutid(ncut):= 1 type(ncut):= CT_GEQ ncut+=1 end-if end-do Also, it would be great if there exists any equivalent Python code to see and benchmark All the best Abbas4Views0likes4CommentsVariable object mapping issue in Python Callbacks with Presolve enabled
Hi, I am implementing a Branch-and-Cut algorithm using the Xpress Python interface. I have structured my code as a class where I create variables (using xp.var) and store them in a dictionary attribute (e.g., self.variables['x']) to use them later in other methods or callbacks. I noticed a strange behavior when running the model with Presolve enabled. When I access these stored variable objects inside a callback (like OptNodeCallback), they seem to point to completely wrong variables. For instance, when I print my x variable dictionary inside the callback, I see y or w variables appearing in the values, even though the keys correspond to x variables. It looks like the internal variable indices are shifting due to presolve, but the Python objects are still pointing to the old indices (which now hold different variables). Since the variable order remains consistent, I suspect that when variables are removed during presolve, the internal indices shift (similar to a linked list or array removal), causing the Python objects to point to the wrong columns. If I turn off presolve (prob.controls.presolve = 0), the mapping works perfectly and I get the correct x variables. However, I want to keep presolve on for performance reasons. Is there a standard way to safely access the original Python variable objects inside a callback without disabling presolve? Thanks in advance.0Views0likes6Comments