Forum Discussion

FICO's avatar
FICO
Community Manager
10 years ago

Ignored constraints on non linear problem

Hello all,

I'm working on a final studies project and i'm facing some issue on the Xpress Solver.

The versions i'm using are Xpress-IVE Version 1.24.00 64bit, Xpress Mosel Version 3.4.2 and Xpress Optimizer Version 24.01.04

When i'm running the following model, Xpress return 0 on all variables, ignoring the constraints "Neighborhood" and the last of "Non overlaping" (red lines) without giving me any error message.

What is even weirder is : when i help it finding the good solution giving it x(1)=0 (not defining it as a commentary anymore, green line), it is able to return the good solution respecting all the constraints.

Here is the code i'm using :

model ModelName

uses "mmxnlp";

declarations

NC=2

I=1..NC

J=0..NC

L : array(I) of integer       

x : array(J) of mpvar

Right: array(I,I) of mpvar

Left : array(I,I) of mpvar

V : array(J,J) of integer

Lc=3

R=0.5

Objective:linctr

end-declarations

L::[2,1]

V::[0, 1,-1,

    1, 0,-1,

   -1,-1, 0]

x(0)=0

!Expected results

!x(1)=0

!x(2)=2

!Form constraint

forall(i in I, j in I) Right(i,j)is_binary

forall(i in I, j in I)  Left(i,j)is_binary

forall(i in I) x(i) is_integer

!Positionning

forall(i in I, j in I | j <> i) x(j)+(100*(1-Right(i,j))) >= x(i)+L(i)

forall(i in I, j in I | j <> i) x(i)+L(i)+(100* Right(i,j)) >= x(j) +0.1

forall(i in I, j in I | j <> i) x(i)+(100*(1- Left(i,j))) >= x(j)+L(j)

forall(i in I, j in I | j <> i) x(j)+L(j)+(100*  Left(i,j)) >= x(i) +0.1

!Non overlaping

forall(i in I, j in I | j <> i)  Right(i,j)*(x(j)-(x(i)+L(i)))>=0;

forall(i in I, j in I | j <> i)   Left(i,j)*(x(i)-(x(j)+L(j)))>=0;

forall(i in I, j in I | j <> i)  Right(i,j)+ Left(i,j)>=1

!Neighborhood constraint

forall(i in J, j in J) V(i,j)*R >= V(i,j)*sqrt(((x(i)-x(j))^2))

!Capacity constraint

forall(i in I) x(i)+L(i)<=Lc

minimize (sum(i in I) sqrt(x(i)^2))

writeln("x=")

forall(i in I) writeln(getsol(x(i)))

writeln("Right=")

forall(i in I, j in I) writeln(getsol(Right(i,j)))

writeln("Left=")

forall(i in I, j in I) writeln(getsol(Left(i,j)))

end-model

I'm looking for what might have caused that and an eventual solution.

Thank you for reading and for your attention.

5 Replies

  • FICO's avatar
    FICO
    Community Manager

    Hi,

    Unfortunately version 24.01 fails to solve the problem and declares local infeasibility. SLP usually terminates with a solution in which infeasibility was attempted to be minimized, that is why it may look like it actually solved the problem just not correctly. To check the return status, you can use the function 'getprobstat'.

    However, the later releases should be able to solve this problem. Could you please try a more recent release?

  • FICO's avatar
    FICO
    Community Manager

    Thank you for that quick answer.

    What does Xpress mean by unfeasible? When i gave him a part of the solution it is able to give me what i'd expect. (It's what i explain about x(1)=0). He should be able to find at leat that very solution.

    I'd like to try to update it first, unluckily, because i'm a student and i'm using the university license, i'm not able to do it by myself. I'll look forward with the IT departement if we can update it. I'll try the function 'getprobstat' as soon as i could, but it's holyday time so i can't do it for now, i'll keep you informed about the results.

  • FICO's avatar
    FICO
    Community Manager

    The nonlinear solvers in Xpress are local solvers. This means that while the solvers are written for scalability, there is no gaurante that they will find a global optimum, or always find a feasible solution, unless your problem is convex.

    What happens when you fix a variable, is that you are changing both the problem statement, and the initial point that Xpress will use, making the problem easier for Xpess in this case.

  • FICO's avatar
    FICO
    Community Manager

    It took some time for the IT service to proceed the upgrade but it's now done.

    It was quite usefull but not enough.

    That allowed me to found the solution for the problem i spoke about, but as soon as i try to use it on a more complicated one, it starts ignoring some form constraints.

    At the begining, it didn't consider that i declared some variables as binary. I found a trick using, for exemple, if i want x binary, i declared x*(x-1)=0, forcing him to choose either 0 or 1.

    Now, he is ignoring some other constraints and don't use integer where it is supposed to do. I try to use another trick like x=round(x) but it seems that it can't be used with the mmxnlp module, neither ceil or floor.

    Hereby, i thank you for your help and your time but i'm afraid that Xpress isn't suited enough to help me solve my problem.

  • FICO's avatar
    FICO
    Community Manager

    Hi,

    Modelling a binary variable as x*(x-1) often makes the problem impossible to solve with a local solver as it will get stuck in a locally infeasible solution; probably the reason why the solution appears to be infeasible. There is a similar problem with using the round function, which will also make the problem non-differentiable.

    At the technology level, Xpress approaches a binary restriction x in {0,1} fundamentally differently then x*(x-1) = 0: the first one is treated as a MIP entity that will most likely be branched on (unless it can be fixed by implication or it happens to be 0 or 1 at the local optimal solutions) while the nonlinear constraint version is treated as a traditional problem constraint (which is not branched on in a local solver if it is converged to an infeasible point).