import jijmodeling as jm


def create_problem() -> jm.Problem:
    """
    Create the JijModeling problem definition.
    """
    # Placeholders for data from file
    I_set = jm.Placeholder("I", ndim=1, description="Set I")
    J_set = jm.Placeholder("J", ndim=1, description="Set J")
    a = jm.Placeholder("a", ndim=2, description="Parameter a")
    b = jm.Placeholder("b", ndim=1, description="Parameter b")

    # Decision variables
    x = jm.BinaryVar("x", shape=J_set.shape, description="Variable x")
    s = jm.IntegerVar(
        "s",
        shape=I_set.shape,
        lower_bound=0,
        upper_bound=100000,
        description="Variable s",
    )

    # Elements for indexing
    i = jm.Element("i", belong_to=I_set)
    j = jm.Element("j", belong_to=J_set)

    # Problem definition
    problem = jm.Problem("SetCovering", sense=jm.ProblemSense.MINIMIZE)

    # Objective function
    problem += jm.sum([i], s[i])

    # Constraints
    problem += jm.Constraint("c1", s[i] + jm.sum(j, a[i, j] * x[j]) == b[i], forall=i)

    return problem
