1
$\begingroup$

I am working on a logistics problem which require me to find the optimum quantity of product to be manufactured and also to be shipped to satisfy the customer demand. I have made a decision variable $y_{ijp}$ where this variable gives me the qty of product $p$ shipped from node $i$ to $j$. I have done some simple optimization examples previously on Qiskit and D-Wave, but I am not sure how to tackle this problem, since all the decision variables I encountered earlier were binary. Any resources or help regarding this?

New contributor
Another Random Guy is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
4
  • $\begingroup$ You can try to express the non-binary variable as sum $\sum 2^i x_i$, where $x_i$ is a binary variable. In the end you have binary optimization. $\endgroup$ Jun 21 at 6:19
  • $\begingroup$ For Qiskit take a look at the optimization tutorials qiskit.org/documentation/optimization/tutorials/index.html. It has converters that deal with integer variable as input. Also there is a warm starting optimizer tutorial around this too. $\endgroup$
    – Steve Wood
    Jun 21 at 13:39
  • $\begingroup$ @SteveWood, i have gone through these tutorials, the main issue is, while having an integer variable in my model, it adds a constraints, that in turn adds slack variables, which results in lot of qubits being used. I have to get a way past that $\endgroup$ Jun 22 at 7:11
  • $\begingroup$ Hi, @MartinVesely, can you elaborate or share a resource related to your answer. Thanks $\endgroup$ Jun 22 at 7:13

1 Answer 1

0
$\begingroup$

What do you mean by "declare"? Mathematically or in some programming language?

Perhaps what you really want to know is how to represent integral or rational variables using binary variables. The answer by Martin Vesely explains how to do it. Basically, you represent a non-binary variable $x$ with a bunch of binary variables $y_j$. $$\tag{1} x = \sum_{i=0}^{n-1} 2^i y_i + \sum_{j=1}^m 2^{-j} y_j.$$ If you want $x$ to be a float, then $m > 0$ and it determines the precision. Mind that this is not a good idea because your problem now has more variables than the original problem. Also, your feasibility space will be exponentially smaller compared to the solution space. Moreover, the new problem will require much more quantum resources.

If you don't want to mess around with binary expansions like in (1), D-Wave can handle Discrete Quadratic Models. This means the variables could be anything as long as they are discrete. They could be integers, strings or an array of floats. You basically "declare" a variable in a programming sense and just run the annealer.

If you want to use gate-based quantum computation then the approach in (1) is the only way. At this point, just use classical optimization. It really doesn't make sense to use a gate-based quantum computation for such problems.

$\endgroup$
2
  • $\begingroup$ Can you share some resource regarding the implementation in (1), this seems interesting. Thanks $\endgroup$ Jun 22 at 7:16
  • $\begingroup$ You might want to check this post which explains this pretty exhaustively or.stackexchange.com/questions/6526/… $\endgroup$
    – MonteNero
    Jun 22 at 9:04

Your Answer

Another Random Guy is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.