never executed always true always false
    1 {-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
    2 {-# OPTIONS_GHC -fno-cse #-} -- stupid cmdargs
    3 
    4 module Conjure.UI ( UI(..), OutputFormat(..), ui, versionLine ) where
    5 
    6 -- conjure
    7 import Conjure.Prelude
    8 import Conjure.RepositoryVersion ( repositoryVersion )
    9 import Paths_conjure_cp ( version )
   10 
   11 -- base
   12 import Data.Version ( showVersion )
   13 
   14 -- cmdargs
   15 import System.Console.CmdArgs hiding ( Default(..) )
   16 
   17 
   18 data UI
   19     = Modelling
   20         { essence                    :: FilePath            -- essence, mandatory
   21         -- flags related to output
   22         , outputDirectory            :: FilePath
   23         , numberingStart             :: Int
   24         , smartFilenames             :: Bool
   25         , responses                  :: String
   26         , responsesRepresentation    :: String
   27         , estimateNumberOfModels     :: Bool                -- if set Conjure will calculate
   28                                                             -- a lower bound on the number of models,
   29                                                             -- instead of running the usual modelling mode
   30         -- flags related to logging
   31         , logLevel                   :: LogLevel
   32         , verboseTrail               :: Bool
   33         , rewritesTrail              :: Bool
   34         , logRuleFails               :: Bool
   35         , logRuleSuccesses           :: Bool
   36         , logRuleAttempts            :: Bool
   37         , logChoices                 :: Bool
   38         -- flags related to modelling decisions
   39         , portfolio                  :: Maybe Int
   40         , strategyQ                  :: String
   41         , strategyA                  :: String
   42         , representations            :: Maybe String        -- (def: strategyA)
   43         , representationsFinds       :: Maybe String        -- (def: representations)
   44         , representationsGivens      :: Maybe String        -- (def: s)
   45         , representationsAuxiliaries :: Maybe String        -- (def: representations)
   46         , representationsQuantifieds :: Maybe String        -- (def: representations)
   47         , representationsCuts        :: Maybe String        -- (def: representations)
   48         , channelling                :: Bool
   49         , representationLevels       :: Bool                -- (def: True)
   50         , unnamedSymmetryBreaking    :: String
   51         , followModel                :: FilePath            -- this is a model to be followed
   52         , seed                       :: Maybe Int
   53         , limitModels                :: Maybe Int
   54         , limitTime                  :: Maybe Int
   55         , savedChoices               :: Maybe FilePath
   56         , outputFormat               :: OutputFormat        -- Essence by default
   57         , lineWidth                  :: Int                 -- 120 by default
   58         -- streamlining
   59         , generateStreamliners       :: String
   60         }
   61     | TranslateParameter
   62         { eprime                     :: FilePath            -- eprime, mandatory
   63         , essenceParam               :: FilePath            -- essence-param, mandatory
   64         , eprimeParam                :: Maybe FilePath      -- eprime-param, optional
   65                                                             -- by default (essenceParam <-.> "eprime-param")
   66         , logLevel                   :: LogLevel
   67         , limitTime                  :: Maybe Int
   68         , outputFormat               :: OutputFormat        -- Essence by default
   69         , lineWidth                  :: Int                 -- 120 by default
   70         }
   71     | TranslateSolution
   72         { eprime                     :: FilePath            -- eprime, mandatory
   73         , essenceParamO              :: Maybe FilePath      -- essence-param, optional
   74         , eprimeSolution             :: FilePath            -- eprime-solution, mandatory
   75         , essenceSolutionO           :: Maybe FilePath      -- essence-solution, optional
   76                                                             -- by default (eprimeSolution <-.> "solution")
   77         , logLevel                   :: LogLevel
   78         , limitTime                  :: Maybe Int
   79         , outputFormat               :: OutputFormat        -- Essence by default
   80         , lineWidth                  :: Int                 -- 120 by default
   81         }
   82     | ValidateSolution
   83         { essence                    :: FilePath            -- essence, mandatory
   84         , essenceParamO              :: Maybe FilePath      -- essence-param, optional
   85         , essenceSolution            :: FilePath            -- essence-solution, mandatory
   86                                                             -- by default (eprimeSolution <-.> "solution")
   87         , logLevel                   :: LogLevel
   88         , limitTime                  :: Maybe Int
   89         , outputFormat               :: OutputFormat        -- Essence by default
   90         , lineWidth                  :: Int                 -- 120 by default
   91         }
   92     | Solve
   93         { essence                    :: FilePath            -- essence, mandatory
   94         , essenceParams              :: [FilePath]
   95         , validateSolutionsOpt       :: Bool
   96         -- flags related to output
   97         , outputDirectory            :: FilePath
   98         , numberingStart             :: Int
   99         , smartFilenames             :: Bool
  100         , responses                  :: String
  101         , responsesRepresentation    :: String
  102         , solutionsInOneFile         :: Bool
  103         , runsolverCPUTimeLimit      :: Maybe Int
  104         , runsolverWallTimeLimit     :: Maybe Int
  105         , runsolverMemoryLimit       :: Maybe Int
  106         -- flags related to logging
  107         , logLevel                   :: LogLevel
  108         , verboseTrail               :: Bool
  109         , rewritesTrail              :: Bool
  110         , logRuleFails               :: Bool
  111         , logRuleSuccesses           :: Bool
  112         , logRuleAttempts            :: Bool
  113         , logChoices                 :: Bool
  114         -- flags related to modelling decisions
  115         , portfolio                  :: Maybe Int
  116         , strategyQ                  :: String
  117         , strategyA                  :: String
  118         , representations            :: Maybe String
  119         , representationsFinds       :: Maybe String
  120         , representationsGivens      :: Maybe String
  121         , representationsAuxiliaries :: Maybe String
  122         , representationsQuantifieds :: Maybe String
  123         , representationsCuts        :: Maybe String
  124         , channelling                :: Bool
  125         , representationLevels       :: Bool                -- (def: True)
  126         , unnamedSymmetryBreaking    :: String
  127         , followModel                :: FilePath            -- this is a model to be followed
  128         , seed                       :: Maybe Int
  129         , limitModels                :: Maybe Int
  130         , limitTime                  :: Maybe Int
  131         , useExistingModels          :: [FilePath]          -- [] by default, which means generate models
  132         -- flags for SR and the selected solver
  133         , savilerowOptions           :: [String]
  134         , solverOptions              :: [String]
  135         , solver                     :: String
  136         , graphSolver                :: Bool
  137         , cgroups                    :: Bool
  138         , nbSolutions                :: String              -- a number, or "all". by default 1
  139         , copySolutions              :: Bool
  140         -- output
  141         , outputFormat               :: OutputFormat        -- Essence by default
  142         , lineWidth                  :: Int                 -- 120 by default
  143         -- streamlining
  144         , generateStreamliners       :: String
  145         }
  146     | IDE
  147         { essence                    :: FilePath            -- Optional, will read from stdin if not provided
  148         , logLevel                   :: LogLevel
  149         , limitTime                  :: Maybe Int
  150         , lineWidth                  :: Int                 -- 120 by default
  151         , dumpDeclarations           :: Bool
  152         , dumpRepresentations        :: Bool
  153         }
  154     | Pretty
  155         { essence                    :: FilePath
  156         , normaliseQuantified        :: Bool
  157         , removeUnused               :: Bool
  158         , logLevel                   :: LogLevel
  159         , limitTime                  :: Maybe Int
  160         , outputFormat               :: OutputFormat        -- Essence by default
  161         , lineWidth                  :: Int                 -- 120 by default
  162         }
  163     | Diff
  164         { file1                      :: FilePath
  165         , file2                      :: FilePath
  166         , logLevel                   :: LogLevel
  167         , limitTime                  :: Maybe Int
  168         , outputFormat               :: OutputFormat        -- Essence by default
  169         , lineWidth                  :: Int                 -- 120 by default
  170         }
  171     | TypeCheck
  172         { essence                    :: FilePath
  173         , logLevel                   :: LogLevel
  174         , limitTime                  :: Maybe Int
  175         }
  176     | Split
  177         { essence                    :: FilePath
  178         , outputDirectory            :: FilePath
  179         , logLevel                   :: LogLevel
  180         , limitTime                  :: Maybe Int
  181         , outputFormat               :: OutputFormat        -- Essence by default
  182         , lineWidth                  :: Int                 -- 120 by default
  183         }
  184     | SymmetryDetection
  185         { essence                    :: FilePath
  186         , json                       :: FilePath
  187         , logLevel                   :: LogLevel
  188         , limitTime                  :: Maybe Int
  189         , outputFormat               :: OutputFormat        -- Essence by default
  190         , lineWidth                  :: Int                 -- 120 by default
  191         }
  192     | ParameterGenerator
  193         { essence                    :: FilePath
  194         , minInt                     :: Integer
  195         , maxInt                     :: Integer
  196         , logLevel                   :: LogLevel
  197         , limitTime                  :: Maybe Int
  198         , outputFormat               :: OutputFormat        -- Essence by default
  199         , lineWidth                  :: Int                 -- 120 by default
  200         }
  201     | AutoIG
  202         { essence                    :: FilePath
  203         , outputFilepath             :: FilePath
  204         , generatorToIrace           :: Bool
  205         , removeAux                  :: Bool
  206         , logLevel                   :: LogLevel
  207         , limitTime                  :: Maybe Int
  208         , outputFormat               :: OutputFormat        -- Essence by default
  209         , lineWidth                  :: Int                 -- 120 by default
  210         }
  211     | Boost
  212         { essence                    :: FilePath
  213         , logLevel                   :: LogLevel
  214         , logRuleSuccesses           :: Bool
  215         , limitTime                  :: Maybe Int
  216         , outputFormat               :: OutputFormat        -- Essence by default
  217         , lineWidth                  :: Int                 -- 120 by default
  218         }
  219     | Streamlining
  220         { essence                    :: FilePath
  221         , logLevel                   :: LogLevel
  222         , limitTime                  :: Maybe Int
  223         , outputFormat               :: OutputFormat        -- Essence by default
  224         , lineWidth                  :: Int                 -- 120 by default
  225         }
  226     | LSP
  227         { logLevel                   :: LogLevel
  228         , limitTime                  :: Maybe Int
  229         }
  230     deriving (Eq, Ord, Show, Data, Typeable, Generic)
  231 
  232 instance Serialize UI
  233 instance Hashable  UI
  234 instance ToJSON    UI where toJSON = genericToJSON jsonOptions
  235 instance FromJSON  UI where parseJSON = genericParseJSON jsonOptions
  236 
  237 
  238 data OutputFormat = Plain | Binary | ASTJSON | JSON | JSONStream | MiniZinc
  239     deriving (Eq, Ord, Show, Data, Typeable, Generic)
  240 
  241 instance Serialize OutputFormat
  242 instance Hashable  OutputFormat
  243 instance ToJSON    OutputFormat where toJSON = genericToJSON jsonOptions
  244 instance FromJSON  OutputFormat where parseJSON = genericParseJSON jsonOptions
  245 
  246 instance Default OutputFormat where def = Plain
  247 
  248 
  249 ui :: UI
  250 ui = modes
  251     [ Modelling
  252         { essence
  253             = def
  254             &= typ "ESSENCE_FILE"
  255             &= argPos 0
  256         , outputDirectory
  257             = "conjure-output"
  258             &= typDir
  259             &= name "output-directory"
  260             &= name "o"
  261             &= groupname "Logging & Output"
  262             &= explicit
  263             &= help "Where to save generated models.\n\
  264                     \Default value: 'conjure-output'"
  265         , numberingStart
  266             = 1
  267             &= name "numbering-start"
  268             &= groupname "Logging & Output"
  269             &= explicit
  270             &= help "Starting value for output files.\n\
  271                     \Default value: 1"
  272         , smartFilenames
  273             = False
  274             &= name "smart-filenames"
  275             &= groupname "Logging & Output"
  276             &= explicit
  277             &= help "Use \"smart names\" for models.\n\
  278                     \Directs Conjure to use the answers when producing \
  279                     \a filename and to ignore the order of questions. \
  280                     \Only useful if 'f' is used for questions."
  281         , responses
  282             = ""
  283             &= name "responses"
  284             &= groupname "Model generation"
  285             &= explicit
  286             &= help "A comma separated list of integers.\n\
  287                     \If provided, these will be used as the answers during \
  288                     \interactive model generation instead of prompting the user."
  289         , responsesRepresentation
  290             = ""
  291             &= name "responses-representation"
  292             &= groupname "Model generation"
  293             &= explicit
  294             &= help "A comma separated list of variable name : integer pairs.\n\
  295                     \If provided, these will be used as the answers during \
  296                     \interactive model generation instead of prompting the user \
  297                     \for the variable representation questions.\n\
  298                     \See --dump-representations for a list of available representation options."
  299         , estimateNumberOfModels
  300             = False
  301             &= name "estimate-number-of-models"
  302             &= groupname "Model generation"
  303             &= explicit
  304             &= help "Calculate (a lower bound on) the number of models, \
  305                     \instead of running the usual modelling mode."
  306         , logLevel
  307             = def
  308             &= name "log-level"
  309             &= groupname "Logging & Output"
  310             &= explicit
  311             &= help "Log level."
  312         , verboseTrail
  313             = False
  314             &= name "verbose-trail"
  315             &= groupname "Logging & Output"
  316             &= explicit
  317             &= help "Generate verbose trails."
  318         , rewritesTrail
  319             = False
  320             &= name "rewrites-trail"
  321             &= groupname "Logging & Output"
  322             &= explicit
  323             &= help "Generate trails about the applied rewritings."
  324         , logRuleFails
  325             = False
  326             &= name "log-rule-fails"
  327             &= groupname "Logging & Output"
  328             &= explicit
  329             &= help "Generate logs for rule failures. (Caution: can be a lot!)"
  330         , logRuleSuccesses
  331             = False
  332             &= name "log-rule-successes"
  333             &= groupname "Logging & Output"
  334             &= explicit
  335             &= help "Generate logs for rule applications."
  336         , logRuleAttempts
  337             = False
  338             &= name "log-rule-attempts"
  339             &= groupname "Logging & Output"
  340             &= explicit
  341             &= help "Generate logs for rule attempts. (Caution: can be a lot!)"
  342         , logChoices
  343             = False
  344             &= name "log-choices"
  345             &= groupname "Logging & Output"
  346             &= explicit
  347             &= help "Store the choices in a way that can be reused by -al"
  348         , portfolio
  349             = Nothing
  350             &= typ "PORTFOLIO"
  351             &= name "portfolio"
  352             &= groupname "Model generation"
  353             &= explicit
  354             &= help "Portfolio size. When it is set to N, Conjure will try to generate up to N models."
  355         , strategyQ
  356             = "f"
  357             &= typ "STRATEGY"
  358             &= name "strategy-q"
  359             &= name "q"
  360             &= groupname "Model generation"
  361             &= explicit
  362             &= help "Strategy for selecting the next question to answer. \
  363                     \Options: f (for first), i (for interactive), r (for random), x (for all). \
  364                     \Prepend a (for auto) to automatically skip \
  365                     \when there is only one option at any point.\n\
  366                     \Default value: f"
  367         , strategyA
  368             = "ai"
  369             &= typ "STRATEGY"
  370             &= name "strategy-a"
  371             &= name "a"
  372             &= groupname "Model generation"
  373             &= explicit
  374             &= help "Strategy for selecting an answer. Same options as strategy-q.\n\
  375                     \ c picks the most 'compact' option \
  376                     \at every decision point.\n\
  377                     \ s picks the 'sparsest' option \
  378                     \at every decision point: \
  379                     \useful for --representations-givens\n\
  380                     \Default value: ai"
  381         , representations
  382             = Nothing
  383             &= typ "STRATEGY"
  384             &= name "representations"
  385             &= groupname "Model generation"
  386             &= explicit
  387             &= help "Strategy for choosing a representation.\n\
  388                     \Default value: same as --strategy-a"
  389         , representationsFinds
  390             = Nothing
  391             &= typ "STRATEGY"
  392             &= name "representations-finds"
  393             &= groupname "Model generation"
  394             &= explicit
  395             &= help "Strategy for choosing a representation for a decision variable.\n\
  396                     \Default value: same as --representations"
  397         , representationsGivens
  398             = Nothing
  399             &= typ "STRATEGY"
  400             &= name "representations-givens"
  401             &= groupname "Model generation"
  402             &= explicit
  403             &= help "Strategy for choosing a representation for a parameter.\n\
  404                     \Default value: s (for sparse)"
  405         , representationsAuxiliaries
  406             = Nothing
  407             &= typ "STRATEGY"
  408             &= name "representations-auxiliaries"
  409             &= groupname "Model generation"
  410             &= explicit
  411             &= help "Strategy for choosing a representation for an auxiliary variable.\n\
  412                     \Default value: same as --representations"
  413         , representationsQuantifieds
  414             = Nothing
  415             &= typ "STRATEGY"
  416             &= name "representations-quantifieds"
  417             &= groupname "Model generation"
  418             &= explicit
  419             &= help "Strategy for choosing a representation for a quantified variable.\n\
  420                     \Default value: same as --representations"
  421         , representationsCuts
  422             = Nothing
  423             &= typ "STRATEGY"
  424             &= name "representations-cuts"
  425             &= groupname "Model generation"
  426             &= explicit
  427             &= help "Strategy for choosing a representation for cuts in 'branching on'.\n\
  428                     \Default value: same as --representations"
  429         , channelling
  430             = True
  431             &= name "channelling"
  432             &= groupname "Model generation"
  433             &= explicit
  434             &= help "Whether to produce channelled models \
  435                     \(true by default).\n"
  436         , representationLevels
  437             = True
  438             &= name "representation-levels"
  439             &= groupname "Model generation"
  440             &= explicit
  441             &= help "Whether to use built-in precedence levels when choosing representations. \
  442                     \Used to cut down the number of generated models.\n\
  443                     \Default: true"
  444         , unnamedSymmetryBreaking
  445             = "none"
  446             &= name "unnamed-symmetry-breaking"
  447             &= groupname "Model generation"
  448             &= explicit
  449             &= help "Level to use for breaking symmetries arising from unnamed types. \
  450                     \Options: none / fast-consecutive / fast-allpairs / complete-independently / complete.\n\
  451                     \Default: none"
  452         , followModel
  453             = ""
  454             &= name "follow-model"
  455             &= groupname "Model generation"
  456             &= explicit
  457             &= help "Provide a Conjure-generated Essence Prime model to be used as a guide during model generation. \
  458                     \Conjure will try to imitate the modelling decisions from this file."
  459         , seed
  460             = Nothing
  461             &= name "seed"
  462             &= groupname "Model generation"
  463             &= explicit
  464             &= help "Random number generator seed."
  465         , limitModels
  466             = Nothing
  467             &= name "limit-models"
  468             &= groupname "Model generation"
  469             &= explicit
  470             &= help "Maximum number of models to generate."
  471         , limitTime
  472             = Nothing
  473             &= name "limit-time"
  474             &= groupname "General"
  475             &= explicit
  476             &= help "Limit in seconds of real time."
  477         , savedChoices
  478             = def
  479             &= typFile
  480             &= name "choices"
  481             &= groupname "Model generation"
  482             &= explicit
  483             &= help "Choices to use for -al, \
  484                      \either an eprime file (created by --log-choices), or a json file."
  485         , outputFormat
  486             = def
  487             &= name "output-format"
  488             &= groupname "Logging & Output"
  489             &= explicit
  490             &= typ "FORMAT"
  491             &= help "Format to use for output. All output formats can also be used for input.\n\
  492                     \    plain: default\n\
  493                     \    binary: a binary encoding\n\
  494                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
  495                     \    json: a simplified JSON format, only used for parameters and solutions\n\
  496                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
  497                     \    minizinc: minizinc format for data files, only used for solutions\n"
  498         , lineWidth
  499             = 120
  500             &= name "line-width"
  501             &= groupname "Logging & Output"
  502             &= explicit
  503             &= help "Line width for pretty printing.\nDefault: 120"
  504         , generateStreamliners
  505             = ""
  506             &= name "generate-streamliners"
  507             &= groupname "Streamlining"
  508             &= explicit
  509             &= help "A comma separated list of integers.\n\
  510                     \If provided, the streamlining constraints that correspond to the given integers will be generated.\n\
  511                     \Run \"conjure streamlining ESSENCE_FILE\" to generate a list of all applicable streamliners."
  512         }   &= name "modelling"
  513             &= explicit
  514             &= help "The main act. Given a problem specification in Essence, \
  515                     \produce constraint programming models in Essence'."
  516             &= auto
  517     , TranslateParameter
  518         { eprime
  519             = def
  520             &= typ "ESSENCE_FILE"
  521             &= name "eprime"
  522             &= explicit
  523             &= help "An Essence' model generated by Conjure."
  524         , essenceParam
  525             = def
  526             &= typFile
  527             &= name "essence-param"
  528             &= explicit
  529             &= help "An Essence parameter for the original problem specification."
  530         , eprimeParam
  531             = def
  532             &= typFile
  533             &= name "eprime-param"
  534             &= explicit
  535             &= help "An Essence' parameter matching the Essence' model.\n\
  536                     \Default is 'foo.eprime-param' \
  537                     \if the Essence parameter file is named 'foo.param'."
  538         , logLevel
  539             = def
  540             &= name "log-level"
  541             &= groupname "Logging & Output"
  542             &= explicit
  543             &= help "Log level."
  544         , limitTime
  545             = Nothing
  546             &= name "limit-time"
  547             &= groupname "General"
  548             &= explicit
  549             &= help "Limit in seconds of real time."
  550         , outputFormat
  551             = def
  552             &= name "output-format"
  553             &= groupname "Logging & Output"
  554             &= explicit
  555             &= typ "FORMAT"
  556             &= help "Format to use for output. All output formats can also be used for input.\n\
  557                     \    plain: default\n\
  558                     \    binary: a binary encoding\n\
  559                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
  560                     \    json: a simplified JSON format, only used for parameters and solutions\n\
  561                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
  562                     \    minizinc: minizinc format for data files, only used for solutions\n"
  563         , lineWidth
  564             = 120
  565             &= name "line-width"
  566             &= groupname "Logging & Output"
  567             &= explicit
  568             &= help "Line width for pretty printing.\nDefault: 120"
  569         }   &= name "translate-parameter"
  570             &= explicit
  571             &= help "Refinement of Essence parameter files for a \
  572                     \particular Essence' model.\n\
  573                     \The model needs to be generated by Conjure."
  574     , TranslateSolution
  575         { eprime
  576             = def
  577             &= typFile
  578             &= name "eprime"
  579             &= explicit
  580             &= help "An Essence' model generated by Conjure.\n\
  581                      \Mandatory."
  582         , essenceParamO
  583             = def
  584             &= typFile
  585             &= name "essence-param"
  586             &= explicit
  587             &= help "An Essence parameter for the original problem specification.\n\
  588                      \Mandatory."
  589         , eprimeSolution
  590             = def
  591             &= typFile
  592             &= name "eprime-solution"
  593             &= explicit
  594             &= help "An Essence' solution for the corresponding Essence' model."
  595         , essenceSolutionO
  596             = def
  597             &= typFile
  598             &= name "essence-solution"
  599             &= explicit
  600             &= help "An Essence solution for the original problem specification.\n\
  601                     \By default, its value is the value of --eprime-solution \
  602                     \with extensions replaced by '.solution'."
  603         , logLevel
  604             = def
  605             &= name "log-level"
  606             &= groupname "Logging & Output"
  607             &= explicit
  608             &= help "Log level."
  609         , limitTime
  610             = Nothing
  611             &= name "limit-time"
  612             &= groupname "General"
  613             &= explicit
  614             &= help "Limit in seconds of real time."
  615         , outputFormat
  616             = def
  617             &= name "output-format"
  618             &= groupname "Logging & Output"
  619             &= explicit
  620             &= typ "FORMAT"
  621             &= help "Format to use for output. All output formats can also be used for input.\n\
  622                     \    plain: default\n\
  623                     \    binary: a binary encoding\n\
  624                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
  625                     \    json: a simplified JSON format, only used for parameters and solutions\n\
  626                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
  627                     \    minizinc: minizinc format for data files, only used for solutions\n"
  628         , lineWidth
  629             = 120
  630             &= name "line-width"
  631             &= groupname "Logging & Output"
  632             &= explicit
  633             &= help "Line width for pretty printing.\nDefault: 120"
  634         }   &= name "translate-solution"
  635             &= explicit
  636             &= help "Translation of solutions back to Essence."
  637     , ValidateSolution
  638         { essence
  639             = def
  640             &= typ "ESSENCE_FILE"
  641             &= name "essence"
  642             &= explicit
  643             &= help "Problem specification in Essence."
  644         , essenceParamO
  645             = def
  646             &= typFile
  647             &= name "param"
  648             &= explicit
  649             &= help "Essence parameter file."
  650         , essenceSolution
  651             = def
  652             &= typFile
  653             &= name "solution"
  654             &= explicit
  655             &= help "Essence solution."
  656         , logLevel
  657             = def
  658             &= name "log-level"
  659             &= groupname "Logging & Output"
  660             &= explicit
  661             &= help "Log level."
  662         , limitTime
  663             = Nothing
  664             &= name "limit-time"
  665             &= groupname "General"
  666             &= explicit
  667             &= help "Limit in seconds of real time."
  668         , outputFormat
  669             = def
  670             &= name "output-format"
  671             &= groupname "Logging & Output"
  672             &= explicit
  673             &= typ "FORMAT"
  674             &= help "Format to use for output. All output formats can also be used for input.\n\
  675                     \    plain: default\n\
  676                     \    binary: a binary encoding\n\
  677                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
  678                     \    json: a simplified JSON format, only used for parameters and solutions\n\
  679                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
  680                     \    minizinc: minizinc format for data files, only used for solutions\n"
  681         , lineWidth
  682             = 120
  683             &= name "line-width"
  684             &= groupname "Logging & Output"
  685             &= explicit
  686             &= help "Line width for pretty printing.\nDefault: 120"
  687         }   &= name "validate-solution"
  688             &= explicit
  689             &= help "Validating a solution."
  690     , Solve
  691         { essence
  692             = def
  693             &= typ "ESSENCE_FILE"
  694             &= argPos 0
  695         , essenceParams
  696             = []
  697             &= typ "PARAMETER_FILE(s)"
  698             &= args
  699         , validateSolutionsOpt
  700             = False
  701             &= name "validate-solutions"
  702             &= groupname "General"
  703             &= explicit
  704             &= help "Enable solution validation."
  705         , outputDirectory
  706             = "conjure-output"
  707             &= typDir
  708             &= name "output-directory"
  709             &= name "o"
  710             &= groupname "Logging & Output"
  711             &= explicit
  712             &= help "Where to save generated models.\n\
  713                     \Default value: 'conjure-output'"
  714         , numberingStart
  715             = 1
  716             &= name "numbering-start"
  717             &= groupname "Logging & Output"
  718             &= explicit
  719             &= help "Starting value for output files.\n\
  720                     \Default value: 1"
  721         , smartFilenames
  722             = False
  723             &= name "smart-filenames"
  724             &= groupname "Logging & Output"
  725             &= explicit
  726             &= help "Use \"smart names\" for models.\n\
  727                     \Directs Conjure to use the answers when producing \
  728                     \a filename and to ignore the order of questions. \
  729                     \Only useful if 'f' is used for questions."
  730         , responses
  731             = ""
  732             &= name "responses"
  733             &= groupname "Model generation"
  734             &= explicit
  735             &= help "A comma separated list of integers.\n\
  736                     \If provided, these will be used as the answers during \
  737                     \interactive model generation instead of prompting the user."
  738         , responsesRepresentation
  739             = ""
  740             &= name "responses-representation"
  741             &= groupname "Model generation"
  742             &= explicit
  743             &= help "A comma separated list of variable name : integer pairs.\n\
  744                     \If provided, these will be used as the answers during \
  745                     \interactive model generation instead of prompting the user \
  746                     \for the variable representation questions.\n\
  747                     \See --dump-representations for a list of available representation options."
  748         , solutionsInOneFile
  749             = False
  750             &= name "solutions-in-one-file"
  751             &= groupname "Logging & Output"
  752             &= explicit
  753             &= help "Place all solutions in a single file instead of generating a separate file per solution.\n\
  754                     \Off by default."
  755         , runsolverCPUTimeLimit
  756             = def
  757             &= name "runsolver-cpu-time-limit"
  758             &= groupname "runsolver"
  759             &= explicit
  760             &= help "Use runsolver to limit total CPU time (in seconds)"
  761         , runsolverWallTimeLimit
  762             = def
  763             &= name "runsolver-wall-time-limit"
  764             &= groupname "runsolver"
  765             &= explicit
  766             &= help "Use runsolver to limit total elapsed time (in seconds)"
  767         , runsolverMemoryLimit
  768             = def
  769             &= name "runsolver-memory-limit"
  770             &= groupname "runsolver"
  771             &= explicit
  772             &= help "Use runsolver to limit total memory usage (Maximum RSS - in megabytes)."
  773         , logLevel
  774             = def
  775             &= name "log-level"
  776             &= groupname "Logging & Output"
  777             &= explicit
  778             &= help "Log level."
  779         , verboseTrail
  780             = False
  781             &= name "verbose-trail"
  782             &= groupname "Logging & Output"
  783             &= explicit
  784             &= help "Generate verbose trails."
  785         , rewritesTrail
  786             = False
  787             &= name "rewrites-trail"
  788             &= groupname "Logging & Output"
  789             &= explicit
  790             &= help "Generate trails about the applied rewritings."
  791         , logRuleFails
  792             = False
  793             &= name "log-rule-fails"
  794             &= groupname "Logging & Output"
  795             &= explicit
  796             &= help "Generate logs for rule failures. (Caution: can be a lot!)"
  797         , logRuleSuccesses
  798             = False
  799             &= name "log-rule-successes"
  800             &= groupname "Logging & Output"
  801             &= explicit
  802             &= help "Generate logs for rule applications."
  803         , logRuleAttempts
  804             = False
  805             &= name "log-rule-attempts"
  806             &= groupname "Logging & Output"
  807             &= explicit
  808             &= help "Generate logs for rule attempts. (Caution: can be a lot!)"
  809         , logChoices
  810             = False
  811             &= name "log-choices"
  812             &= groupname "Logging & Output"
  813             &= explicit
  814             &= help "Store the choices in a way that can be reused by -al"
  815         , portfolio
  816             = Nothing
  817             &= typ "PORTFOLIO"
  818             &= name "portfolio"
  819             &= groupname "Model generation"
  820             &= explicit
  821             &= help "Portfolio size. When it is set to N, Conjure will try to generate up to N models."
  822         , strategyQ
  823             = "f"
  824             &= typ "STRATEGY"
  825             &= name "strategy-q"
  826             &= name "q"
  827             &= groupname "Model generation"
  828             &= explicit
  829             &= help "Strategy for selecting the next question to answer. \
  830                     \Options: f (for first), i (for interactive), r (for random), x (for all). \
  831                     \Prepend a (for auto) to automatically skip \
  832                     \when there is only one option at any point.\n\
  833                     \Default value: f"
  834         , strategyA
  835             = "c"
  836             &= typ "STRATEGY"
  837             &= name "strategy-a"
  838             &= name "a"
  839             &= groupname "Model generation"
  840             &= explicit
  841             &= help "Strategy for selecting an answer. Same options as strategy-q.\n\
  842                     \ c picks the most 'compact' option \
  843                     \at every decision point.\n\
  844                     \ s picks the 'sparsest' option \
  845                     \at every decision point: \
  846                     \useful for --representations-givens\n\
  847                     \Default value: c"
  848         , representations
  849             = Nothing
  850             &= typ "STRATEGY"
  851             &= name "representations"
  852             &= groupname "Model generation"
  853             &= explicit
  854             &= help "Strategy for choosing a representation.\n\
  855                     \Default value: same as --strategy-a"
  856         , representationsFinds
  857             = Nothing
  858             &= typ "STRATEGY"
  859             &= name "representations-finds"
  860             &= groupname "Model generation"
  861             &= explicit
  862             &= help "Strategy for choosing a representation for a decision variable.\n\
  863                     \Default value: same as --representations"
  864         , representationsGivens
  865             = Nothing
  866             &= typ "STRATEGY"
  867             &= name "representations-givens"
  868             &= groupname "Model generation"
  869             &= explicit
  870             &= help "Strategy for choosing a representation for a parameter.\n\
  871                     \Default value: s (for sparse)"
  872         , representationsAuxiliaries
  873             = Nothing
  874             &= typ "STRATEGY"
  875             &= name "representations-auxiliaries"
  876             &= groupname "Model generation"
  877             &= explicit
  878             &= help "Strategy for choosing a representation for an auxiliary variable.\n\
  879                     \Default value: same as --representations"
  880         , representationsQuantifieds
  881             = Nothing
  882             &= typ "STRATEGY"
  883             &= name "representations-quantifieds"
  884             &= groupname "Model generation"
  885             &= explicit
  886             &= help "Strategy for choosing a representation for a quantified variable.\n\
  887                     \Default value: same as --representations"
  888         , representationsCuts
  889             = Nothing
  890             &= typ "STRATEGY"
  891             &= name "representations-cuts"
  892             &= groupname "Model generation"
  893             &= explicit
  894             &= help "Strategy for choosing a representation for cuts in 'branching on'.\n\
  895                     \Default value: same as --representations"
  896         , channelling
  897             = True
  898             &= name "channelling"
  899             &= groupname "Model generation"
  900             &= explicit
  901             &= help "Whether to produce channelled models \
  902                     \(true by default).\n"
  903         , representationLevels
  904             = True
  905             &= name "representation-levels"
  906             &= groupname "Model generation"
  907             &= explicit
  908             &= help "Whether to use built-in precedence levels when choosing representations. \
  909                     \Used to cut down the number of generated models.\n\
  910                     \Default: true"
  911         , unnamedSymmetryBreaking
  912             = "none"
  913             &= name "unnamed-symmetry-breaking"
  914             &= groupname "Model generation"
  915             &= explicit
  916             &= help "Level to use for breaking symmetries arising from unnamed types. \
  917                     \Options: none / fast-consecutive / fast-allpairs / complete-independently / complete.\n\
  918                     \Default: none"
  919         , followModel
  920             = ""
  921             &= name "follow-model"
  922             &= groupname "Model generation"
  923             &= explicit
  924             &= help "Provide a Conjure-generated Essence Prime model to be used as a guide during model generation. \
  925                     \Conjure will try to imitate the modelling decisions from this file."
  926         , seed
  927             = Nothing
  928             &= name "seed"
  929             &= groupname "Model generation"
  930             &= explicit
  931             &= help "Random number generator seed."
  932         , limitModels
  933             = Nothing
  934             &= name "limit-models"
  935             &= groupname "Model generation"
  936             &= explicit
  937             &= help "Maximum number of models to generate."
  938         , limitTime
  939             = Nothing
  940             &= name "limit-time"
  941             &= groupname "General"
  942             &= explicit
  943             &= help "Limit in seconds of real time."
  944         , useExistingModels
  945             = []
  946             &= name "use-existing-models"
  947             &= groupname "Model generation"
  948             &= explicit
  949             &= typFile
  950             &= help "File names of Essence' models generated beforehand.\n\
  951                     \If given, Conjure skips the modelling phase and uses the existing models for solving.\n\
  952                     \The models should be inside the output directory (See -o)."
  953         , savilerowOptions
  954             = def
  955             &= name "savilerow-options"
  956             &= groupname "Options for other tools"
  957             &= explicit
  958             &= help "Options passed to Savile Row."
  959         , solverOptions
  960             = def
  961             &= name "solver-options"
  962             &= groupname "Options for other tools"
  963             &= explicit
  964             &= help "Options passed to the backend solver."
  965         , solver
  966             = "minion"
  967             &= name "solver"
  968             &= groupname "Options for other tools"
  969             &= explicit
  970             &= help "Backend solver. \
  971                     \Possible values:\n\
  972                     \ - minion (CP solver)\n\
  973                     \ - gecode (CP solver)\n\
  974                     \ - chuffed (CP solver)\n\
  975                     \ - or-tools (CP solver)\n\
  976                     \ - glucose (SAT solver)\n\
  977                     \ - glucose-syrup (SAT solver)\n\
  978                     \ - cadical (SAT solver)\n\
  979                     \ - kissat (SAT solver)\n\
  980                     \ - minisat (SAT solver)\n\
  981                     \ - bc_minisat_all (AllSAT solver, only works with --number-of-solutions=all)\n\
  982                     \ - nbc_minisat_all (AllSAT solver, only works with --number-of-solutions=all)\n\
  983                     \ - bdd_minisat_all (AllSAT solver, only works with --number-of-solutions=all)\n\
  984                     \ - wmaxcdcl (MaxSAT solver, only works with optimisation problems)\n\
  985                     \ - coin-or (MIP solver, implemented via MiniZinc)\n\
  986                     \ - cplex (MIP solver, implemented via MiniZinc)\n\
  987                     \ - boolector (SMT solver, supported logics: bv)\n\
  988                     \ - yices (SMT solver, supported logics: bv, lia, idl)\n\
  989                     \ - z3 (SMT solver, supported logics: bv, lia, nia)\n\
  990                     \Default: minion\n\n\
  991                     \Default logic for SMT solvers is bitvector (bv).\n\
  992                     \Append a dash and the name of a logic to the solver name to choose a different logic. For example yices-idl."
  993         , graphSolver
  994             = False
  995             &= name "graph-solver"
  996             &= groupname "General"
  997             &= explicit
  998             &= help "Create input files for the Glasgow graph solver."
  999         , cgroups
 1000             = False
 1001             &= name "cgroups"
 1002             &= groupname "General"
 1003             &= explicit
 1004             &= help "Setup and use cgroups when solving with Savile Row."
 1005         , nbSolutions
 1006             = "1"
 1007             &= name "number-of-solutions"
 1008             &= groupname "General"
 1009             &= explicit
 1010             &= help "Number of solutions to find; \
 1011                     \\"all\" enumerates all solutions.\n\
 1012                     \Default: 1"
 1013         , copySolutions
 1014             = True
 1015             &= name "copy-solutions"
 1016             &= groupname "General"
 1017             &= explicit
 1018             &= help "Whether to place a copy of solution(s) next to the Essence file or not.\n\
 1019                     \Default: on"
 1020         , outputFormat
 1021             = def
 1022             &= name "output-format"
 1023             &= groupname "Logging & Output"
 1024             &= explicit
 1025             &= typ "FORMAT"
 1026             &= help "Format to use for output. All output formats can also be used for input.\n\
 1027                     \    plain: default\n\
 1028                     \    binary: a binary encoding\n\
 1029                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1030                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1031                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1032                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1033         , lineWidth
 1034             = 120
 1035             &= name "line-width"
 1036             &= groupname "Logging & Output"
 1037             &= explicit
 1038             &= help "Line width for pretty printing.\nDefault: 120"
 1039         , generateStreamliners
 1040             = ""
 1041             &= name "generate-streamliners"
 1042             &= groupname "Streamlining"
 1043             &= explicit
 1044             &= help "A comma separated list of integers.\n\
 1045                     \If provided, the streamlining constraints that correspond to the given integers will be generated.\n\
 1046                     \Run \"conjure streamlining ESSENCE_FILE\" to generate a list of all applicable streamliners."
 1047         }   &= name "solve"
 1048             &= explicit
 1049             &= help "A combined mode for convenience.\n\
 1050                     \Runs Conjure in modelling mode followed by \
 1051                     \parameter translation if required, \
 1052                     \then Savile Row + Minion to solve, and \
 1053                     \then solution translation."
 1054     , IDE
 1055         { essence
 1056             = def
 1057             &= typ "ESSENCE_FILE"
 1058             &= argPos 0
 1059         , dumpDeclarations
 1060             = False
 1061             &= name "dump-declarations"
 1062             &= groupname "IDE Features"
 1063             &= explicit
 1064             &= help "Print information about top level declarations."
 1065         , dumpRepresentations
 1066             = False
 1067             &= name "dump-representations"
 1068             &= groupname "IDE Features"
 1069             &= explicit
 1070             &= help "List the available representations for decision variables and parameters."
 1071         , logLevel
 1072             = def
 1073             &= name "log-level"
 1074             &= groupname "Logging & Output"
 1075             &= explicit
 1076             &= help "Log level."
 1077         , limitTime
 1078             = Nothing
 1079             &= name "limit-time"
 1080             &= groupname "General"
 1081             &= explicit
 1082             &= help "Limit in seconds of real time."
 1083         , lineWidth
 1084             = 120
 1085             &= name "line-width"
 1086             &= groupname "Logging & Output"
 1087             &= explicit
 1088             &= help "Line width for pretty printing.\nDefault: 120"
 1089         }   &= name "ide"
 1090             &= explicit
 1091             &= help "IDE support features for Conjure.\n\
 1092                     \Not intended for direct use."
 1093     , Pretty
 1094         { essence
 1095             = def
 1096             &= typ "ESSENCE_FILE"
 1097             &= argPos 0
 1098         , logLevel
 1099             = def
 1100             &= name "log-level"
 1101             &= groupname "Logging & Output"
 1102             &= explicit
 1103             &= help "Log level."
 1104         , normaliseQuantified
 1105             = False
 1106             &= name "normalise-quantified"
 1107             &= explicit
 1108             &= help "Normalise the names of quantified variables."
 1109         , removeUnused
 1110             = False
 1111             &= name "remove-unused"
 1112             &= explicit
 1113             &= help "Remove unused declarations."
 1114         , limitTime
 1115             = Nothing
 1116             &= name "limit-time"
 1117             &= groupname "General"
 1118             &= explicit
 1119             &= help "Limit in seconds of real time."
 1120         , outputFormat
 1121             = def
 1122             &= name "output-format"
 1123             &= groupname "Logging & Output"
 1124             &= explicit
 1125             &= typ "FORMAT"
 1126             &= help "Format to use for output. All output formats can also be used for input.\n\
 1127                     \    plain: default\n\
 1128                     \    binary: a binary encoding\n\
 1129                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1130                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1131                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1132                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1133         , lineWidth
 1134             = 120
 1135             &= name "line-width"
 1136             &= groupname "Logging & Output"
 1137             &= explicit
 1138             &= help "Line width for pretty printing.\nDefault: 120"
 1139         }   &= name "pretty"
 1140             &= explicit
 1141             &= help "Pretty print as Essence file to stdout.\n\
 1142                     \This mode can be used to view a binary Essence file in textual form."
 1143     , Diff
 1144         { file1
 1145             = def
 1146             &= typFile
 1147             &= argPos 0
 1148         , file2
 1149             = def
 1150             &= typFile
 1151             &= argPos 1
 1152         , logLevel
 1153             = def
 1154             &= name "log-level"
 1155             &= groupname "Logging & Output"
 1156             &= explicit
 1157             &= help "Log level."
 1158         , limitTime
 1159             = Nothing
 1160             &= name "limit-time"
 1161             &= groupname "General"
 1162             &= explicit
 1163             &= help "Limit in seconds of real time."
 1164         , outputFormat
 1165             = def
 1166             &= name "output-format"
 1167             &= groupname "Logging & Output"
 1168             &= explicit
 1169             &= typ "FORMAT"
 1170             &= help "Format to use for output. All output formats can also be used for input.\n\
 1171                     \    plain: default\n\
 1172                     \    binary: a binary encoding\n\
 1173                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1174                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1175                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1176                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1177         , lineWidth
 1178             = 120
 1179             &= name "line-width"
 1180             &= groupname "Logging & Output"
 1181             &= explicit
 1182             &= help "Line width for pretty printing.\nDefault: 120"
 1183         }   &= name "diff"
 1184             &= explicit
 1185             &= help "Diff on two Essence files. Works on models, parameters, and solutions."
 1186     , TypeCheck
 1187         { essence
 1188             = def
 1189             &= typ "ESSENCE_FILE"
 1190             &= argPos 0
 1191         , logLevel
 1192             = def
 1193             &= name "log-level"
 1194             &= groupname "Logging & Output"
 1195             &= explicit
 1196             &= help "Log level."
 1197         , limitTime
 1198             = Nothing
 1199             &= name "limit-time"
 1200             &= groupname "General"
 1201             &= explicit
 1202             &= help "Limit in seconds of real time."
 1203         }   &= name "type-check"
 1204             &= explicit
 1205             &= help "Type-checking a single Essence file."
 1206     , Split
 1207         { essence
 1208             = def
 1209             &= typ "ESSENCE_FILE"
 1210             &= argPos 0
 1211         , outputDirectory
 1212             = "conjure-output"
 1213             &= typDir
 1214             &= name "output-directory"
 1215             &= name "o"
 1216             &= groupname "Logging & Output"
 1217             &= explicit
 1218             &= help "Where to save generated models.\n\
 1219                     \Default value: 'conjure-output'"
 1220         , logLevel
 1221             = def
 1222             &= name "log-level"
 1223             &= groupname "Logging & Output"
 1224             &= explicit
 1225             &= help "Log level."
 1226         , limitTime
 1227             = Nothing
 1228             &= name "limit-time"
 1229             &= groupname "General"
 1230             &= explicit
 1231             &= help "Limit in seconds of real time."
 1232         , outputFormat
 1233             = def
 1234             &= name "output-format"
 1235             &= groupname "Logging & Output"
 1236             &= explicit
 1237             &= typ "FORMAT"
 1238             &= help "Format to use for output. All output formats can also be used for input.\n\
 1239                     \    plain: default\n\
 1240                     \    binary: a binary encoding\n\
 1241                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1242                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1243                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1244                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1245         , lineWidth
 1246             = 120
 1247             &= name "line-width"
 1248             &= groupname "Logging & Output"
 1249             &= explicit
 1250             &= help "Line width for pretty printing.\nDefault: 120"
 1251         }   &= name "split"
 1252             &= explicit
 1253             &= help "Split an Essence file to various smaller files. Useful for testing."
 1254     , SymmetryDetection
 1255         { essence
 1256             = def
 1257             &= typ "ESSENCE_FILE"
 1258             &= argPos 0
 1259         , json
 1260             = def
 1261             &= typ "JSON_FILE"
 1262             &= name "json"
 1263             &= groupname "Logging & Output"
 1264             &= explicit
 1265             &= help "Output JSON file.\n\
 1266                     \Default is 'foo.essence-json'\n\
 1267                     \if the Essence file is named 'foo.essence'"
 1268         , logLevel
 1269             = def
 1270             &= name "log-level"
 1271             &= groupname "Logging & Output"
 1272             &= explicit
 1273             &= help "Log level."
 1274         , limitTime
 1275             = Nothing
 1276             &= name "limit-time"
 1277             &= groupname "General"
 1278             &= explicit
 1279             &= help "Limit in seconds of real time."
 1280         , outputFormat
 1281             = def
 1282             &= name "output-format"
 1283             &= groupname "Logging & Output"
 1284             &= explicit
 1285             &= typ "FORMAT"
 1286             &= help "Format to use for output. All output formats can also be used for input.\n\
 1287                     \    plain: default\n\
 1288                     \    binary: a binary encoding\n\
 1289                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1290                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1291                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1292                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1293         , lineWidth
 1294             = 120
 1295             &= name "line-width"
 1296             &= groupname "Logging & Output"
 1297             &= explicit
 1298             &= help "Line width for pretty printing.\nDefault: 120"
 1299         }   &= name "symmetry-detection"
 1300             &= explicit
 1301             &= help "Dump some JSON to be used as input to ferret for symmetry detection."
 1302     , ParameterGenerator
 1303         { essence
 1304             = def
 1305             &= typ "ESSENCE_FILE"
 1306             &= argPos 0
 1307         , minInt
 1308             = 0
 1309             &= typ "INT"
 1310             &= name "MININT"
 1311             &= groupname "Integer bounds"
 1312             &= explicit
 1313             &= help "The minimum integer value for the parameter values.\nDefault: 0"
 1314         , maxInt
 1315             = 100
 1316             &= typ "INT"
 1317             &= name "MAXINT"
 1318             &= groupname "Integer bounds"
 1319             &= explicit
 1320             &= help "The maximum integer value for the parameter values.\nDefault: 100"
 1321         , logLevel
 1322             = def
 1323             &= name "log-level"
 1324             &= groupname "Logging & Output"
 1325             &= explicit
 1326             &= help "Log level."
 1327         , limitTime
 1328             = Nothing
 1329             &= name "limit-time"
 1330             &= groupname "General"
 1331             &= explicit
 1332             &= help "Limit in seconds of real time."
 1333         , outputFormat
 1334             = def
 1335             &= name "output-format"
 1336             &= groupname "Logging & Output"
 1337             &= explicit
 1338             &= typ "FORMAT"
 1339             &= help "Format to use for output. All output formats can also be used for input.\n\
 1340                     \    plain: default\n\
 1341                     \    binary: a binary encoding\n\
 1342                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1343                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1344                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1345                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1346         , lineWidth
 1347             = 120
 1348             &= name "line-width"
 1349             &= groupname "Logging & Output"
 1350             &= explicit
 1351             &= help "Line width for pretty printing.\nDefault: 120"
 1352         }   &= name "parameter-generator"
 1353             &= explicit
 1354             &= help "Generate an Essence model describing the instances of the problem class \
 1355                     \defined in the input Essence model.\n\
 1356                     \An error will be printed if the model has infinitely many instances."
 1357     , AutoIG
 1358         { essence
 1359             = def
 1360             &= typ "ESSENCE_FILE"
 1361             &= argPos 0
 1362         , outputFilepath
 1363             = def
 1364             &= typ "OUTPUT_FILE"
 1365             &= argPos 1
 1366         , generatorToIrace
 1367             = False
 1368             &= name "generator-to-irace"
 1369             &= explicit
 1370             &= help "Convert the givens in a hand written generator model to irace syntax."
 1371         , removeAux
 1372             = False
 1373             &= name "remove-aux"
 1374             &= explicit
 1375             &= help "Remove lettings whose name start with Aux"
 1376         , logLevel
 1377             = def
 1378             &= name "log-level"
 1379             &= groupname "Logging & Output"
 1380             &= explicit
 1381             &= help "Log level."
 1382         , limitTime
 1383             = Nothing
 1384             &= name "limit-time"
 1385             &= groupname "General"
 1386             &= explicit
 1387             &= help "Limit in seconds of real time."
 1388         , outputFormat
 1389             = def
 1390             &= name "output-format"
 1391             &= groupname "Logging & Output"
 1392             &= explicit
 1393             &= typ "FORMAT"
 1394             &= help "Format to use for output. All output formats can also be used for input.\n\
 1395                     \    plain: default\n\
 1396                     \    binary: a binary encoding\n\
 1397                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1398                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1399                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1400                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1401         , lineWidth
 1402             = 120
 1403             &= name "line-width"
 1404             &= groupname "Logging & Output"
 1405             &= explicit
 1406             &= help "Line width for pretty printing.\nDefault: 120"
 1407         }   &= name "autoig"
 1408             &= explicit
 1409             &= help "Functionality to support the AutoIG workflow."
 1410     , Boost
 1411         { essence
 1412             = def
 1413             &= typ "ESSENCE_FILE"
 1414             &= argPos 0
 1415         , logLevel
 1416             = def
 1417             &= name "log-level"
 1418             &= groupname "Logging & Output"
 1419             &= explicit
 1420             &= help "Log level."
 1421         , logRuleSuccesses
 1422             = False
 1423             &= name "log-rule-successes"
 1424             &= groupname "Logging & Output"
 1425             &= explicit
 1426             &= help "Generate logs for rule applications."
 1427         , limitTime
 1428             = Nothing
 1429             &= name "limit-time"
 1430             &= groupname "General"
 1431             &= explicit
 1432             &= help "Time limit in seconds (real time)."
 1433         , outputFormat
 1434             = def
 1435             &= name "output-format"
 1436             &= groupname "Logging & Output"
 1437             &= explicit
 1438             &= typ "FORMAT"
 1439             &= help "Format to use for output. All output formats can also be used for input.\n\
 1440                     \    plain: default\n\
 1441                     \    binary: a binary encoding\n\
 1442                     \    astjson: a JSON dump of the internal data structures, quite verbose\n\
 1443                     \    json: a simplified JSON format, only used for parameters and solutions\n\
 1444                     \    jsonstream: same as JSON, except in one special case. when multiple solutions are saved in a single file as json, this mode prints one solution per line\n\
 1445                     \    minizinc: minizinc format for data files, only used for solutions\n"
 1446         , lineWidth
 1447             = 120
 1448             &= name "line-width"
 1449             &= groupname "Logging & Output"
 1450             &= explicit
 1451             &= help "Line width to use during pretty printing.\nDefault: 120"
 1452         }   &= name "boost"
 1453             &= explicit
 1454             &= help "Strengthen an Essence model as described in \"Reformulating \
 1455                     \Essence Specifications for Robustness\",\n\
 1456                     \which aims to make search faster."
 1457     , Streamlining
 1458         { essence
 1459             = def
 1460             &= typ "ESSENCE_FILE"
 1461             &= argPos 0
 1462         , logLevel
 1463             = def
 1464             &= name "log-level"
 1465             &= groupname "Logging & Output"
 1466             &= explicit
 1467             &= help "Log level."
 1468         , limitTime
 1469             = Nothing
 1470             &= name "limit-time"
 1471             &= groupname "General"
 1472             &= explicit
 1473             &= help "Time limit in seconds (real time)."
 1474         , outputFormat
 1475             = def
 1476             &= name "output-format"
 1477             &= groupname "Logging & Output"
 1478             &= explicit
 1479             &= typ "FORMAT"
 1480             &= help "Conjure's output can be in multiple formats.\n\
 1481                     \    plain : The default\n\
 1482                     \    binary: A binary encoding of the Essence output.\n\
 1483                     \            It can be read back in by Conjure.\n\
 1484                     \    json  : A json encoding of the Essence output.\n\
 1485                     \            It can be used by other tools integrating with Conjure\n\
 1486                     \            in order to avoid having to parse textual Essence."
 1487         , lineWidth
 1488             = 120
 1489             &= name "line-width"
 1490             &= groupname "Logging & Output"
 1491             &= explicit
 1492             &= help "Line width to use during pretty printing.\nDefault: 120"
 1493         }   &= name "streamlining"
 1494             &= explicit
 1495             &= help "Generate streamlined Essence models."
 1496     , LSP {
 1497         logLevel = def,
 1498         limitTime = Nothing
 1499     } &= name "lsp"
 1500     ]      &= program "conjure"
 1501            &= helpArg [explicit, name "help"]
 1502            &= versionArg [explicit, name "version"]
 1503            &= summary (unlines [ "Conjure: The Automated Constraint Modelling Tool"
 1504                                , versionLine
 1505                                ])
 1506            &= help "The command line interface of Conjure takes a command name as the first argument \
 1507                    \followed by more arguments depending on the command.\n\
 1508                    \This help text gives a list of the available commands.\n\
 1509                    \For details of a command, pass the --help flag after the command name.\n\
 1510                    \For example: 'conjure translate-solution --help'"
 1511 
 1512 versionLine :: String
 1513 versionLine = "Conjure v" ++ showVersion version ++ " (Repository version " ++ repositoryVersion ++ ")"