Skip to content

Solver does not converge for a simple case #2

@cubicshining

Description

@cubicshining

Seems the solver works forever for the following case:

x0 >= 4
x1 >= 2
x0 - x1 <= 3 (or -x0 + x1 >= -3)

I use canonicalization to remove the -3 by introducing a 3rd variable:
-x0 + x1 + x2 >= 0
x2 >= 3

With objective function (1, 1, 1) it has minimum at (4, 2, 3).

The solver works forwever. (See the following test:)

simplex::Matrix mobjectiveFunction;
mobjectiveFunction.resize(3, 1);
mobjectiveFunction(0) = 1;
mobjectiveFunction(1) = 1;
mobjectiveFunction(2) = 1;

simplex::Matrix mconstraints;
mconstraints.resize(4, 4);
mconstraints(0, 0) = 1;
mconstraints(0, 1) = 0;
mconstraints(0, 2) = 0;
mconstraints(0, 3) = 4;

mconstraints(1, 0) = 0;
mconstraints(1, 1) = 1;
mconstraints(1, 2) = 0;
mconstraints(1, 3) = 2;

mconstraints(2, 0) = -1;
mconstraints(2, 1) = 1;
mconstraints(2, 2) = 1;
mconstraints(2, 3) = 0;

mconstraints(3, 0) = 0;
mconstraints(3, 1) = 0;
mconstraints(3, 2) = 1;
mconstraints(3, 3) = 3;

Solver solver3(Solver::MODE_MINIMIZE, mobjectiveFunction, mconstraints);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions