Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monotonicity constraints: Simplifying SSP (x,y) Input Variable #295

Open
njericha opened this issue Jun 21, 2017 · 9 comments
Open

Monotonicity constraints: Simplifying SSP (x,y) Input Variable #295

njericha opened this issue Jun 21, 2017 · 9 comments
Labels
help wanted needs-clarification Needs a clear 'state', 'goal', 'analysis', and 'explanation' to reduce solution ambiguities.
Milestone

Comments

@njericha
Copy link
Collaborator

njericha commented Jun 21, 2017

Jump to bottom comment for latest information.


I have the following constraint on three of my input variables.

Consecutive vertexes have increasing x values. The start and end vertices of all layers go to the same x values.

The variables are "(x,y) of water table vertices'", "(x,y) of slip vertices'", and "(x,y) of slope vertices'". Can this constraint be simplified to "Monotonically Increasing"? And should these be compressed into 1 input variable? I ask because my input data table only includes a sing entry for "(x,y): cartesian position coordinates".

@JacquesCarette
Copy link
Owner

A 2D coordinate can be treated as 2 values and 1 value (and often is). We need to have Space be able to track that.

Experience has shown that the more you think of n-space as having points (i.e. forget the details of the coordinates), the better off you are. But the details can be tricky to manage.

@njericha njericha added the design Related to the current design of Drasil (not artifacts). label Jun 22, 2017
@szymczdm szymczdm added this to the 0.1.5 milestone Jun 22, 2017
@njericha njericha removed the question label Jul 24, 2017
@JacquesCarette
Copy link
Owner

I'm going to draw @niazim3 's attention to this issue. The point isn't to just go and 'fix' this (it needs some design first), but it is something worth pondering.

@niazim3
Copy link
Collaborator

niazim3 commented May 15, 2018

Summary of relevant information:
coords is defined in Unitals.hs as a ConstrConcept

coords = cuc' "(x,y)"
(cn $ "cartesian position coordinates" )
("y is considered parallel to the direction of the force of " ++
"gravity and x is considered perpendicular to y")
(Atomic "(x,y)") metre Real [] (dbl 1)

  • is used in sspOutputs
    sspOutputs :: [ConstrConcept]
    sspOutputs = [fs, coords, dx_i, dy_i]
  • is mentioned in A1 (monotonicF Sentence)
    monotonicF = foldlSent [S "The", phrase slpSrf,
    S "is concave with respect to", S "the" +:+. phrase slopeSrf,
    ((getES coords +:+ S "coordinates") `ofThe'` S "failure"),
    phrase surface, S "follow a monotonic function"]
  • is used in the definition for sspInputDataTable
    sspInputDataTable :: Contents
    sspInputDataTable = mkInputDatTb ([cqs coords] ++ map cqs sspInputs)
    --FIXME: this has to be seperate since coords is a different type

Re: "Can this constraint be simplified to "Monotonically Increasing"?"
If we are going to be simplifying the constraints, I believe we'd need 2 constraints: one in relation to monotonically increasing x-values, and one in relation to having the start and end independent values (i.e. x-values) be equal to each other.

Re: "And should these be compressed into 1 input variable? I ask because my input data table only includes a sing entry for "(x,y): cartesian position coordinates""
Since it is mentioned only once in the input data table, can it be considered as already compressed into 1 input variable?

(Note: Assumption 2 states "The geometry of the slope, and the material properties of the soil layers are given as inputs."; the input file has the format of inputting the # of soil layers, followed by the properties described in sspInputDataTable for each layer and then inputting the coordinates (only) for the water table (if any).)

@niazim3 niazim3 self-assigned this Jun 6, 2018
@niazim3
Copy link
Collaborator

niazim3 commented Jun 21, 2018

How about adding to the current Constrained core of

data ConstraintReason = Physical | Software
data Constraint where
  Range          :: ConstraintReason -> RealInterval Expr Expr -> Constraint
  EnumeratedReal :: ConstraintReason -> [Double]               -> Constraint
  EnumeratedStr  :: ConstraintReason -> [String]               -> Constraint

something similar to the following:

data Monotonicity = Increasing | Decreasing
data Constraint where...
  EnumNature     :: ConstraintReason -> Monotonicity           -> Constraint

?

This way, monotonicity will be handled in a similar way to how ranges and space constraints are currently handled.

@niazim3
Copy link
Collaborator

niazim3 commented Jun 21, 2018

And perhaps adding an Other constraint type for the constraints that are pretty specific to the examples (i.e. in this case "the start and end independent values should be equal to each other.").

@JacquesCarette
Copy link
Owner

I am not very keen on this. The current constraints (with variations on ranges) already teach Drasil about some mathematical concepts in a 'deep' way. The reason this is not-too-bad is because of how pervasive these concepts are, and how much we can leverage that knowledge once we have it.

Monotonicity is not like that. It is one of many mathematical concepts. It should be 'taught' to Drasil using features of Drasil made to extend the knowledge base of Drasil in a more dynamic way (i.e. via data in Data.Drasil.*) rather than in its core data-structures.

To be honest, I'm not that keen on EnumeratedReal and EnumeratedStr either. I would prefer to migrate them out, rather than add new things like it.

I realize that my answer is not necessarily helpful (at least, it isn't regarding a design to solve this problem). We do need a proper design for constraints and properties. And we don't have one (yet).

@balacij balacij added question needs-clarification Needs a clear 'state', 'goal', 'analysis', and 'explanation' to reduce solution ambiguities. and removed design Related to the current design of Drasil (not artifacts). labels Apr 26, 2023
@balacij balacij changed the title Simplifying SSP (x,y) Input Variable Monotonicity constraints: Simplifying SSP (x,y) Input Variable Jul 18, 2024
@balacij
Copy link
Collaborator

balacij commented Jul 18, 2024

It appears that #453 and this ticket are in conflict. I do think we want 'monotonicity' somehow attached to variables. Constraints in Drasil at the moment are problematic in that we don't really derive them from anywhere -- I understand where @JacquesCarette is coming from there.

I think the course of action is to merge these two tickets and discuss what actually goes into constraint tables, how we came about learning what to put in the constraint tables, and when said constraints are associated with variables.

Content from #453:

As commented in 1f17b36, the monotonicity constraint was deleted (by me) because it was encoded using an awful pile of hacks. It needs to be re-implemented properly.
(Originally posted by @JacquesCarette)

@smiths
Copy link
Collaborator

smiths commented Jul 18, 2024

@balacij I think at one time we fell into a trap of thinking that constraints are simply upper and lower bounds for a single variable. In many cases they are, but in other cases there is more going on. Some constraints will involve the relationship between more than one variable and others will be properties of the inputs or the output, like monotonicity. Some constraints will be derived from other constraints, some will come from physics, some will come from practical considerations. In metamorphic testing domain experts look for properties they know will be true based on their knowledge. As we discussed in #26 constraints should often (always?) be accompanied by a rationale. We need to track that information too.

I think some constraints are axioms that are attached to our theories, like the assumption that for projectile motion $t \geq 0$. Other constraints will be derived from the axioms and other theories, like the constraint that $p_{land} > 0$. I think the starting point is looking at how we are going to write our theories. The tables summarizing constraints would then just be generated from going through the theories and pulling out the constraints.

@JacquesCarette
Copy link
Owner

Right - this is where we desperately need theories. Constraints are then (relational) axioms on the variables of that theory.

Note that we could re-add some of the vocabulary of constraints to ModelExpr (but not Expr since we don't know what to do with these in CodeExpr).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted needs-clarification Needs a clear 'state', 'goal', 'analysis', and 'explanation' to reduce solution ambiguities.
Projects
None yet
Development

No branches or pull requests

6 participants