# convert nlp to lp (2)

 0 Thanks for this post. I am dealing with a problem that z=x1*x2*x3*x4*x5, all are binary variables. So I can linearize as follows: z<=x1, z<=x2, z<=x3, z<=x4, z<=x5, z>=(x1+x2+x3+x4+x5)-4. I have another z1 = x3*x5*x8, all also are binary variables, and I do linearize z1 the same way as above: z1<=x3,..., z1>=(x3+x5+x8)-2. Then I run a small code with matlab and cplex12.5.1, the result shows that only one variable is triggered, never two or more x variables at the same time, which means that x could be like x[1,0,0,0,0,0,0,0] or x[0,0,0,1,0,0,0,0]. It only changes the position of x, and x[0,0,0,0,0,0,0,0] if the solver gives an infeasible solution. However, what I expect is that when I change the input (let's say the weight can be increased), the number of decision variables x should be increased correspondingly like x[1,0,1,0,0,0,1,0], but it does not work appropriately. It only has one decision variable 1 in the feasible solution case. Does anyone know how can I fix this problem. Many thanks. ----- updated the code: Since the code is pretty long, I uploaded the file via this link: https://mega.co.nz/#!Q451nTaB!aDo85U6sFE1x4YGEtrxTzB63-4jWoqPCyE5Z_VbT7kY . I used yalmip integrated in Matlab, and CPLEX 12.5.1 solver to run this program file. I wrote a concise program that describes what I want to do as in the file attached. Now, the problem is that the result of decision variables x always keeps TWO "1" variables whatever I change the traffic demands. This means that when the traffic demands change, the decision variables x might change the position, like x[0 1 1 0 0 0 0 0] to x[1 0 0 0 1 0 0 0], but it does not change the number of variables. What I would like to expect here is that when I change the traffic demands T, for instance, T is increased, x should be more "1", and when T is decreased to a small traffic amount, x should be ONE "1". Can you figure out any bugs here? Many thanks. asked 28 Dec '14, 18:47 ttungl 11●1●3 accept rate: 0% There is insufficient information given to say anything definitive. If you can find a solution with more than one nonzero component that is provably feasible and provably better in objective terms than what you get, then you have a bug in your code. (29 Dec '14, 17:17) Paul Rubin ♦♦ Thanks Dr. Paul Rubin. I wrote a program that can be able to give the result yet not correctly. The result shows that when adding a small amount of weight, it gives x[1,0,0,1,0,0,0,0] but it is expected as only one "1" decision variable is enough. When increasing a larger amount of weight, decision variables x still keep TWO triggered decision variables but in different order, like x[0,1,0,0,0,0,1,0]. It's wrong. That means when increasing a bigger amount of weight, the decision variables should be increased, and this can be done by CPLEX solver.How can I post my code for discussing? (12 Jan '15, 03:10) ttungl just edit your post, and then you can copy your code and select code formatting in selection bar. (12 Jan '15, 03:57) zBirdy thanks zBirdy, I already updated in this post. Since the code is long, I uploaded it through the megaupload for convenience. (12 Jan '15, 13:41) ttungl
Be the first one to answer this question!
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×65
×37
×12