Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support adding rows #183

Open
7 of 11 tasks
grandrew opened this issue Aug 2, 2021 · 1 comment
Open
7 of 11 tasks

Support adding rows #183

grandrew opened this issue Aug 2, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@grandrew
Copy link
Contributor

grandrew commented Aug 2, 2021

hyper-etable branch new_row
hyperc use branch develop (at least 03720e4 commit)

Add row works by instantiating the class

Check that newly instantiated objects appear as added rows as usual (see how it worked in XTJ)

  • Generate plan as in Support user-defined classes in Python actions #207
  • Add in reset function deleting objects
  • rewrite double solve in run function add to metadata solve and return plan option
  • solver create object with recid inrement from 0 and later top_index append
  • after search ojcects calculate reci and add DATA.SHEET1_idx stumb and generate plan.py code with corresponding arguments
  • delete created by solver object and run plan.py
  • in plan.py add _append_indexes side effect in SHEET1_Class class static method
- [ ] create SET objects for new rows instances - [ ] add to documentation to add to that set

Implementation idea:

  • create a hyperc solve metadata entry to fill with instantiated objects
  • in pddl.py find a place where it instantiates objects,
  • put the objects into list in metadata - if the list is present
  • loop through the array, check object class, add the object to table
@grandrew grandrew added the bug Something isn't working label Aug 2, 2021
andreykyz added a commit that referenced this issue Aug 5, 2021
andreykyz added a commit that referenced this issue Aug 5, 2021
@grandrew
Copy link
Contributor Author

grandrew commented Aug 5, 2021

class SHEET1_Class:
    
    def __init__(self):
        global SHEET1_addidx
        self.addidx = SHEET1_addidx + 1
        SHEET1_addidx += 1

    @side_effect_decorator
    @staticmethod
    def add(obj: SHEET1_Class):
        side_effect(lambda obj: SHEET1_added_objects.append(obj))
        side_effect(lambda obj: setattr(DATA, f"{obj.__class__.__name__}_{obj.__class__.__top_index+obj.addidx}", obj))

# classes.py (generated):
SHEET1 = set()

# user main.py actions:

# (when executing plan, SHEET1 will be replaced by OrderedSet())

def func():
    new_row = SHEET1_Class(B=1)
    new_row1 = SHEET1_Class(B=1)
    new_row2 = SHEET1_Class(B=1)
    SHEET1_Class.add(new_row)   # new_row.addidx == 1; DATA.SHEET_11

def use_my_rows(r: SHEET1_Class):
    assert r.B == 1
    r.B = 0
    # ...

# HyoerC Plan:

[[use_my_rows, <obj38724368235>], [use_my_rows, <obj972346324286>]]

# plan.py:

#...
use_my_rows(filter(lambda x: x.addidx == 1, gc.get_objects()))
use_my_rows(DATA.SHEET1_11)
# 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants