Skip to main content
add verification steps
Source Link

Verifying a solution

  1. For each assigned car A, if any, verify the assigned spot (P) that it has been assigned to has all of its attributes. In other words, Attributes(A) is a subset of Attributes(P).
  2. For each unassigned car B, let X be the set of spots in the input data that meet the car's attribute criteria.
    • If one or more spots in X is unassigned, abort these steps and mark the solution as invalid
    • If one or more cars assigned to spots in X has a greater maximum priority than MaxPriority(B), abort these steps and mark the solution as invalid
    • Let Z be the subset of cars assigned to spots in X where the maximum priority of the car = MaxPriority(B). If one or more cars in Z has a greater priority sum than SumPriority(B), abort these steps and mark the solution as invalid

What I have tried

What I have tried

Verifying a solution

  1. For each assigned car A, if any, verify the assigned spot (P) that it has been assigned to has all of its attributes. In other words, Attributes(A) is a subset of Attributes(P).
  2. For each unassigned car B, let X be the set of spots in the input data that meet the car's attribute criteria.
    • If one or more spots in X is unassigned, abort these steps and mark the solution as invalid
    • If one or more cars assigned to spots in X has a greater maximum priority than MaxPriority(B), abort these steps and mark the solution as invalid
    • Let Z be the subset of cars assigned to spots in X where the maximum priority of the car = MaxPriority(B). If one or more cars in Z has a greater priority sum than SumPriority(B), abort these steps and mark the solution as invalid

What I have tried

deleted 2 characters in body
Source Link

Spot 1 is the only spot that can accommodationaccommodate car 1. Both cars 2 and 3 can take spot 2 but priority is given to the bus, leaving car 3 unassigned.

Spot 1 is the only spot that can accommodation car 1. Both cars 2 and 3 can take spot 2 but priority is given to the bus, leaving car 3 unassigned.

Spot 1 is the only spot that can accommodate car 1. Both cars 2 and 3 can take spot 2 but priority is given to the bus, leaving car 3 unassigned.

add example input/output
Source Link

To be considered a valid assignment, a car's attributes must be a subset of the attributes for the assigned spot. See examples below.

Given multiple solutions, the "best" solution would minimize the number of open lots at any given time (ideally all the cars parked in the same lot). Even if it is a small block of time in the middle of the day, the lot can still be closed to minimize the cost of security guards.

Example input/output

Set 1

  • Attributes: [bus: -1; electric: -2; handicapped: -2]
  • Cars: [C1: bus, electric; C2: handicapped, C3: electric]
  • Spots: [P1: bus, electric; P2: bus, electric; P3: electric, handicapped]
  • Valid assignments: [C1-P1, C2-P3, C3-P2] and [C1-P2, C2-P3, C3-P1]

Set 2

  • Attributes: [bus: -1; electric: -2; handicapped: -2]
  • Cars: [C1: bus, handicapped; C2: bus, C3: electric]
  • Spots: [P1: bus, handicapped, electric; P2: bus, electric; P3: handicapped]
  • Valid assignments: [C1-P1, C2-P2, C3-null]

Spot 1 is the only spot that can accommodation car 1. Both cars 2 and 3 can take spot 2 but priority is given to the bus, leaving car 3 unassigned.

Set 3

  • Attributes: [bus: -1; electric: -2; handicapped: -2]
  • Cars: [C1: bus, electric; C2: electric, C3: bus]
  • Spots: [P1: bus, electric; P2: electric; P3: electric, handicapped]
  • Valid assignments: [C1-P1, C2-P2, C3-null] or [C1-P1, C2-P3, C3-null]

There are two buses but only one bus parking spot. Since C1 has a greater priority sum, it is assigned to the available spot even though C3 could have taken it.

Given multiple solutions, the "best" solution would minimize the number of open lots at any given time (ideally all the cars parked in the same lot). Even if it is a small block of time in the middle of the day, the lot can still be closed to minimize the cost of security guards.

To be considered a valid assignment, a car's attributes must be a subset of the attributes for the assigned spot. See examples below.

Given multiple solutions, the "best" solution would minimize the number of open lots at any given time (ideally all the cars parked in the same lot). Even if it is a small block of time in the middle of the day, the lot can still be closed to minimize the cost of security guards.

Example input/output

Set 1

  • Attributes: [bus: -1; electric: -2; handicapped: -2]
  • Cars: [C1: bus, electric; C2: handicapped, C3: electric]
  • Spots: [P1: bus, electric; P2: bus, electric; P3: electric, handicapped]
  • Valid assignments: [C1-P1, C2-P3, C3-P2] and [C1-P2, C2-P3, C3-P1]

Set 2

  • Attributes: [bus: -1; electric: -2; handicapped: -2]
  • Cars: [C1: bus, handicapped; C2: bus, C3: electric]
  • Spots: [P1: bus, handicapped, electric; P2: bus, electric; P3: handicapped]
  • Valid assignments: [C1-P1, C2-P2, C3-null]

Spot 1 is the only spot that can accommodation car 1. Both cars 2 and 3 can take spot 2 but priority is given to the bus, leaving car 3 unassigned.

Set 3

  • Attributes: [bus: -1; electric: -2; handicapped: -2]
  • Cars: [C1: bus, electric; C2: electric, C3: bus]
  • Spots: [P1: bus, electric; P2: electric; P3: electric, handicapped]
  • Valid assignments: [C1-P1, C2-P2, C3-null] or [C1-P1, C2-P3, C3-null]

There are two buses but only one bus parking spot. Since C1 has a greater priority sum, it is assigned to the available spot even though C3 could have taken it.

clarify desired solution
Source Link
Loading
clarify desired solution
Source Link
Loading
add objectives
Source Link
Loading
added 15 characters in body
Source Link
Loading
Source Link
Loading