New answers tagged

2

Integrating a piecewise linear function means you end up with a piecewise quadratic function. Unless there is come convex structure in the resulting piecewise quadratic function (i.e. the PWL is non-decreasing) you will end up with a model involving nonconvexities. It was an interesting question so I had to play around a bit with it, and wrote a small post ...


2

You can use IsQP, IsQCP to see the type of your model as follow: Let's sat your model called $m$: m.update() qp = m.IsQP qcp = m.IsQCP print(qp) print(qcp) The output will be a binary value which indicates that your model is QP if $qp =1$ or your model is a QCP if $qcp = 1$. You should also use the following code to set the model as non-convex: m.setParam('...


2

Maxcut with CPLEX CPOptimizer in https://github.com/AlexFleischerParis/howtowithopl/blob/master/maxcutcpo.mod using CP; execute { // time limit 10 s cp.param.timelimit=10; } int n=400; range r=1..n; // Random graph float edge_prob=0.5; int weight_range=10; int big=100000; tuple t { int i; int j; } {t} s={<i,j> | ordered i,j in r}; int ...


3

Have a look at MQLib, which contains efficient implementations of many published algorithms. Their paper is awesome too. You can find a lot of code for QUBO online, one of the most publicized being qbsolv from Dwave. It is meant as a demonstrator of how much better quantum algorithms are, and the method is very basic. In general, I would take any hype on ...


3

Within docplex I would use cpoptimizer and write mdl = CpoModel(name='portfolio_miqp') scale=10000 scaleQ = mdl.integer_var(0,200*scale,name='scaleQuantity of Items') scaleT = mdl.integer_var(0,100*scale,name='scalePeriod in days') scalex = mdl.integer_var(0,100*scale,name='scaleAdvertisement per day') Q=scaleQ/scale T=scaleT/scale x=scalex/scale alpha = ...


3

The error message suggests that you tried to access the solution before solving the model. At the point that mdl.maximize(profit) is executed, you have constructed your model, but you have not solved it. Trying invoking mdl.solve() next.


Top 50 recent answers are included