Skip to content

tasks command

Paweł Waligóra edited this page Dec 15, 2023 · 8 revisions

Tasks

Call

program call with print command:

./knapsack-solver.exe tasks [file path]

Functionality

Performs commands written in .json file.

Arguments

[file path] - full path to .json file containing commands to be performed.

JSON File

JSON file has to be written in specific notation. As a list "commands" of JSON objects with fields:

  • "command"
  • "args"
{
    "commands" : [
        {
            "command" : "",
            "args" : [ ]
        }
    ]
}

For specific commands and arguments see commands.

Example JSON file

{
    "commands" : [
        {
            "command" : "generate",
            "args" : [
                "../tests/commands/batch1",
                "-batch", "1",

                "-isize", "18",
                "-subk", "1",
                "-maxks", "25",
                "-maxv", "10",
                "-maxw", "10",
                "-cd", "0.1",

                "-structure", "path"
            ]
        },

        {
            "command" : "solve",
            "args" : [
                "../tests/commands/batch1/problems/packaged_problem_0.json",
                "brute-force",
                "-order", "any",
                "-p"
            ]
        },

        {
            "command" : "solve",
            "args" : [
                "../tests/commands/batch1/problems/packaged_problem_0.json",
                "branch-and-bound",
                "-bf", "none",
                "-p"
            ]
        },

        {
            "command" : "solve",
            "args" : [
                "../tests/commands/batch1/problems/packaged_problem_0.json",
                "greedy",
                "-sort", "value",
                "-p"
            ]
        },

        {
            "command" : "solve",
            "args" : [
                "../tests/commands/batch1/problems/packaged_problem_0.json",
                "greedy",
                "-sort", "random",
                "-p"
            ]
        }
    ]
}