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