Menu

#1 Cassowary fails on valid constraint sets

open
nobody
None
5
2014-08-17
2006-05-23
No

Cassowary fails on the following constraint set which
is valid.

public final void testCassowary1b()
{
final ClSimplexSolver solver = new
ClSimplexSolver();

final ClLinearExpression left = new
ClLinearExpression(new ClVariable("left"));
final ClLinearExpression width = new
ClLinearExpression(new ClVariable("width"));

// the outer frame starts at 0 and has a width of 5
// the inner frame is inside the outer one
try
{
// the left edge has a positive coordinate
solver.addConstraint(new
ClLinearInequality(left));

// the right edge of the frame is on or
left of the right of coordinate 5
solver.addConstraint(new
ClLinearInequality(new
ClLinearExpression(5).minus(left).minus(width)));

// the inner frame is centered in the
region 0 -- 4
solver.addConstraint(new
ClLinearInequality(new
ClLinearExpression(2.5).minus(left).minus(width.times(0.5))));

// the left edge is on or left of coordinate 1
solver.addConstraint(new
ClLinearInequality(left.minus(new
ClLinearExpression(1.0))));
}
catch (ExCLRequiredFailure e)
{
System.out.println("fails but should
succeed:");
System.out.println("E.g., left=1.2 and
width=2.0 is a solution way in the middle of the
solution intervals");
}
catch (ExCLInternalError e)
{
System.out.println("ExCLInternalError");
}

System.out.println("success");
}

Discussion


Log in to post a comment.