Package de.timefinder.algo.constraint

Examples of de.timefinder.algo.constraint.RasterConstraint


     * Initialize raster for all events
     */
    public void initAssignments(Collection<Assignment> events) {
        for (Assignment ass : events) {
            RasterCollection combinedRaster = new RasterCollection();
            RasterConstraint rc = ass.getEvent().getConstraint(RasterConstraint.class);
            if (rc != null)
                combinedRaster.add(rc.getRaster().getForbidden());

            EventRaster eventRaster = new EventRasterOneTreeMapImpl(slotsPerWeek);
//            EventRaster eventRaster = new EventRasterTreeMapImpl(slotsPerWeek);
            combinedRaster.add(eventRaster);
            combinedRaster.add(dayRaster);
View Full Code Here


            updateStatus(60);
            // 6. 'noOfTimeSlots'-lines describes the valid assignments of one subject (event/timeslot)
            int noOfTimeSlots = poolSettings.getTimeslotsPerWeek();
            for (Event currentEvent : getEventDao().getAll()) {
                RasterConstraint rc = newRasterConstraint();
                currentEvent.putConstraint(rc);
                WeekRaster raster = rc.getRaster();
                for (int ts = 0; ts < noOfTimeSlots; ts++) {
                    //String s = reader.readLine(); sb.append(s);
                    if (Integer.parseInt(bReader.readLine()) != 0) {
                        raster.set(ts, RasterEnum.ALLOWED);
                    }
View Full Code Here

        sb.append(getEventDao().getAll());
        return sb.toString();
    }

    private RasterConstraint newRasterConstraint() {
        return new RasterConstraint(poolSettings.createWeekRaster());
    }
View Full Code Here

            throw new IllegalArgumentException("There should be more than 0 events to optimize!");
        }

        for (Assignment ass : assignments) {
            Event ev = ass.getEvent();
            RasterConstraint rc = ev.getConstraint(RasterConstraint.class);
            if (rc == null) {
                rasterIsNull++;
                continue;
            }

            BitRaster raster = rc.getRaster().getForbidden();
            if (raster.getAssignments() >= raster.getLength()) {
                rasterIsEmpty++;
            }
        }
View Full Code Here

                algo.addResourceTo(pNo, evNumber);
            }

            // add a weight to each allowed slot (=> trees get the multiple weight -> this does not matter)
            RasterConstraint rasterC = event.getConstraint(RasterConstraint.class);
            BitRaster raster = rasterC.getRaster().getForbidden();
            int duration = event.getDuration();
            for (int slot = raster.getNextFree(0, duration);
                    slot >= 0 && slot < slotsPerWeek;
                    slot = raster.getNextFree(slot + 1, duration)) {
                algo.incSlotWeight(evNumber, slot, 1);// event.getPersons().size());
View Full Code Here

        setupLog();
        settings = new DataPoolSettings();
    }

    public RasterConstraint newRasterConstraint() {
        return new RasterConstraint(settings.createWeekRaster());
    }
View Full Code Here

        for (Dao<? extends DBInterface> dao : dataPool.getDaos()) {
            logger.info(dao.getType().getSimpleName() + " size: " + dao.getAll().size());
            for (DBInterface obj : dao.getAll()) {
                ConstraintObject val = ((ConstraintObject) obj);
                if (val.getConstraint(RasterConstraint.class) == null) {
                    val.putConstraint(new RasterConstraint(settings.createWeekRaster()));
                }
            }
        }

        setFire(true);
View Full Code Here

    @Test
    public void testAdd() {
        System.out.println("add");

        final Assignment ev1 = newAssignment(0, 5);
        RasterConstraint constr = newRasterConstraint();
        constr.getRaster().set(8, RasterEnum.FORBIDDEN);
        ev1.getEvent().putConstraint(constr);

        final Assignment ev2 = newAssignment(10, 1);

        matrix.initFromResources(newResources(Arrays.asList(ev1, ev2)));
View Full Code Here

        assertEquals(true, periode.inject(d, depth, collidingAssignment));
        assertEquals(0, d.getStart());
    }

    private RasterConstraint newForbidden(Integer... values) {
        RasterConstraint constraint = newRasterConstraint();
        for (Integer i : values) {
            constraint.getRaster().set(i, RasterEnum.FORBIDDEN);
        }
        return constraint;
    }
View Full Code Here

    }

    @Override
    public Event create() {
        Event ev = super.create();
        ev.putConstraint(new RasterConstraint(settings.createWeekRaster()));
        return ev;
    }
View Full Code Here

TOP

Related Classes of de.timefinder.algo.constraint.RasterConstraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.